Debian Codegraph @

docs/latex/manualpage.tex

raw
1 \chapter{Manual}
2 \hypertarget{manualpage}{}\label{manualpage}\index{Manual@{Manual}}
3 \label{manualpage_md_docs_2_m_a_n_u_a_l}%
4 \Hypertarget{manualpage_md_docs_2_m_a_n_u_a_l}%
5 \hypertarget{manualpage_autotoc_md14}{}\doxysection{\texorpdfstring{Available Commands}{Available Commands}}\label{manualpage_autotoc_md14}
6 \tabulinesep=1mm
7 \begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
8 \hline
9 \cellcolor{\tableheadbgcolor}\textbf{ Command }&\cellcolor{\tableheadbgcolor}\textbf{ Description }\\\cline{1-2}
10 \endfirsthead
11 \hline
12 \endfoot
13 \hline
14 \cellcolor{\tableheadbgcolor}\textbf{ Command }&\cellcolor{\tableheadbgcolor}\textbf{ Description }\\\cline{1-2}
15 \endhead
16 trim &Trim reads in aligned BAM \\\cline{1-2}
17 variants &Call variants from aligned BAM file \\\cline{1-2}
18 filtervariants &Filter variants across replicates or multiple samples aligned using the same reference \\\cline{1-2}
19 consensus &Call consensus from aligned BAM file \\\cline{1-2}
20 getmasked &Detect primer mismatches and get primer indices for the amplicon to be masked \\\cline{1-2}
21 removereads &Remove reads from trimmed BAM file \\\cline{1-2}
22 version &Show version information \\\cline{1-2}
23 trimadapter &(EXPERIMENTAL) Trim adapter sequences from reads \\\cline{1-2}
24 \end{longtabu}
25
26
27 To view detailed usage for each command type {\ttfamily ivar \texorpdfstring{$<$}{<}command\texorpdfstring{$>$}{>}} Note \+: Commands maked (EXPERIMENTAL) are still under active development.\hypertarget{manualpage_autotoc_md15}{}\doxysection{\texorpdfstring{Description of commands}{Description of commands}}\label{manualpage_autotoc_md15}
28 \hypertarget{manualpage_autotoc_md16}{}\doxysubsection{\texorpdfstring{Trim primer sequences with i\+Var}{Trim primer sequences with i\+Var}}\label{manualpage_autotoc_md16}
29 i\+Var 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, i\+Var uses a sliding window approach(\+Default\+: 4). The windows slides from the 5\textquotesingle{} end to the 3\textquotesingle{} 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.
30
31 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.
32
33 To sort and index an aligned BAM file (OPTIONAL, if index is not present i\+Var will create one), the following command can be used,
34
35
36 \begin{DoxyCode}{0}
37 \DoxyCodeLine{\#\ Input\ file\ -\/\ test.bam}
38 \DoxyCodeLine{samtools\ sort\ -\/o\ test.sorted.bam\ test.bam\ \&\&\ samtools\ index\ test.sorted.bam.}
39
40 \end{DoxyCode}
41
42
43 {\bfseries{Note}}\+: All the trimming in i\+Var 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.
44
45 Command\+:
46 \begin{DoxyCode}{0}
47 \DoxyCodeLine{ivar\ trim}
48 \DoxyCodeLine{}
49 \DoxyCodeLine{Usage:\ ivar\ trim\ -\/i\ [<input.bam>]\ -\/b\ <primers.bed>\ [-\/p\ <prefix>]\ [-\/m\ <min-\/length>]\ [-\/q\ <min-\/quality>]\ [-\/s\ <sliding-\/window-\/width>]}
50 \DoxyCodeLine{}
51 \DoxyCodeLine{Input\ Options\ \ \ \ Description}
52 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/i\ \ \ \ Sorted\ bam\ file,\ with\ aligned\ reads,\ to\ trim\ primers\ and\ quality.\ If\ not\ specified\ will\ read\ from\ standard\ in}
53 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/b\ \ \ \ (Required)\ BED\ file\ with\ primer\ sequences\ and\ positions}
54 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/f\ \ \ \ Primer\ pair\ information\ file\ containing\ left\ and\ right\ primer\ names\ for\ the\ same\ amplicon\ separated\ by\ a\ tab}
55 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ If\ provided,\ reads\ will\ be\ filtered\ based\ on\ their\ overlap\ with\ amplicons\ prior\ to\ trimming}
56 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/m\ \ \ \ Minimum\ length\ of\ read\ to\ retain\ after\ trimming\ (Default:\ 50\%\ the\ average\ length\ of\ the\ first\ 1000\ reads)}
57 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/q\ \ \ \ Minimum\ quality\ threshold\ for\ sliding\ window\ to\ pass\ (Default:\ 20)}
58 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/s\ \ \ \ Width\ of\ sliding\ window\ (Default:\ 4)}
59 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/e\ \ \ \ Include\ reads\ with\ no\ primers.\ By\ default,\ reads\ with\ no\ primers\ are\ excluded}
60 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/k\ \ \ \ Keep\ reads\ to\ allow\ for\ reanalysis:\ keep\ reads\ which\ would\ be\ dropped\ by}
61 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ alignment\ length\ filter\ or\ primer\ requirements,\ but\ mark\ them\ QCFAIL}
62 \DoxyCodeLine{}
63 \DoxyCodeLine{Output\ Options\ \ \ Description}
64 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/p\ \ \ \ Prefix\ for\ the\ output\ BAM\ file.\ If\ none\ is\ specified\ the\ output\ will\ write\ to\ standard\ out.}
65
66 \end{DoxyCode}
67
68
69 Example Usage\+:
70 \begin{DoxyCode}{0}
71 \DoxyCodeLine{ivar\ trim\ -\/b\ test\_primers.bed\ -\/p\ test.trimmed\ -\/i\ test.bam\ -\/q\ 15\ -\/m\ 50\ -\/s\ 4}
72 \DoxyCodeLine{samtools\ view\ -\/h\ test.bam\ |\ ivar\ trim\ -\/b\ test\_primers.bed\ -\/p\ test.trimmed\ }
73
74 \end{DoxyCode}
75
76
77 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 {\bfseries{15}}, minimum read length of {\bfseries{50}} and a sliding window of {\bfseries{4}}.
78
79 Example Usage\+:
80 \begin{DoxyCode}{0}
81 \DoxyCodeLine{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}
82
83 \end{DoxyCode}
84
85
86 The command above will allow you to go from alignment to consensus sequence in a single command using the bwa aligner.
87
88 Example BED file
89
90
91 \begin{DoxyCode}{0}
92 \DoxyCodeLine{Puerto\ \ 28\ \ 52\ \ 400\_1\_out\_L\ 60\ \ +}
93 \DoxyCodeLine{Puerto\ \ 482\ 504\ 400\_1\_out\_R\ 60\ \ -\/}
94 \DoxyCodeLine{Puerto\ \ 359\ 381\ 400\_2\_out\_L\ 60\ \ +}
95 \DoxyCodeLine{Puerto\ \ 796\ 818\ 400\_2\_out\_R\ 60\ \ -\/}
96 \DoxyCodeLine{Puerto\ \ 658\ 680\ 400\_3\_out\_L*\ \ \ \ 60\ \ +}
97 \DoxyCodeLine{Puerto\ \ 1054\ \ \ \ 1076\ \ \ \ 400\_3\_out\_R*\ \ \ \ 60\ \ -\/}
98 \DoxyCodeLine{.}
99 \DoxyCodeLine{.}
100 \DoxyCodeLine{.}
101 \DoxyCodeLine{.}
102
103 \end{DoxyCode}
104 \hypertarget{manualpage_autotoc_md17}{}\doxysubsection{\texorpdfstring{Call variants with i\+Var}{Call variants with i\+Var}}\label{manualpage_autotoc_md17}
105 i\+Var uses the output of the {\ttfamily samtools mpileup} 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 i\+Var using the {\ttfamily -\/r} flag. The output of {\ttfamily samtools pileup} is piped into {\ttfamily ivar variants} to generate a .tsv file with the variants. There are two parameters that can be set for variant calling using i\+Var -\/ 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 i\+SNV 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.
106
107 \doxyparagraph*{Amino acid translation of i\+SNVs}
108
109 i\+Var can identify codons and translate variants into amino acids using a GFF file in the \href{https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md}{\texttt{ GFF3}} format containing the required coding regions (CDS). In absence of a GFF file, i\+Var 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 Ref\+Seq/\+Genbank. They are usually the files with the extension "{}.\+gff.\+gz"{}. For example, the GFF file for Zaire Ebolavirus can be found \href{ftp://ftp.ncbi.nlm.nih.gov/genomes/refseq/viral/Zaire_ebolavirus/all_assembly_versions/GCF_000848505.1_ViralProj14703}{\texttt{ here}}. More details on GFF3 files hosted by NCBI can be found in their ftp \href{https://www.ncbi.nlm.nih.gov/genome/doc/ftpfaq/}{\texttt{ FAQs}}.
110
111 \doxyparagraph*{Account for RNA editing through polymerase slippage}
112
113 Some RNA viruses such as Ebola virus, might have polymerase slippage causing the insertion of a couple of nucleotides. More details can be found \href{https://viralzone.expasy.org/857?outline=all_by_protein}{\texttt{ here}}. i\+Var can account for this editing and identify the correct open reading frames. The user will have to specify two additional parameters, {\bfseries{Edit\+Position}}\+: Position at which edit occurs and {\bfseries{Edit\+Sequence}}\+: 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,
114
115
116 \begin{DoxyCode}{0}
117 \DoxyCodeLine{test\ \ \ \ Genbank\ CDS\ 2\ \ \ 292\ .\ \ \ +\ \ \ .\ \ \ ID=id-\/testedit1;Note=PinkFloyd;EditPosition=100;EditSequence=A}
118 \DoxyCodeLine{test\ \ \ \ Genbank\ CDS\ 2\ \ \ 292\ .\ \ \ +\ \ \ .\ \ \ ID=id-\/testedit2;Note=AnotherBrickInTheWall;EditPosition=102;EditSequence=AA}
119
120 \end{DoxyCode}
121
122
123 If a certain base is present in multiple CDSs, i\+Var 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.
124
125 Command\+:
126 \begin{DoxyCode}{0}
127 \DoxyCodeLine{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]}
128 \DoxyCodeLine{}
129 \DoxyCodeLine{Note\ :\ samtools\ mpileup\ output\ must\ be\ piped\ into\ ivar\ variants}
130 \DoxyCodeLine{}
131 \DoxyCodeLine{Input\ Options\ \ \ \ Description}
132 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/q\ \ \ \ Minimum\ quality\ score\ threshold\ to\ count\ base\ (Default:\ 20)}
133 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/t\ \ \ \ Minimum\ frequency\ threshold(0\ -\/\ 1)\ to\ call\ variants\ (Default:\ 0.03)}
134 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/m\ \ \ \ Minimum\ read\ depth\ to\ call\ variants\ (Default:\ 0)}
135 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/G\ \ \ \ Count\ gaps\ towards\ depth.\ By\ default,\ gaps\ are\ not\ counted\ \ \ \ \ \ \ \ \ \ \ }
136 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/r\ \ \ \ Reference\ file\ used\ for\ alignment.\ This\ is\ used\ to\ translate\ the\ nucleotide\ sequences\ and\ identify\ intra\ host\ single\ nucleotide\ variants}
137 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/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.}
138 \DoxyCodeLine{}
139 \DoxyCodeLine{Output\ Options\ \ \ Description}
140 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/p\ \ \ \ (Required)\ Prefix\ for\ the\ output\ tsv\ variant\ file}
141
142 \end{DoxyCode}
143
144
145 Example Usage\+:
146 \begin{DoxyCode}{0}
147 \DoxyCodeLine{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}
148
149 \end{DoxyCode}
150
151
152 The command above will generate a test.\+tsv file.
153
154 Example of output .tsv file.
155
156
157 \begin{DoxyCode}{0}
158 \DoxyCodeLine{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}
159 \DoxyCodeLine{test\ \ \ \ 42\ \ G\ \ \ T\ \ \ 0\ \ \ 0\ \ \ 0\ \ \ 1\ \ \ 0\ \ \ 49\ \ 1\ \ \ 1\ \ \ 1\ \ \ FALSE\ \ \ id-\/test3\ \ \ \ AGG\ R\ \ \ ATG\ M}
160 \DoxyCodeLine{test\ \ \ \ 42\ \ G\ \ \ T\ \ \ 0\ \ \ 0\ \ \ 0\ \ \ 1\ \ \ 0\ \ \ 49\ \ 1\ \ \ 1\ \ \ 1\ \ \ FALSE\ \ \ id-\/test4\ \ \ \ CAG\ Q\ \ \ CAT\ H}
161 \DoxyCodeLine{test\ \ \ \ 320\ A\ \ \ T\ \ \ 1\ \ \ 1\ \ \ 35\ \ 1\ \ \ 1\ \ \ 46\ \ 0.5\ 2\ \ \ 0.666667\ \ \ \ FALSE\ \ \ NA\ \ NA\ \ NA\ \ NA\ \ NA}
162 \DoxyCodeLine{test\ \ \ \ 365\ A\ \ \ T\ \ \ 0\ \ \ 0\ \ \ 0\ \ \ 1\ \ \ 1\ \ \ 27\ \ 1\ \ \ 1\ \ \ 1\ \ \ FALSE\ \ \ NA\ \ NA\ \ NA\ \ NA\ \ NA}
163
164 \end{DoxyCode}
165
166
167 Description
168
169 \tabulinesep=1mm
170 \begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
171 \hline
172 \cellcolor{\tableheadbgcolor}\textbf{ Field }&\cellcolor{\tableheadbgcolor}\textbf{ Description }\\\cline{1-2}
173 \endfirsthead
174 \hline
175 \endfoot
176 \hline
177 \cellcolor{\tableheadbgcolor}\textbf{ Field }&\cellcolor{\tableheadbgcolor}\textbf{ Description }\\\cline{1-2}
178 \endhead
179 REGION &Region from BAM file \\\cline{1-2}
180 POS &Position on reference sequence \\\cline{1-2}
181 REF &Reference base \\\cline{1-2}
182 ALT &Alternate Base \\\cline{1-2}
183 REF\+\_\+\+DP &Ungapped depth of reference base \\\cline{1-2}
184 REF\+\_\+\+RV &Ungapped depth of reference base on reverse reads \\\cline{1-2}
185 REF\+\_\+\+QUAL &Mean quality of reference base \\\cline{1-2}
186 ALT\+\_\+\+DP &Ungapped depth of alternate base. \\\cline{1-2}
187 ALT\+\_\+\+RV &Ungapped deapth of alternate base on reverse reads \\\cline{1-2}
188 ALT\+\_\+\+QUAL &Mean quality of alternate base \\\cline{1-2}
189 ALT\+\_\+\+FREQ &Frequency of alternate base \\\cline{1-2}
190 TOTAL\+\_\+\+DP &Total depth at position \\\cline{1-2}
191 PVAL &p-\/value of fisher\textquotesingle{}s exact test \\\cline{1-2}
192 PASS &Result of p-\/value \texorpdfstring{$<$}{<}= 0.\+05 \\\cline{1-2}
193 GFF\+\_\+\+FEATURE &ID of the GFF feature used for the translation \\\cline{1-2}
194 REF\+\_\+\+CODON &Codong using the reference base \\\cline{1-2}
195 REF\+\_\+\+AA &Amino acid translated from reference codon \\\cline{1-2}
196 ALT\+\_\+\+CODON &Codon using the alternate base \\\cline{1-2}
197 ALT\+\_\+\+AA &Amino acid translated from the alternate codon \\\cline{1-2}
198 \end{longtabu}
199
200
201 {\bfseries{Note}}\+: Please use the -\/B options with {\ttfamily samtools mpileup} 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.\hypertarget{manualpage_autotoc_md18}{}\doxysubsection{\texorpdfstring{Filter variants across replicates with i\+Var}{Filter variants across replicates with i\+Var}}\label{manualpage_autotoc_md18}
202 i\+Var 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 i\+SNVs that do not occur in a minimum fraction of the files supplied. This parameter can be changed using the {\ttfamily -\/t} 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 {\ttfamily -\/f} flag can be used to supply a text file with one sample/replicate variant .tsv file per line.
203
204 Command\+:
205 \begin{DoxyCode}{0}
206 \DoxyCodeLine{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>\ }
207 \DoxyCodeLine{Input:\ Variant\ tsv\ files\ for\ each\ replicate/sample}
208 \DoxyCodeLine{}
209 \DoxyCodeLine{Input\ Options\ \ \ \ Description}
210 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/t\ \ \ \ Minimum\ fration\ of\ files\ required\ to\ contain\ the\ same\ variant.\ Specify\ value\ within\ [0,1].\ (Default:\ 1)}
211 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/f\ \ \ \ A\ text\ file\ with\ one\ variant\ file\ per\ line.}
212 \DoxyCodeLine{}
213 \DoxyCodeLine{Output\ Options\ \ \ Description}
214 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/p\ \ \ \ (Required)\ Prefix\ for\ the\ output\ filtered\ tsv\ file}
215
216 \end{DoxyCode}
217
218
219 Example Usage\+: The command below only retains those variants that are found in atleast 50\% of the fiels supplied
220 \begin{DoxyCode}{0}
221 \DoxyCodeLine{ivar\ filtervariants\ -\/t\ 0.5\ -\/p\ test.filtered\ test.1.tsv\ test.2.tsv\ test.3.tsv}
222
223 \end{DoxyCode}
224
225
226 The three replicates can also be supplied using a text file as shown below
227
228
229 \begin{DoxyCode}{0}
230 \DoxyCodeLine{ivar\ filtervariants\ -\/t\ 0.5\ -\/p\ test.filtered\ -\/f\ filter\_files.txt}
231
232 \end{DoxyCode}
233
234
235 filter\+\_\+files.\+txt
236 \begin{DoxyCode}{0}
237 \DoxyCodeLine{./path/to/test.1.tsv}
238 \DoxyCodeLine{./path/to/test.2.tsv}
239 \DoxyCodeLine{./path/to/test.3.tsv}
240
241 \end{DoxyCode}
242
243
244 The command above will prodoce an output .tsv file test.\+filtered.\+tsv.
245
246 Example output of filtered .tsv file from three files test\+\_\+rep1.\+tsv and test\+\_\+rep2.\+tsv
247
248
249 \begin{DoxyCode}{0}
250 \DoxyCodeLine{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\ }
251 \DoxyCodeLine{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}
252 \DoxyCodeLine{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}
253 \DoxyCodeLine{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}
254 \DoxyCodeLine{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}
255 \DoxyCodeLine{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}
256 \DoxyCodeLine{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}
257
258 \end{DoxyCode}
259
260
261 Description of fields
262
263 \tabulinesep=1mm
264 \begin{longtabu}spread 0pt [c]{*{3}{|X[-1]}|}
265 \hline
266 \cellcolor{\tableheadbgcolor}\textbf{ No }&\cellcolor{\tableheadbgcolor}\textbf{ Field }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Description }\\\cline{1-3}
267 \endfirsthead
268 \hline
269 \endfoot
270 \hline
271 \cellcolor{\tableheadbgcolor}\textbf{ No }&\cellcolor{\tableheadbgcolor}\textbf{ Field }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Description }\\\cline{1-3}
272 \endhead
273 1 &REGION &Common region across all replicate variant tsv files \\\cline{1-3}
274 2 &POS &Common position across all variant tsv files \\\cline{1-3}
275 3 &REF &Common reference base across all variant tsv files \\\cline{1-3}
276 4 &ALT &Common alternate base across all variant tsv files \\\cline{1-3}
277 5 &GFF\+\_\+\+FEATURE &GFF feature used for the translation \\\cline{1-3}
278 6 &REF\+\_\+\+CODON &The codon using the reference base \\\cline{1-3}
279 7 &REF\+\_\+\+AA &Reference codon translated into amino acid \\\cline{1-3}
280 8 &ALT\+\_\+\+CODON &Codon using the alternate base \\\cline{1-3}
281 9 &ALT\+\_\+\+AA &Alternate codon translated into amino acid \\\cline{1-3}
282 10 &REF\+\_\+\+DP\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &Depth of reference base in replicate 1 \\\cline{1-3}
283 11 &REF\+\_\+\+RV\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &Depth of reference base on reverse reads in replicate 1 \\\cline{1-3}
284 12 &REF\+\_\+\+QUAL\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &Mean quality of reference base in replicate 1 \\\cline{1-3}
285 13 &ALT\+\_\+\+DP\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &Depth of alternate base in replicate 1 \\\cline{1-3}
286 14 &ALT\+\_\+\+RV\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &Deapth of alternate base on reverse reads in replicate 1 \\\cline{1-3}
287 15 &ALT\+\_\+\+QUAL\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &Mean quality of alternate base in replicate 1 \\\cline{1-3}
288 16 &ALT\+\_\+\+FREQ\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &Frequency of alternate base in replicate 1 \\\cline{1-3}
289 17 &TOTAL\+\_\+\+DP\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &Total depth at position in replicate 1 \\\cline{1-3}
290 18 &PVAL\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &p-\/value of fisher\textquotesingle{}s exact test in replicate 1 \\\cline{1-3}
291 19 &PASS\+\_\+\texorpdfstring{$<$}{<}rep1-\/tsv-\/file-\/name\texorpdfstring{$>$}{>} &Result of p-\/value \texorpdfstring{$<$}{<}= 0.\+05 in replicate 1 \\\cline{1-3}
292 20 &Continue rows 10 -\/ 19 for every replicate provided &\\\cline{1-3}
293 \end{longtabu}
294 \hypertarget{manualpage_autotoc_md19}{}\doxysubsection{\texorpdfstring{Generate a consensus sequences from an aligned BAM file}{Generate a consensus sequences from an aligned BAM file}}\label{manualpage_autotoc_md19}
295 To generate a consensus sequence i\+Var uses the output of {\ttfamily samtools mpileup} command. The mpileup output must be piped into {\ttfamily ivar consensus}. 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\+: \textquotesingle{}N\textquotesingle{}). 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 \textquotesingle{}-\/k\textquotesingle{} flag is set then these regions are not included in the consensus sequence. If \textquotesingle{}-\/k\textquotesingle{} is not set then by default, a \textquotesingle{}N\textquotesingle{} 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\+: \textquotesingle{}-\/\textquotesingle{} or \textquotesingle{}N\textquotesingle{}.
296
297 As an example, consider a position with 6As, 3Ts and 1C. The table below shows the consensus nucleotide called at different frequencies.
298
299 \tabulinesep=1mm
300 \begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
301 \hline
302 \cellcolor{\tableheadbgcolor}\textbf{ Minimum frequency threshold }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Consensus }\\\cline{1-2}
303 \endfirsthead
304 \hline
305 \endfoot
306 \hline
307 \cellcolor{\tableheadbgcolor}\textbf{ Minimum frequency threshold }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Consensus }\\\cline{1-2}
308 \endhead
309 0 &A \\\cline{1-2}
310 0.\+5 &A \\\cline{1-2}
311 0.\+6 &A \\\cline{1-2}
312 0.\+7 &W(\+A or T) \\\cline{1-2}
313 0.\+9 &W (A or T) \\\cline{1-2}
314 1 &H (A or T or C) \\\cline{1-2}
315 \end{longtabu}
316
317
318 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.
319
320 \tabulinesep=1mm
321 \begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
322 \hline
323 \cellcolor{\tableheadbgcolor}\textbf{ Minimum frequency threshold }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Consensus }\\\cline{1-2}
324 \endfirsthead
325 \hline
326 \endfoot
327 \hline
328 \cellcolor{\tableheadbgcolor}\textbf{ Minimum frequency threshold }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Consensus }\\\cline{1-2}
329 \endhead
330 0 &T \\\cline{1-2}
331 0.\+5 &T \\\cline{1-2}
332 0.\+6 &T \\\cline{1-2}
333 0.\+7 &D(\+A or T or G) \\\cline{1-2}
334 0.\+9 &D(\+A or T or G) \\\cline{1-2}
335 1 &D(\+A or T or G) \\\cline{1-2}
336 \end{longtabu}
337
338
339 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. {\itshape For insertions, the quality is set to be the minimum quality threshold since mpileup doesn\textquotesingle{}t give the quality of bases in insertions.}
340
341 Command\+:
342
343
344 \begin{DoxyCode}{0}
345 \DoxyCodeLine{ivar\ consensus}
346 \DoxyCodeLine{}
347 \DoxyCodeLine{Usage:\ samtools\ mpileup\ -\/aa\ -\/A\ -\/d\ 0\ -\/Q\ 0\ <input.bam>\ |\ ivar\ consensus\ -\/p\ <prefix>\ }
348 \DoxyCodeLine{}
349 \DoxyCodeLine{Note\ :\ samtools\ mpileup\ output\ must\ be\ piped\ into\ ivar\ consensus}
350 \DoxyCodeLine{}
351 \DoxyCodeLine{Input\ Options\ \ \ \ Description}
352 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/q\ \ \ \ Minimum\ quality\ score\ threshold\ to\ count\ base\ (Default:\ 20)}
353 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/t\ \ \ \ Minimum\ frequency\ threshold(0\ -\/\ 1)\ to\ call\ consensus.\ (Default:\ 0)}
354 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/c\ \ \ \ Minimum\ insertion\ frequency\ threshold(0\ -\/\ 1)\ to\ call\ consensus.\ (Default:\ 0.8)}
355 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Frequently\ used\ thresholds\ |\ Description}
356 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/|-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
357 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ |\ Majority\ or\ most\ common\ base}
358 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0.2\ |\ Bases\ that\ make\ up\ atleast\ 20\%\ of\ the\ depth\ at\ a\ position}
359 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0.5\ |\ Strict\ or\ bases\ that\ make\ up\ atleast\ 50\%\ of\ the\ depth\ at\ a\ position}
360 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0.9\ |\ Strict\ or\ bases\ that\ make\ up\ atleast\ 90\%\ of\ the\ depth\ at\ a\ position}
361 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 1\ |\ Identical\ or\ bases\ that\ make\ up\ 100\%\ of\ the\ depth\ at\ a\ position.\ Will\ have\ highest\ ambiguities}
362 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/m\ \ \ \ Minimum\ depth\ to\ call\ consensus(Default:\ 10)}
363 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/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\ }
364 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/n\ \ \ \ (N/-\/)\ Character\ to\ print\ in\ regions\ with\ less\ than\ minimum\ coverage(Default:\ N)}
365 \DoxyCodeLine{}
366 \DoxyCodeLine{Output\ Options\ \ \ Description}
367 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/p\ \ \ \ (Required)\ Prefix\ for\ the\ output\ fasta\ file\ and\ quality\ file}
368
369 \end{DoxyCode}
370
371
372 Example Usage\+:
373 \begin{DoxyCode}{0}
374 \DoxyCodeLine{samtools\ mpileup\ -\/d\ 1000\ -\/A\ -\/Q\ 0\ test.bam\ |\ ivar\ consensus\ -\/p\ test\ -\/q\ 20\ -\/t\ 0}
375
376 \end{DoxyCode}
377
378
379 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.\hypertarget{manualpage_autotoc_md20}{}\doxysubsection{\texorpdfstring{Get primers with mismatches to the reference sequence}{Get primers with mismatches to the reference sequence}}\label{manualpage_autotoc_md20}
380 i\+Var 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.
381
382 Command\+:
383 \begin{DoxyCode}{0}
384 \DoxyCodeLine{ivar\ getmasked}
385 \DoxyCodeLine{Usage:\ ivar\ getmasked\ -\/i\ <input-\/filtered.tsv>\ -\/b\ <primers.bed>\ -\/f\ <primer\_pairs.tsv>\ -\/p\ <prefix>}
386 \DoxyCodeLine{Note:\ This\ step\ is\ used\ only\ for\ amplicon-\/based\ sequencing.}
387 \DoxyCodeLine{}
388 \DoxyCodeLine{Input\ Options\ \ \ \ Description}
389 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/i\ \ \ \ (Required)\ Input\ filtered\ variants\ tsv\ generated\ from\ 'ivar\ filtervariants'}
390 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/b\ \ \ \ (Required)\ BED\ file\ with\ primer\ sequences\ and\ positions}
391 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/f\ \ \ \ (Required)\ Primer\ pair\ information\ file\ containing\ left\ and\ right\ primer\ names\ for\ the\ same\ amplicon\ separated\ by\ a\ tab}
392 \DoxyCodeLine{Output\ Options\ \ \ Description}
393 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/p\ \ \ \ (Required)\ Prefix\ for\ the\ output\ text\ file}
394
395 \end{DoxyCode}
396
397
398 Example BED file
399
400
401 \begin{DoxyCode}{0}
402 \DoxyCodeLine{Puerto\ \ 28\ \ 52\ \ 400\_1\_out\_L\ 60\ \ +}
403 \DoxyCodeLine{Puerto\ \ 482\ 504\ 400\_1\_out\_R\ 60\ \ -\/}
404 \DoxyCodeLine{Puerto\ \ 359\ 381\ 400\_2\_out\_L\ 60\ \ +}
405 \DoxyCodeLine{Puerto\ \ 796\ 818\ 400\_2\_out\_R\ 60\ \ -\/}
406 \DoxyCodeLine{Puerto\ \ 658\ 680\ 400\_3\_out\_L*\ \ \ \ 60\ \ +}
407 \DoxyCodeLine{Puerto\ \ 1054\ \ \ \ 1076\ \ \ \ 400\_3\_out\_R*\ \ \ \ 60\ \ -\/}
408 \DoxyCodeLine{.}
409 \DoxyCodeLine{.}
410 \DoxyCodeLine{.}
411 \DoxyCodeLine{.}
412
413 \end{DoxyCode}
414
415
416 Example primer pair information file
417 \begin{DoxyCode}{0}
418 \DoxyCodeLine{400\_1\_out\_L\ \ \ \ 400\_1\_out\_R}
419 \DoxyCodeLine{400\_2\_out\_L\ \ \ \ 400\_2\_out\_R}
420 \DoxyCodeLine{400\_3\_out\_L\ \ \ \ 400\_3\_out\_R}
421 \DoxyCodeLine{.}
422 \DoxyCodeLine{.}
423 \DoxyCodeLine{.}
424 \DoxyCodeLine{.}
425
426 \end{DoxyCode}
427
428
429 Example Usage\+:
430 \begin{DoxyCode}{0}
431 \DoxyCodeLine{ivar\ getmasked\ -\/i\ test.filtered.tsv\ -\/b\ primers.bed\ -\/f\ pair\_information.tsv\ -\/p\ test.masked.txt}
432
433 \end{DoxyCode}
434
435
436 The command above produces an output file -\/ test.\+masked.\+txt.
437
438 Example Output\+:
439
440
441 \begin{DoxyCode}{0}
442 \DoxyCodeLine{1\ 2\ 7\ 8}
443
444 \end{DoxyCode}
445 \hypertarget{manualpage_autotoc_md21}{}\doxysubsection{\texorpdfstring{Remove reads associated with mismatched primer indices}{Remove reads associated with mismatched primer indices}}\label{manualpage_autotoc_md21}
446 This command accepts an aligned and sorted BAM file trimmed using {\ttfamily ivar trim} and removes the reads corresponding to the supplied primer indices, which is the output of {\ttfamily ivar getmasked} command. Under the hood, {\ttfamily ivar trim} 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 {\ttfamily ivar trim}.
447
448 Command\+:
449 \begin{DoxyCode}{0}
450 \DoxyCodeLine{ivar\ removereads}
451 \DoxyCodeLine{}
452 \DoxyCodeLine{Usage:\ ivar\ removereads\ -\/i\ <input.trimmed.bam>\ -\/p\ <prefix>\ -\/t\ <text-\/file-\/with-\/primer-\/indices>}
453 \DoxyCodeLine{Note:\ This\ step\ is\ used\ only\ for\ amplicon-\/based\ sequencing.}
454 \DoxyCodeLine{}
455 \DoxyCodeLine{Input\ Options\ \ \ \ Description}
456 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/i\ \ \ \ (Required)\ Input\ BAM\ file\ \ trimmed\ with\ ivar\ trim.\ Must\ be\ sorted\ and\ indexed,\ which\ can\ be\ done\ using\ sort\_index\_bam.sh}
457 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/t\ \ \ \ (Required)\ Text\ file\ with\ primer\ indices\ separated\ by\ spaces.\ This\ is\ the\ output\ of\ getmasked\ command.}
458 \DoxyCodeLine{}
459 \DoxyCodeLine{Output\ Options\ \ \ Description}
460 \DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ -\/p\ \ \ \ (Required)\ Prefix\ for\ the\ output\ filtered\ BAM\ file}
461
462 \end{DoxyCode}
463
464
465 Example Usage\+:
466 \begin{DoxyCode}{0}
467 \DoxyCodeLine{ivar\ trim\ -\/i\ test.bam\ -\/p\ test.trimmed}
468 \DoxyCodeLine{ivar\ removereads\ -\/i\ test.trimmed.bam\ -\/p\ test.trimmed.masked.bam\ -\/t\ test.masked.txt}
469
470 \end{DoxyCode}
471
472
473 The {\ttfamily ivar trim} command above trims test.\+bam and produced test.\+trimmed.\+bam with the primer indice data added. The {\ttfamily ivar removereads} command produces an output file -\/ test.\+trimmed.\+masked.\+bam after removing all the reads corresponding to primer indices -\/ 1,2,7 and 8.\hypertarget{manualpage_autotoc_md22}{}\doxysubsection{\texorpdfstring{(Experimental) trimadapter}{(Experimental) trimadapter}}\label{manualpage_autotoc_md22}
474 {\bfseries{Note\+: This feature is under active development and not completely validated yet.}}
475
476 trimadapter in i\+Var can be used to trim adapter sequences from fastq files using a supplied fasta file.