Body: <p>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.</p>
  <pre><code>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
  </code></pre>
  <p>Then I am using:</p>
  <pre><code>samtools sort -bS 3kPa_HDF_miRNA_1bbduk.sam &gt; 3kPa_HDF_miRNA_1bbduk.bam
  </code></pre>
  <p>to convert sam files into bam files.</p>
  <p>However, I am hitting the error described below:</p>
  <pre><code>[W::sam_read1_sam] Parse error at line 46371
  </code></pre>
  <p>When I grepped the specific line it shows:</p>
  <pre><code>SRR8248790.46371        4       *       0       0       *       *       0       0       CCTGGATGATGATAAGCAAATGCTGACTGAACATGAAGGTCTTAATTAGCTCTAACTGACTAGATCGGAAGAGCAC   BBADAGEHIFHHIIIIIGGFIHIIIIIIIHHHHHIHHHEHEHEHFEHIIIEHIIIIIEHIIHIIIHGHHHIIII1C   YT:Z:UU
  </code></pre>
  <p>Any specific help troubleshooting this error will be very useful.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-03T18:51:14.957Z
Comments.Text: The `[W:` is just a warning. If the process errored out, there should be another actual error message that follows that warning.
Comments.UserDisplayName: Ram RS
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-03T22:03:23.830Z
Comments.Text: Is it the last line of the samfile? I wonder if the sam file could be truncated (like a missing newline or something).
Comments.UserDisplayName: Kamil S Jaron
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-04T17:03:49.777Z
Comments.Text: 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`?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-05T18:16:06.907Z
Comments.Text: Is your `samtools sort` command actually a `samtools view` command? The `-bS` flag would not work with `samtools sort`: http://www.htslib.org/doc/samtools-sort.html. I tried it out of curiosity and got `samtools: invalid option -- b`.
Comments.UserDisplayName: Maximilian Press
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-05T18:20:15.850Z
Comments.Text: See similar situation here: https://www.biostars.org/p/169277/. Have you confirmed that bowtie2 finished without errors? Does your sam file look ok? how many lines does it have?
Comments.UserDisplayName: Maximilian Press
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-09T20:37:14.020Z
Comments.Text: My bowtie file alignment completed without truncation but only showed errros.
Comments.UserDisplayName: Aranyak Goswami
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-30T05:53:37.033Z
Comments.Text: Are you able to trace the same line in the raw fastq file (before trimming) with the same identifier?? If yes, what is the content of that line?
Comments.UserDisplayName: Lot_to_learn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-07-01T21:22:43.500Z
Comments.Text: I have resolved all the errors. Thanks for all your help.
Comments.UserDisplayName: Aranyak Goswami
Tags: <samtools><genomics><format-conversion><bowtie2>
Title: Conversion of SAM to BAM files
ThreadText: # Conversion of SAM to BAM files
  
  (Asked by: username_0 on 2021-06-03)
  
  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.
  
  **Tags:** samtools, genomics, format-conversion, bowtie2
  
  > **Comments:**
  > **username_1**: The `[W:` is just a warning. If the process errored out, there should be another actual error message that follows that warning.  
  > **username_2**: Is it the last line of the samfile? I wonder if the sam file could be truncated (like a missing newline or something).  
  > **username_3**: 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`?  
  > **username_4**: Is your `samtools sort` command actually a `samtools view` command? The `-bS` flag would not work with `samtools sort`: http://www.htslib.org/doc/samtools-sort.html. I tried it out of curiosity and got `samtools: invalid option -- b`.  
  > **username_4**: See similar situation here: https://www.biostars.org/p/169277/. Have you confirmed that bowtie2 finished without errors? Does your sam file look ok? how many lines does it have?  
  > **username_0**: My bowtie file alignment completed without truncation but only showed errros.  
  > **username_5**: Are you able to trace the same line in the raw fastq file (before trimming) with the same identifier?? If yes, what is the content of that line?  
  > **username_0**: I have resolved all the errors. Thanks for all your help.  
  
  ---
  
  ## 0 answers
  
  