andersen-lab / ivar

iVar is a computational package that contains functions broadly useful for viral amplicon-based sequencing.
https://andersen-lab.github.io/ivar/html/
GNU General Public License v3.0
115 stars 39 forks source link

iVar doesnt trim right end of single end reads #94

Open JenkoB opened 3 years ago

JenkoB commented 3 years ago

Describe the bug We are using ARTIC Illumina bioinformatic workflow to analyse SARS-Cov-2 sequences (https://github.com/CDCgov/SARS-CoV-2_Sequencing/tree/master/protocols/BFX-UT_ARTIC_Illumina). On paired-end reads is working perfectly, however we have a run of Illumina single end reads. The problem is that on Illumina single end reads iVar does not trim reverse reads from right primer on (second screen shot). Foreward reads are trimmed perfectly (first screen shot). We are using rampart primer scheme: https://github.com/artic-network/artic-ncov2019/blob/master/primer_schemes/nCoV-2019/V3/nCoV-2019.primer.bed

To Reproduce BWA_INDEX="path_to/artic-ncov2019/nCoV-2019.reference.fasta" (https://github.com/artic-network/artic-ncov2019/blob/master/primer_schemes/nCoV-2019/V3/nCoV-2019.reference.fasta) PRIMER_SCHEMES_v3="path_to/nCoV-2019/V3/nCoV-2019.primer.bed" (https://github.com/artic-network/artic-ncov2019/blob/master/primer_schemes/nCoV-2019/V3/nCoV-2019.primer.bed)

bwa mem -Y -t ${THREADS} "${BWA_INDEX}" "${sample}"/*_R1_001.fastq.gz | samtools sort | samtools view -F 4 -o "${sample}"/"${NAME}".sorted.bam

ivar trim -e -i "${sample}"/"${NAME}".sorted.bam -b "${PRIMER_SCHEMES_v3}" -p "${sample}"/"${NAME}".primertrim samtools sort "${sample}"/"${NAME}".primertrim.bam -o "${sample}"/"${NAME}".primertrim.sorted.bam

Expected behavior Trimmed all primers from "${sample}"/"${NAME}".primertrim.sorted.bam

Screenshots Foreward reads are ok. Upper read is .sorted.bam file before trimming, lower is *.primertrim.sorted.bam after iVar trim. foreward_reads_iVar

Reverse reads are not trimmed correctly. Upper read is .sorted.bam file before trimming, lower is *.primertrim.sorted.bam file after iVar trim. Some reads are not trimmed from right primer backwards. Reverse_reads_iVar

Desktop (please complete the following information):

Additional context Please let us know if we need to change something in iVar command line or primer scheme that we are using? Thank you. Barbara

gkarthik commented 3 years ago

Hello Barbara, could you please share a test file that I could use to reproduce this issue? Thank you!