Debian Codegraph @

docs/man/man3/manualpage.3

raw
1 .TH "manualpage" 3 "iVar" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 manualpage \- Manual
6 .PP
7
8 .SH "Available Commands"
9 .PP
10 Command Description trim Trim reads in aligned BAM variants Call variants from aligned BAM file filtervariants Filter variants across replicates or multiple samples aligned using the same reference consensus Call consensus from aligned BAM file getmasked Detect primer mismatches and get primer indices for the amplicon to be masked removereads Remove reads from trimmed BAM file version Show version information trimadapter (EXPERIMENTAL) Trim adapter sequences from reads
11 .PP
12 To view detailed usage for each command type \fRivar <command>\fP Note : Commands maked (EXPERIMENTAL) are still under active development\&.
13 .SH "Description of commands"
14 .PP
15 .SS "Trim primer sequences with iVar"
16 iVar uses primer positions supplied in a BED file to soft clip primer sequences from an aligned and sorted BAM file\&. Following this, the reads are trimmed based on a quality threshold(Default: 20)\&. To do the quality trimming, iVar uses a sliding window approach(Default: 4)\&. The windows slides from the 5' end to the 3' end and if at any point the average base quality in the window falls below the threshold, the remaining read is soft clipped\&. If after trimming, the length of the read is greater than the minimum length specified(Default: 30), the read is written to the new trimmed BAM file\&.
17 .PP
18 Please note that the strand is taken into account while doing the trimming so forward primers are trimmed only from forward strand and reverse primers are trimmed from reverse strand\&.
19 .PP
20 To sort and index an aligned BAM file (OPTIONAL, if index is not present iVar will create one), the following command can be used,
21 .PP
22 .PP
23 .nf
24 # Input file \- test\&.bam
25 samtools sort \-o test\&.sorted\&.bam test\&.bam && samtools index test\&.sorted\&.bam\&.
26 .fi
27 .PP
28 .PP
29 \fBNote\fP: All the trimming in iVar is done by soft-clipping reads in an aligned BAM file\&. This information is lost if reads are extracted in fastq or fasta format from the trimmed BAM file\&.
30 .PP
31 Command:
32 .PP
33 .nf
34 ivar trim
35
36 Usage: ivar trim \-i [<input\&.bam>] \-b <primers\&.bed> [\-p <prefix>] [\-m <min\-length>] [\-q <min\-quality>] [\-s <sliding\-window\-width>]
37
38 Input Options Description
39 \-i Sorted bam file, with aligned reads, to trim primers and quality\&. If not specified will read from standard in
40 \-b (Required) BED file with primer sequences and positions
41 \-f Primer pair information file containing left and right primer names for the same amplicon separated by a tab
42 If provided, reads will be filtered based on their overlap with amplicons prior to trimming
43 \-m Minimum length of read to retain after trimming (Default: 50% the average length of the first 1000 reads)
44 \-q Minimum quality threshold for sliding window to pass (Default: 20)
45 \-s Width of sliding window (Default: 4)
46 \-e Include reads with no primers\&. By default, reads with no primers are excluded
47 \-k Keep reads to allow for reanalysis: keep reads which would be dropped by
48 alignment length filter or primer requirements, but mark them QCFAIL
49
50 Output Options Description
51 \-p Prefix for the output BAM file\&. If none is specified the output will write to standard out\&.
52
53 .fi
54 .PP
55 .PP
56 Example Usage:
57 .PP
58 .nf
59 ivar trim \-b test_primers\&.bed \-p test\&.trimmed \-i test\&.bam \-q 15 \-m 50 \-s 4
60 samtools view \-h test\&.bam | ivar trim \-b test_primers\&.bed \-p test\&.trimmed
61
62 .fi
63 .PP
64 .PP
65 The command above will produce a trimmed BAM file test\&.trimmed\&.bam after trimming the aligned reads in test\&.bam using the primer positions specified in test_primers\&.bed and a minimum quality threshold of \fB15\fP, minimum read length of \fB50\fP and a sliding window of \fB4\fP\&.
66 .PP
67 Example Usage:
68 .PP
69 .nf
70 bwa mem \-t 32 reference\&.fa 1\&.fq 2\&.fq | ivar trim \-b test_primers\&.bed \-x 3 \-m 30 | samtools sort \- | samtools mpileup \-aa \-A \-Q 0 \-d 0 \- | ivar consensus \-p test_consensus \-m 10 \-n N \-t 0\&.5
71
72 .fi
73 .PP
74 .PP
75 The command above will allow you to go from alignment to consensus sequence in a single command using the bwa aligner\&.
76 .PP
77 Example BED file
78 .PP
79 .PP
80 .nf
81 Puerto 28 52 400_1_out_L 60 +
82 Puerto 482 504 400_1_out_R 60 \-
83 Puerto 359 381 400_2_out_L 60 +
84 Puerto 796 818 400_2_out_R 60 \-
85 Puerto 658 680 400_3_out_L* 60 +
86 Puerto 1054 1076 400_3_out_R* 60 \-
87 \&.
88 \&.
89 \&.
90 \&.
91 .fi
92 .PP
93 .SS "Call variants with iVar"
94 iVar uses the output of the \fRsamtools mpileup\fP command to call variants - single nucleotide variants(SNVs) and indels\&. In order to call variants correctly, the reference file used for alignment must be passed to iVar using the \fR-r\fP flag\&. The output of \fRsamtools pileup\fP is piped into \fRivar variants\fP to generate a \&.tsv file with the variants\&. There are two parameters that can be set for variant calling using iVar - minimum quality(Default: 20) and minimum frequency(Default: 0\&.03)\&. Minimum quality is the minimum quality for a base to be counted towards the ungapped depth to canculate iSNV frequency at a given position\&. For insertions, the quality metric is discarded and the mpileup depth is used directly\&. Minimum frequency is the minimum frequency required for a SNV or indel to be reported\&.
95 .PP
96 .SS "Amino acid translation of iSNVs"
97 .PP
98 iVar can identify codons and translate variants into amino acids using a GFF file in the \fRGFF3\fP format containing the required coding regions (CDS)\&. In absence of a GFF file, iVar will not perform the translation and 'NA' will be added to the output file in place of the reference and alternate codons and amino acids\&. The GFF file in the GFF3 format can be downloaded via ftp from NCBI RefSeq/Genbank\&. They are usually the files with the extension '\&.gff\&.gz'\&. For example, the GFF file for Zaire Ebolavirus can be found \fRhere\fP\&. More details on GFF3 files hosted by NCBI can be found in their ftp \fRFAQs\fP\&.
99 .PP
100 .SS "Account for RNA editing through polymerase slippage"
101 .PP
102 Some RNA viruses such as Ebola virus, might have polymerase slippage causing the insertion of a couple of nucleotides\&. More details can be found \fRhere\fP\&. iVar can account for this editing and identify the correct open reading frames\&. The user will have to specify two additional parameters, \fBEditPosition\fP: Position at which edit occurs and \fBEditSequence\fP: The sequence tht is inserted at the given positon, in the 'attributes' column of the GFF file to account for this\&. A test example is given below,
103 .PP
104 .PP
105 .nf
106 test Genbank CDS 2 292 \&. + \&. ID=id\-testedit1;Note=PinkFloyd;EditPosition=100;EditSequence=A
107 test Genbank CDS 2 292 \&. + \&. ID=id\-testedit2;Note=AnotherBrickInTheWall;EditPosition=102;EditSequence=AA
108 .fi
109 .PP
110 .PP
111 If a certain base is present in multiple CDSs, iVar will add a new row for each CDS frame and distinguish the rows by adding the ID (specified in attributes of GFF) of the GFF feature used for the translation\&. This is shown for position 42 in the example output below\&. There are two rows with two different GFF features: id-test3 and id-test4\&.
112 .PP
113 Command:
114 .PP
115 .nf
116 Usage: samtools mpileup \-aa \-A \-d 0 \-B \-Q 0 \-\-reference [<reference\-fasta] <input\&.bam> | ivar variants \-p <prefix> [\-q <min\-quality>] [\-t <min\-frequency\-threshold>] [\-m <minimum depth>] [\-r <reference\-fasta>] [\-g GFF file]
117
118 Note : samtools mpileup output must be piped into ivar variants
119
120 Input Options Description
121 \-q Minimum quality score threshold to count base (Default: 20)
122 \-t Minimum frequency threshold(0 \- 1) to call variants (Default: 0\&.03)
123 \-m Minimum read depth to call variants (Default: 0)
124 \-G Count gaps towards depth\&. By default, gaps are not counted
125 \-r Reference file used for alignment\&. This is used to translate the nucleotide sequences and identify intra host single nucleotide variants
126 \-g A GFF file in the GFF3 format can be supplied to specify coordinates of open reading frames (ORFs)\&. In absence of GFF file, amino acid translation will not be done\&.
127
128 Output Options Description
129 \-p (Required) Prefix for the output tsv variant file
130
131 .fi
132 .PP
133 .PP
134 Example Usage:
135 .PP
136 .nf
137 samtools mpileup \-aa \-A \-d 600000 \-B \-Q 0 test\&.trimmed\&.bam | ivar variants \-p test \-q 20 \-t 0\&.03 \-r test_reference\&.fa \-g test\&.gff
138
139 .fi
140 .PP
141 .PP
142 The command above will generate a test\&.tsv file\&.
143 .PP
144 Example of output \&.tsv file\&.
145 .PP
146 .PP
147 .nf
148 REGION POS REF ALT REF_DP REF_RV REF_QUAL ALT_DP ALT_RV ALT_QUAL ALT_FREQ TOTAL_DP PVAL PASS GFF_FEATURE REF_CODON REF_AA ALT_CODON ALT_AA
149 test 42 G T 0 0 0 1 0 49 1 1 1 FALSE id\-test3 AGG R ATG M
150 test 42 G T 0 0 0 1 0 49 1 1 1 FALSE id\-test4 CAG Q CAT H
151 test 320 A T 1 1 35 1 1 46 0\&.5 2 0\&.666667 FALSE NA NA NA NA NA
152 test 365 A T 0 0 0 1 1 27 1 1 1 FALSE NA NA NA NA NA
153 .fi
154 .PP
155 .PP
156 Description
157 .PP
158 Field Description REGION Region from BAM file POS Position on reference sequence REF Reference base ALT Alternate Base REF_DP Ungapped depth of reference base REF_RV Ungapped depth of reference base on reverse reads REF_QUAL Mean quality of reference base ALT_DP Ungapped depth of alternate base\&. ALT_RV Ungapped deapth of alternate base on reverse reads ALT_QUAL Mean quality of alternate base ALT_FREQ Frequency of alternate base TOTAL_DP Total depth at position PVAL p-value of fisher's exact test PASS Result of p-value <= 0\&.05 GFF_FEATURE ID of the GFF feature used for the translation REF_CODON Codong using the reference base REF_AA Amino acid translated from reference codon ALT_CODON Codon using the alternate base ALT_AA Amino acid translated from the alternate codon
159 .PP
160 \fBNote\fP: Please use the -B options with \fRsamtools mpileup\fP to call variants and generate consensus\&. When a reference sequence is supplied, the quality of the reference base is reduced to 0 (ASCII: !) in the mpileup output\&. Disabling BAQ with -B seems to fix this\&. This was tested in samtools 1\&.7 and 1\&.8\&.
161 .SS "Filter variants across replicates with iVar"
162 iVar can be used to get an intersection of variants(in \&.tsv files) called from any number of replicates or from different samples using the same reference sequence\&. This intersection will filter out any iSNVs that do not occur in a minimum fraction of the files supplied\&. This parameter can be changed using the \fR-t\fP flag which range from 0 to 1 (default)\&. Fields that are different across replicates(fields apart from REGION, POS, REF, ALT, REF_CODON, REF_AA, ALT_CODON, ALT_AA) will have the filename added as a suffix\&. If there are a large number of files to be filtered, the \fR-f\fP flag can be used to supply a text file with one sample/replicate variant \&.tsv file per line\&.
163 .PP
164 Command:
165 .PP
166 .nf
167 Usage: ivar filtervariants \-p <prefix> replicate\-one\&.tsv replicate\-two\&.tsv \&.\&.\&. OR ivar filtervariants \-p <prefix> \-f <text file with one variant file per line>
168 Input: Variant tsv files for each replicate/sample
169
170 Input Options Description
171 \-t Minimum fration of files required to contain the same variant\&. Specify value within [0,1]\&. (Default: 1)
172 \-f A text file with one variant file per line\&.
173
174 Output Options Description
175 \-p (Required) Prefix for the output filtered tsv file
176
177 .fi
178 .PP
179 .PP
180 Example Usage: The command below only retains those variants that are found in atleast 50% of the fiels supplied
181 .PP
182 .nf
183 ivar filtervariants \-t 0\&.5 \-p test\&.filtered test\&.1\&.tsv test\&.2\&.tsv test\&.3\&.tsv
184
185 .fi
186 .PP
187 .PP
188 The three replicates can also be supplied using a text file as shown below
189 .PP
190 .PP
191 .nf
192 ivar filtervariants \-t 0\&.5 \-p test\&.filtered \-f filter_files\&.txt
193 .fi
194 .PP
195 .PP
196 filter_files\&.txt
197 .PP
198 .nf
199 \&./path/to/test\&.1\&.tsv
200 \&./path/to/test\&.2\&.tsv
201 \&./path/to/test\&.3\&.tsv
202
203 .fi
204 .PP
205 .PP
206 The command above will prodoce an output \&.tsv file test\&.filtered\&.tsv\&.
207 .PP
208 Example output of filtered \&.tsv file from three files test_rep1\&.tsv and test_rep2\&.tsv
209 .PP
210 .PP
211 .nf
212 REGION POS REF ALT GFF_FEATURE REF_CODON REF_AA ALT_CODON ALT_AA REF_DP_test\&.1\&.tsv REF_RV_test\&.1\&.tsv REF_QUAL_test\&.1\&.tsv ALT_DP_test\&.1\&.tsv ALT_RV_test\&.1\&.tsv ALT_QUAL_test\&.1\&.tsv ALT_FREQ_test\&.1\&.tsv TOTAL_DP_test\&.1\&.tsv PVAL_test\&.1\&.tsv PASS_test\&.1\&.tsv REF_DP_test\&.2\&.tsv REF_RV_test\&.2\&.tsv REF_QUAL_test\&.2\&.tsv ALT_DP_test\&.2\&.tsv ALT_RV_test\&.2\&.tsv ALT_QUAL_test\&.2\&.tsv ALT_FREQ_test\&.2\&.tsv TOTAL_DP_test\&.2\&.tsv PVAL_test\&.2\&.tsv PASS_test\&.2\&.tsv REF_DP_test\&.3\&.tsv REF_RV_test\&.3\&.tsv REF_QUAL_test\&.3\&.tsv ALT_DP_test\&.3\&.tsv ALT_RV_test\&.3\&.tsv ALT_QUAL_test\&.3\&.tsv ALT_FREQ_test\&.3\&.tsv TOTAL_DP_test\&.3\&.tsv PVAL_test\&.3\&.tsv PASS_test\&.3\&.tsv
213 test 139 T A id\-test3 GCT A GCA A 1 0 32 1 0 55 0\&.5 2 0\&.666667 FALSE 1 0 32 1 0 55 0\&.5 2 0\&.666667 FALSE NA NA NA NA NA NA NA NA NA NA
214 test 320 A T NA NA NA NA NA 1 1 35 1 1 46 0\&.5 2 0\&.666667 FALSE NA NA NA NA NA NA NA NA NA NA 1 1 35 1 1 46 0\&.5 2 0\&.666667 FALSE
215 test 365 A T NA NA NA NA NA 0 0 0 1 1 27 1 1 1 FALSE 0 0 0 1 1 27 1 1 1 FALSE 0 0 0 1 1 27 1 1 1 FALSE
216 test 42 G T id\-test4 CAG Q CAT H 0 0 0 1 0 49 1 1 1 FALSE 0 0 0 1 0 49 1 1 1 FALSE NA NA NA NA NA NA NA NA NA NA
217 test 42 G T id\-testedit1 AGG R ATG M 0 0 0 1 0 49 1 1 1 FALSE 0 0 0 1 0 49 1 1 1 FALSE 0 0 0 1 0 49 1 1 1 FALSE
218 test 69 T G id\-testedit2 TTG L TGG W 1 0 57 1 0 53 0\&.5 2 0\&.666667 FALSE 1 0 57 1 0 53 0\&.5 2 0\&.666667 FALSE 1 0 57 1 0 53 0\&.5 2 0\&.666667 FALSE
219 .fi
220 .PP
221 .PP
222 Description of fields
223 .PP
224 No Field Description 1 REGION Common region across all replicate variant tsv files 2 POS Common position across all variant tsv files 3 REF Common reference base across all variant tsv files 4 ALT Common alternate base across all variant tsv files 5 GFF_FEATURE GFF feature used for the translation 6 REF_CODON The codon using the reference base 7 REF_AA Reference codon translated into amino acid 8 ALT_CODON Codon using the alternate base 9 ALT_AA Alternate codon translated into amino acid 10 REF_DP_<rep1-tsv-file-name> Depth of reference base in replicate 1 11 REF_RV_<rep1-tsv-file-name> Depth of reference base on reverse reads in replicate 1 12 REF_QUAL_<rep1-tsv-file-name> Mean quality of reference base in replicate 1 13 ALT_DP_<rep1-tsv-file-name> Depth of alternate base in replicate 1 14 ALT_RV_<rep1-tsv-file-name> Deapth of alternate base on reverse reads in replicate 1 15 ALT_QUAL_<rep1-tsv-file-name> Mean quality of alternate base in replicate 1 16 ALT_FREQ_<rep1-tsv-file-name> Frequency of alternate base in replicate 1 17 TOTAL_DP_<rep1-tsv-file-name> Total depth at position in replicate 1 18 PVAL_<rep1-tsv-file-name> p-value of fisher's exact test in replicate 1 19 PASS_<rep1-tsv-file-name> Result of p-value <= 0\&.05 in replicate 1 20 Continue rows 10 - 19 for every replicate provided
225 .SS "Generate a consensus sequences from an aligned BAM file"
226 To generate a consensus sequence iVar uses the output of \fRsamtools mpileup\fP command\&. The mpileup output must be piped into \fRivar consensus\fP\&. There are five parameters that can be set - minimum quality(Default: 20), minimum frequency threshold(Default: 0), minimum depth to call a consensus(Default: 10), a flag to exclude nucleotides from regions with depth less than the minimum depth and a character to call in regions with coverage lower than the speicifed minimum depth(Default: 'N')\&. Minimum quality is the minimum quality of a base to be considered in calculations of variant frequencies at a given position\&. Minimum frequency threshold is the minimum frequency that a base must match to be called as the consensus base at a position\&. If one base is not enough to match a given frequency, then an ambigious nucleotide is called at that position\&. Minimum depth is the minimum required depth to call a consensus\&. If '-k' flag is set then these regions are not included in the consensus sequence\&. If '-k' is not set then by default, a 'N' is called in these regions\&. You can also specfy which character you want to add to the consensus to cover regions with depth less than the minimum depth\&. This can be done using -n option\&. It takes one of two values: '-' or 'N'\&.
227 .PP
228 As an example, consider a position with 6As, 3Ts and 1C\&. The table below shows the consensus nucleotide called at different frequencies\&.
229 .PP
230 Minimum frequency threshold Consensus 0 A 0\&.5 A 0\&.6 A 0\&.7 W(A or T) 0\&.9 W (A or T) 1 H (A or T or C)
231 .PP
232 If there are two nucleotides at the same frequency, both nucleotides are used to call an ambigious base as the consensus\&. As an example, consider a position wiht 6 Ts, 2As and 2 Gs\&. The table below shows the consensus nucleotide called at different frequencies\&.
233 .PP
234 Minimum frequency threshold Consensus 0 T 0\&.5 T 0\&.6 T 0\&.7 D(A or T or G) 0\&.9 D(A or T or G) 1 D(A or T or G)
235 .PP
236 The output of the command is a fasta file with the consensus sequence and a \&.txt file with the average quality of every base used to generate the consensus at each position\&. \fIFor insertions, the quality is set to be the minimum quality threshold since mpileup doesn't give the quality of bases in insertions\&.\fP
237 .PP
238 Command:
239 .PP
240 .PP
241 .nf
242 ivar consensus
243
244 Usage: samtools mpileup \-aa \-A \-d 0 \-Q 0 <input\&.bam> | ivar consensus \-p <prefix>
245
246 Note : samtools mpileup output must be piped into ivar consensus
247
248 Input Options Description
249 \-q Minimum quality score threshold to count base (Default: 20)
250 \-t Minimum frequency threshold(0 \- 1) to call consensus\&. (Default: 0)
251 \-c Minimum insertion frequency threshold(0 \- 1) to call consensus\&. (Default: 0\&.8)
252 Frequently used thresholds | Description
253 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-|\-\-\-\-\-\-\-\-\-\-\-\-
254 0 | Majority or most common base
255 0\&.2 | Bases that make up atleast 20% of the depth at a position
256 0\&.5 | Strict or bases that make up atleast 50% of the depth at a position
257 0\&.9 | Strict or bases that make up atleast 90% of the depth at a position
258 1 | Identical or bases that make up 100% of the depth at a position\&. Will have highest ambiguities
259 \-m Minimum depth to call consensus(Default: 10)
260 \-k If '\-k' flag is added, regions with depth less than minimum depth will not be added to the consensus sequence\&. Using '\-k' will override any option specified using \-n
261 \-n (N/\-) Character to print in regions with less than minimum coverage(Default: N)
262
263 Output Options Description
264 \-p (Required) Prefix for the output fasta file and quality file
265 .fi
266 .PP
267 .PP
268 Example Usage:
269 .PP
270 .nf
271 samtools mpileup \-d 1000 \-A \-Q 0 test\&.bam | ivar consensus \-p test \-q 20 \-t 0
272
273 .fi
274 .PP
275 .PP
276 The command above will produce a test\&.fa fasta file with the consensus sequence and a test\&.qual\&.txt with the average quality of each base in the consensus sequence\&.
277 .SS "Get primers with mismatches to the reference sequence"
278 iVar uses a \&.tsv file with variants to get the zero based indices(based on the BED file) of mismatched primers\&. This command requires another \&.tsv file with each line containing the left and right primer names separated by a tab\&. This is used to get both the primers for an amplicon with a single mismatched primer\&. The output is a text file with the zero based primer indices delimited by a space\&. The output is written to a a text file using the prefix provided\&.
279 .PP
280 Command:
281 .PP
282 .nf
283 ivar getmasked
284 Usage: ivar getmasked \-i <input\-filtered\&.tsv> \-b <primers\&.bed> \-f <primer_pairs\&.tsv> \-p <prefix>
285 Note: This step is used only for amplicon\-based sequencing\&.
286
287 Input Options Description
288 \-i (Required) Input filtered variants tsv generated from 'ivar filtervariants'
289 \-b (Required) BED file with primer sequences and positions
290 \-f (Required) Primer pair information file containing left and right primer names for the same amplicon separated by a tab
291 Output Options Description
292 \-p (Required) Prefix for the output text file
293
294 .fi
295 .PP
296 .PP
297 Example BED file
298 .PP
299 .PP
300 .nf
301 Puerto 28 52 400_1_out_L 60 +
302 Puerto 482 504 400_1_out_R 60 \-
303 Puerto 359 381 400_2_out_L 60 +
304 Puerto 796 818 400_2_out_R 60 \-
305 Puerto 658 680 400_3_out_L* 60 +
306 Puerto 1054 1076 400_3_out_R* 60 \-
307 \&.
308 \&.
309 \&.
310 \&.
311 .fi
312 .PP
313 .PP
314 Example primer pair information file
315 .PP
316 .nf
317 400_1_out_L 400_1_out_R
318 400_2_out_L 400_2_out_R
319 400_3_out_L 400_3_out_R
320 \&.
321 \&.
322 \&.
323 \&.
324
325 .fi
326 .PP
327 .PP
328 Example Usage:
329 .PP
330 .nf
331 ivar getmasked \-i test\&.filtered\&.tsv \-b primers\&.bed \-f pair_information\&.tsv \-p test\&.masked\&.txt
332
333 .fi
334 .PP
335 .PP
336 The command above produces an output file - test\&.masked\&.txt\&.
337 .PP
338 Example Output:
339 .PP
340 .PP
341 .nf
342 1 2 7 8
343 .fi
344 .PP
345 .SS "Remove reads associated with mismatched primer indices"
346 This command accepts an aligned and sorted BAM file trimmed using \fRivar trim\fP and removes the reads corresponding to the supplied primer indices, which is the output of \fRivar getmasked\fP command\&. Under the hood, \fRivar trim\fP adds the zero based primer index(based on the BED file) to the BAM auxillary data for every read\&. Hence, ivar removereads will only work on BAM files that have been trimmed using \fRivar trim\fP\&.
347 .PP
348 Command:
349 .PP
350 .nf
351 ivar removereads
352
353 Usage: ivar removereads \-i <input\&.trimmed\&.bam> \-p <prefix> \-t <text\-file\-with\-primer\-indices>
354 Note: This step is used only for amplicon\-based sequencing\&.
355
356 Input Options Description
357 \-i (Required) Input BAM file trimmed with ivar trim\&. Must be sorted and indexed, which can be done using sort_index_bam\&.sh
358 \-t (Required) Text file with primer indices separated by spaces\&. This is the output of getmasked command\&.
359
360 Output Options Description
361 \-p (Required) Prefix for the output filtered BAM file
362
363 .fi
364 .PP
365 .PP
366 Example Usage:
367 .PP
368 .nf
369 ivar trim \-i test\&.bam \-p test\&.trimmed
370 ivar removereads \-i test\&.trimmed\&.bam \-p test\&.trimmed\&.masked\&.bam \-t test\&.masked\&.txt
371
372 .fi
373 .PP
374 .PP
375 The \fRivar trim\fP command above trims test\&.bam and produced test\&.trimmed\&.bam with the primer indice data added\&. The \fRivar removereads\fP command produces an output file - test\&.trimmed\&.masked\&.bam after removing all the reads corresponding to primer indices - 1,2,7 and 8\&.
376 .SS "(Experimental) trimadapter"
377 \fBNote: This feature is under active development and not completely validated yet\&.\fP
378 .PP
379 trimadapter in iVar can be used to trim adapter sequences from fastq files using a supplied fasta file\&.