# Conversion of SAM to BAM files

I am very new to micro RNA analysis. I have been using H. sapiens, GRCh38 + major index as given in the Bowtie Website to align with my trimmed FASTQ file . The command I am using to make very sensitive alignments with Bowtie2 is given below.

module load  Bowtie2;
bowtie2 --local -p 8 -q --phred33 -D 20 -R 3 -N 0 -L 8 \
-i S,1,0.50 -x grch38_1kgmaj \
-U /gpfs/ycga/scratch60/nicoli/ag2646/HumanmicroRNAbowtie_verysensitive_1.06.2021./3kPa_HDF_miRNA_1bbduk.fastq \
-S /gpfs/ycga/scratch60/nicoli/ag2646/HumanmicroRNAbowtie_verysensitive_1.06.2021./3kPa_HDF_miRNA_1bbduk.sam


Then I am using:

samtools sort -bS 3kPa_HDF_miRNA_1bbduk.sam > 3kPa_HDF_miRNA_1bbduk.bam


to convert sam files into bam files.

However, I am hitting the error described below:

[W::sam_read1_sam] Parse error at line 46371


When I grepped the specific line it shows:

SRR8248790.46371        4       *       0       0       *       *       0       0       CCTGGATGATGATAAGCAAATGCTGACTGAACATGAAGGTCTTAATTAGCTCTAACTGACTAGATCGGAAGAGCAC   BBADAGEHIFHHIIIIIGGFIHIIIIIIIHHHHHIHHHEHEHEHFEHIIIEHIIIIIEHIIHIIIHGHHHIIII1C   YT:Z:UU


Any specific help troubleshooting this error will be very useful.

• The [W: is just a warning. If the process errored out, there should be another actual error message that follows that warning. Jun 3, 2021 at 18:51
• Is it the last line of the samfile? I wonder if the sam file could be truncated (like a missing newline or something). Jun 3, 2021 at 22:03
• How did you "grep the line"? Is that actually line number 46371 of the file, or is that a random line that happens to contain the string 46371? Jun 4, 2021 at 17:03
• Is your samtools sort command actually a samtools view command? The -bS flag would not work with samtools sort: htslib.org/doc/samtools-sort.html. I tried it out of curiosity and got samtools: invalid option -- b. Jun 5, 2021 at 18:16
• See similar situation here: biostars.org/p/169277. Have you confirmed that bowtie2 finished without errors? Does your sam file look ok? how many lines does it have? Jun 5, 2021 at 18:20