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 further based on a quality threshold.
Primer and Amplicon info
The tool requires information about primers and their binding sites in 6-column BED format. The information from this file is used to decide whether any mapped read in the BAM input ends with a primer sequence and should, thus, be soft-clipped.
Optionally, the tool can also discard reads that do not fully map to within any amplicon. Such reads are likely to be wet-lab or mapping artefacts and removing them can increase variant calling precision. To calculate the extent of expected amplicons the tool needs to know which primers work together to form an amplicon. The tool can try to deduce this info from the names of the primers found in the primer info dataset. This will require a primer naming scheme following the regex pattern:
.*_(?P<amplicon_number>\d+).*_(?P<primer_orientation>L(?:EFT)?|R(?:IGHT)?)
i.e., the following schemes will work (and get parsed as):
Alternatively, you can specify the amplicon information explicitly through a dataset that lists the names of primers that together form any given amplicon. In it, primer names (exactly matching those in the primer info dataset) need to be TAB-separated with one line per amplicon. If the primer scheme has more than two primers contributing to a given amplicon (in schemes using alternate primers), you can (in this Galaxy tool only) specify all of them on one line and the tool will calculate the maximum extent of the amplicon.
Quality trimming details and final length filtering
To do the quality trimming, iVar uses a sliding window approach. The window 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.
Finally, the trimmed length threshold gets applied if specified, and fully trimmed surviving reads are written to the BAM output.
Documentation can be found at https://andersen-lab.github.io/ivar/html/manualpage.html.