ANGSD: Analysis of next generation Sequencing Data

Latest tar.gz version is (0.938/0.939 on github), see Change_log for changes, and download it here.

Filters: Difference between revisions

From angsd
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
<pre>
Information on this page is for version 0.569 or higher. Sorry for confusion, hopefully program and wiki will be updated before weekend.
</pre>
We allow for filtering at many different levels.
We allow for filtering at many different levels.


Line 14: Line 10:
# etc
# etc


It follows that some filters will select a subset of data, and some of the filters will discard certain sites. If multiple filters has been chosen, the analysis will be limited to the chain of filters. Eg setting a qscore threshold and an effective sample size filter along with a MAF filter will first. Remove the data with low qscores, then we found out the number of samples with data, and remove those below the threshold. Then we calculate the MAF and remove those sites with af MAF below the threshold.  
It follows that some filters will select a subset of data, and some of the filters will discard certain sites. If multiple filters has been chosen, the analysis will be limited to the chain of filters.  


This page will describe some of these filters, and it follows that only some are available in the case of BAM input.
=Filters for Bam files=
=Read level filters=
We allow for filtering and manipulation a the read level using the following arguments.


;-only_proper_pairs [int]=0
We allow for filtering and manipulation a the read level. These filters include minimum mapping and base qualtity, paired reads and others. Additionally specific regions can be analysed. All of the filters for bam files are described in [[Input#BAM_files]].
Include only proper pairs (pairs of read with both mates mapped correctly). 1: include only proper (default), 0: use all reads. If your data is not paired end you have to choose 1
;-uniqueOnly [int]=0
remove reads that have multiple best hits.. 0 no (default), 1 remove
;-remove_bads [int]=1
Same as  the samtools flags -x which removes read with a flag above 255 (not primary, failure and duplicate reads)
;-minQ [int]=0
minimum base quality
;-minMapQ [int]=0
minimum mapQ quality. Internally this is handled by setting the bases with a qscore below the threshold to 'N'.
-baq [int] =0
perform baq computation, remember to cite the baq paper for this.
 
=Selected Regions=
BAM files allows for indexing which makes random retrieval of regions fast and easy. This section describes region lookup as we have implemented it in angsd.
 
;-r [region]
Specify a region with in a chromosome using the syntax [chr]:[start-stop]. examples
chr1:1-10000            // first 10000 based for chr1
chr2:50000-              //chr2 but exclude the first 50000 bases
chr11:1-                  //all of chr11
chr7:123456              //position 123456 of chr7
;-rf [region file]  
specify multiple regions in a file.
 
The format for the regions supplied to the '''-rf''' file is the same the '''-r''' command line arguments.


=Selected Sites=
=Selected Sites=
If you are interested in running your analysis at individual sites that are distributed throughout the entire genome, it might be faster to simply to loop over the entire data, but only analyse the data at specific positions. This can be done by supplying the [[Sites | -sites]] argument. With this approach we also allows for the forcing of major/minor alleles.
For analysing specfic regions see [[Input#BAM_files]]. If you are interested in running your analysis at individual sites that are distributed throughout the entire genome, it might be faster to simply to loop over the entire data, but only analyse the data at specific positions. This can be done by supplying the [[Sites | -sites]] argument. With this approach we also allows for the forcing of major/minor alleles using external information.  


=Allele frequencies=
=Allele frequencies=
; -minMaf [float]: only work with sites with a maf above 'float'
; -minMaf [float]: only work with sites with a maf above [float]


Of cause requires [[Allele Frequency estimation | -doMaf]].
Requires [[Allele Frequency estimation | -doMaf]].


=Polymorphic sites=
=Polymorphic sites=


; -minLRT [float]: only work with sits with an LRT>float
; -SNP_pval [float]: only work with sites with a p-value less than [float]


Of cause requires [[Allele Frequency estimation | -doMaf]].
Requires [[Allele Frequency estimation | -doMaf]].


=Number of non missing individuals=
=Number of non missing individuals=




; -minInd [int]: only work with sites with information from atleast int individuals
; -minInd [int]: only work with sites with information from at least [int] individuals


This functionality is implemented as part of the basic file reading and some of the downstream analysis [[Allele Counts |-doCounts]],[[Genotype Likelihoods | -GL]].
=Extra=
;-setMinDepth [int]:
Discard site if total sequencing depth (all individuals added together) is below [int]
Requires [[Alleles counts | -doCounts]]


=Extra=
;-setMaxDepth [int]:
;-setMinDepth:
Discard site if total sequencing depth (all individuals added together) is above [int]
Discard site if sequencing depth is below threshold
[[Alleles counts | -doCounts]]
;-setMaxDepth:
Discard site if sequencing depth is above threshold


These filter is implemented in [[Alleles counts | -doCounts]].


;-geno_minDeph
;-geno_minDeph
Line 81: Line 50:
This requires [[Alleles counts | -doCounts]] and [[Genotype calling |-doGeno ]]
This requires [[Alleles counts | -doCounts]] and [[Genotype calling |-doGeno ]]


;-trim
;-trim [int]
Removes the 'ends' of the reads, mostly useful for ancient DNA.
Removes the [int] bases in both 'ends' of the reads, mostly useful for ancient DNA.
 
This functionality is implemented as part of some of the downstream analysis [[Allele Counts |-doCounts]],[[Genotype Likelihoods | -GL]].


=Examples=
=Examples=





Revision as of 11:04, 26 February 2014

We allow for filtering at many different levels.

  1. Read level, MapQ, unique mapped reads etc
  2. Base level, qscore
  3. Sequencing depth
  4. Regions (using BAM indexing (active lookup))
  5. Single sites (passive lookup, also allows for forcing major and minor) -sites
  6. Filtering based on downstream analysis. minimum MAF, LRT for SNP calling etc.
  7. Trimming out the ends of the reads
  8. etc

It follows that some filters will select a subset of data, and some of the filters will discard certain sites. If multiple filters has been chosen, the analysis will be limited to the chain of filters.

Filters for Bam files

We allow for filtering and manipulation a the read level. These filters include minimum mapping and base qualtity, paired reads and others. Additionally specific regions can be analysed. All of the filters for bam files are described in Input#BAM_files.

Selected Sites

For analysing specfic regions see Input#BAM_files. If you are interested in running your analysis at individual sites that are distributed throughout the entire genome, it might be faster to simply to loop over the entire data, but only analyse the data at specific positions. This can be done by supplying the -sites argument. With this approach we also allows for the forcing of major/minor alleles using external information.

Allele frequencies

-minMaf [float]
only work with sites with a maf above [float]

Requires -doMaf.

Polymorphic sites

-SNP_pval [float]
only work with sites with a p-value less than [float]

Requires -doMaf.

Number of non missing individuals

-minInd [int]
only work with sites with information from at least [int] individuals

Extra

-setMinDepth [int]

Discard site if total sequencing depth (all individuals added together) is below [int] Requires -doCounts

-setMaxDepth [int]

Discard site if total sequencing depth (all individuals added together) is above [int] -doCounts


-geno_minDeph

Only call genotypes if per sample genotypes are above this threshold

This requires -doCounts and -doGeno

-trim [int]

Removes the [int] bases in both 'ends' of the reads, mostly useful for ancient DNA.

Examples

First we do a run with no filters

./angsd  -doMaf 2 -doMajorMinor 1 -out TSK -bam bam.filelist -GL 1 -r 1:
...
head TSK.mafs 
chromo	position	major	minor	knownEM	nInd
1	13999919	A	C	0.000008	1
1	13999920	G	A	0.000008	1
1	13999921	G	A	0.000008	1
1	13999922	C	A	0.000008	1
1	13999923	A	C	0.000008	1
1	13999924	G	A	0.000008	1
1	13999925	G	A	0.000008	1
1	13999926	A	C	0.000008	1
1	13999927	G	A	0.000008	1

Now we do a filter with MAF cutoff of 1\%

../angsd0.3/angsd -doMaf 2 -doMajorMinor 1 -out TSK -bam bam.filelist -GL 1 -r 1: -minMaf 0.01
head TSK.mafs 
chromo	position	major	minor	knownEM	nInd
1	13999950	T	G	0.495291	2
1	14000019	G	T	0.047247	9
1	14000056	C	T	0.055851	10
1	14000127	G	T	0.060760	10
1	14000170	C	T	0.052388	9
1	14000176	G	A	0.047928	10
1	14000202	G	A	0.279722	9
1	14000262	C	T	0.058555	9
1	14000322	A	G	0.040471	8

Similar if we only want sites with information for atleast 5 samples

../angsd0.3/angsd -doMaf 2 -doMajorMinor 1 -out TSK -bam bam.filelist -GL 1 -r 1: -minKeepInd 5
head TSK.mafs 
chromo	position	major	minor	knownEM	nInd
1	13999971	T	A	0.000007	6
1	13999972	G	A	0.000007	6
1	13999973	C	A	0.000005	5
1	13999974	G	A	0.000006	6
1	13999975	C	A	0.000002	5
1	13999976	C	A	0.000004	7
1	13999977	A	C	0.000005	8
1	13999978	C	A	0.000005	8
1	13999979	T	A	0.000005	8

If we are interested in all sites with a p-value of 10^(-6) of being variable

../angsd0.3/angsd -doMaf 2 -doMajorMinor 1 -out TSK -bam bam.filelist -GL 1 -r 1: -SNP_pval 1e-6
head TSK.mafs 
chromo	position	major	minor	knownEM	pK-EM	nInd
1	14000202	G	A	0.279722	42.623150	9
1	14000873	G	A	0.212120	79.118476	10
1	14001018	T	C	0.333736	89.040311	8
1	14001867	A	G	0.200232	47.195423	10
1	14002422	A	T	0.167692	43.196259	9
1	14003581	C	T	0.207404	58.593208	9
1	14004623	T	C	0.219838	102.856433	10
1	14007493	A	G	0.453217	28.398647	9
1	14007558	C	T	0.395670	80.236777	7