Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mtiwaridros
    Member
    • Feb 2014
    • 20

    #1

    STAR Output Sam Files

    Hello

    I am using STAR2.3.0e for alignments.
    Are the output sam files (Aligned.out..sam) already sorted and can be used directly with htseq-count?
    Or do I need to convert them into bam, sort the bam, and use the sorted bam for htseq-count?

    Any help is appreciated.

    Thanks.
    M
  • WhatsOEver
    Senior Member
    • Apr 2012
    • 215

    #2
    No, they aren't. You need to run something like

    Code:
    samtools view -bS yourStarOutput.sam | samtools sort - yourSortedStarOutput

    Comment

    • mtiwaridros
      Member
      • Feb 2014
      • 20

      #3
      Hi

      Thanks for the reply.
      However, if I run:

      Code:
      samtools view -bS sample1.sam | samtools sort - sample1_sorted
      I get the error message:
      Code:
      [bam_header_read] EOF marker is absent. The input is probably truncated.
      [samopen] SAM header is present: 1870 sequences.
      Although the conversion is working.

      On the other hand, if I just convert the sam file to bam file using:
      Code:
      samtools view -bS sample1.sam > sample1
      And then sort it using:
      Code:
      samtools sort sample1.bam sample1_sorted.bam
      Then everything appears to work fine, and there is no error message.
      I have checked my sam files and they have headers, and seem to be fine.

      Is this a bug with samtools or am I missing something?

      Thanks.
      M

      Comment

      • WhatsOEver
        Senior Member
        • Apr 2012
        • 215

        #4
        The End Of File marker just tells samtools that the file ends at this point. It can be missing or unrecognizable because of different reasons (eg. moving files between linux and windows or it was deleted). If you know that your file isnt't truncated, you can ignore this warning (Its not an error! ). The conversion is not influenced by that.

        Comment

        • mtiwaridros
          Member
          • Feb 2014
          • 20

          #5
          But then why I don't get the error if I run the commands separately?

          Comment

          • WhatsOEver
            Senior Member
            • Apr 2012
            • 215

            #6
            I think that the sort command throws the warning and that you don't get it by splitting the command is because you write to a new file using view. This way you get a file with a proper EOF marker set at the end.
            You could try to set an EOF manually in your original file (Ctrl+D under Linux, no idea under Windows) and see if that prevents the warning.

            Comment

            • GenoMax
              Senior Member
              • Feb 2008
              • 7142

              #7
              See #11 in this post for Peter's solution: http://seqanswers.com/forums/showthread.php?t=19228

              Comment

              • dpryan
                Devon Ryan
                • Jul 2011
                • 3478

                #8
                Some versions of samtools incorrectly show the EOF message when you pipe a file into them (at least that's the case with the sort command). What's supposed to happen is that it keeps track of how it's reading the file and then doesn't check for the EOF if you use a pipe (since you can't seek to the end), but at some point that code got changed. I think this works correctly in the current (1.0) version.

                Comment

                • alexdobin
                  Senior Member
                  • Feb 2009
                  • 161

                  #9
                  Originally posted by mtiwaridros View Post
                  Hello

                  I am using STAR2.3.0e for alignments.
                  Are the output sam files (Aligned.out..sam) already sorted and can be used directly with htseq-count?
                  Or do I need to convert them into bam, sort the bam, and use the sorted bam for htseq-count?

                  Any help is appreciated.

                  Thanks.
                  M
                  STAR .sam files do not need to be sorted for ht-seq, you can simply convert them to .bam and feed the .bam to ht-seq.
                  I would strongly recommend switching to a newer version of STAR from: https://github.com/alexdobin/STAR/releases
                  Then you can get the BAM file, or - if you need - coordinate-sorted BAM directly from STAR:
                  --outSAMtype BAM Unsorted
                  OR
                  --outSAMtype BAM SortedByCoordinate
                  OR BOTH
                  --outSAMtype BAM Unsorted SortedByCoordinate

                  Cheers
                  Alex

                  Comment

                  • mtiwaridros
                    Member
                    • Feb 2014
                    • 20

                    #10
                    Thank you all for the replies. The issue is clear now.

                    Best
                    M

                    Comment

                    Latest Articles

                    Collapse

                    • SEQadmin2
                      Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                      by SEQadmin2



                      Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                      Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                      ...
                      Today, 09:55 AM
                    • SEQadmin2
                      New Genomics Technologies Take Aim at Long-Standing Limits
                      by SEQadmin2


                      Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                      We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                      ...
                      09-28-2026, 10:25 AM

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by SEQadmin2, Today, 05:39 AM
                    0 responses
                    10 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, Yesterday, 09:56 AM
                    0 responses
                    11 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 10-09-2026, 11:14 AM
                    0 responses
                    25 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 09-29-2026, 09:51 AM
                    0 responses
                    77 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...