Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JadeB
    Junior Member
    • Oct 2014
    • 5

    #1

    GSNAP and SAM header

    Dear all,

    I'm currently trying to align reads on a reference sequence with gsnap with this code :

    gsnap --gunzip -D ./ref/cristata -d cristata ./data/cristata/Pig-GC01_AGTTCC_L005_R1.fastq.gz ./data/cristata/Pig-GC01_AGTTCC_L005_R2.fastq.gz -t 8 -B 4 -A sam --nofails --clip-overlap --split-output GC01
    I'm working with very short reads, it's why i'm using the clip-overlap command.

    Work is finishing without error message, but my sam header is not complete, so I can't use my results files.

    For example :

    head ./GC01.concordant_uniq

    @SQ SN:GC01-(1934) LN:17090
    HWI-ST314:2581WBYACXX:5:1101:3036:2447 99 GC01-(1934) 11568 40 58M42H = 11626 116 GACCCTTCCTACCCACATCACGTCCATCCAAAATTCAACCACACGAGAGCACCTCCTT CCCFFFFFHHHHHJJJJJJIJJHIIIGJJJJJIJJJJJJJIJJJGJJJJJJJJJJJIJ MD:Z:58 NH:i:1 HI:i:1 NM:i:0 SM:i:40 XQ:i:40 X2:i:0
    [...]
    I only have the @SQ line, and no @HD line in the header.

    Do you see something I missed ?

    Thanks a lot in advance for your help !!

    Jade
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    You can just add it when converting to BAM. Just make a file with the @HD line and then
    Code:
    cat HD.txt file.sam | samtools view -Sbo file.bam -

    Comment

    • WhatsOEver
      Senior Member
      • Apr 2012
      • 215

      #3
      The @HD line is just the header and not mandatory for any downstream applications (as far as I know). BWA is also not creating it. If you need it, just add it like dpryan suggested, if not, just leave it.

      Comment

      • JadeB
        Junior Member
        • Oct 2014
        • 5

        #4
        Ok. Thanks a lot for your answers.

        If I don't need it, it's ok. But I thought my next error message was due to this lack.

        In fact, when I do this :

        for file in ./data/cristata/GC01.*.sam
        do
        samtools view -Sb $file > $file.bam
        done
        or this :

        for file in ./data/cristata/GC01.*.sam
        do
        samtools view -Sb -T ./ref/cristata/cristata.fasta $file > $file.bam
        done
        My job fails, with such a message :

        [samopen] SAM header is present: 1 sequences.
        [sam_read1] reference 'SN:GC01-(1934) LN:17090
        ' is recognized as '*'.
        [main_samview] truncated file.
        [...]
        But it doesn't seem to be truncated :

        tail -n 3 GC01.concordant_uniq

        HWI-ST314:2581WBYACXX:5:2316:14327:100908 163 GC01-(1934) 3724 40 52M48H = 3776 105 ACCAACTTATACACCTTCTCTGAAAGAGCTTCTTGCCACTAACACTGGCACT @C@FFFFFHGHHHJJGIIIIJJGHIJJJIJJJIJGIJIFHIICGIIIII)?D MD:Z:49C2 NH:i:1 HI:i:1 NM:i:1 SM:i:40 XQ:i:40 X2:i:0
        HWI-ST314:2581WBYACXX:5:2316:17260:100910 83 GC01-(1934) 2574 40 44H56M = 2518 -112 GTTCGTTTGTTCAACGATTAATAGTCCTACGTGATCTGAGTTCAGACCGGAGTAAT IJJGJJJJJJJJJIHGDFDIIIJJJJJJIIHHHIGJIJIJIGIFHHGHFDFFFCCC MD:Z:56 NH:i:1 HI:i:1 NM:i:0 SM:i:40 XQ:i:40 X2:i:0
        HWI-ST314:2581WBYACXX:5:2316:17260:100910 163 GC01-(1934) 2518 40 56M44H = 2574 112 GGTTTACGACCTCGATGTTGGATCAGGACATCCTAATGGTGCAGCAGCTGTTAAGG @CBFFFFFHHHHHJGGIHJJJEHHIIJGIIIJJJIGJJIDGGHIGGHII3=EFGHI MD:Z:49A6 NH:i:1 HI:i:1 NM:i:1 SM:i:40 XQ:i:40 X2:i:0
        Any ideas ?

        Comment

        • WhatsOEver
          Senior Member
          • Apr 2012
          • 215

          #5
          What samtools version are you using?
          Was there something like "missing EOF marker" in the "error message"?

          This is a quite common bug in version 0.1.19 (I think it has been resolved in the newer ones?!). It's actually just a warning and means nothing if you know that your input file was not truncated

          Comment

          • JadeB
            Junior Member
            • Oct 2014
            • 5

            #6
            I'm actually using the 0.1.19-44428cd one.

            But, I don't have something like "missing EOF marker", only lines as above (for files which are not empty), and "Your job has been killed."

            I have bam files finally, but I'm not sure I can use them...

            Comment

            • WhatsOEver
              Senior Member
              • Apr 2012
              • 215

              #7
              Ok, maybe the following helps...

              1) Is there a particular reason for using the "-T" parameter. I never use it and I actually don't what it is useful for. Although it don't think it will change anything, you could try the conversion without that.

              2) Your "GC01.concordant_uniq" file is a sam file created from one of the bam files using samtools view -h file.sam > GC01.concordant_uniq, isn't it? A more accurate comparison would be to use "diff file1 file2". If the output is empty, your files are equal.

              3) If (1) doesn't help and (2) doesn't give you enough confidence, upgrade samtools to version 1.1 and check if the warning remains.

              Comment

              • dpryan
                Devon Ryan
                • Jul 2011
                • 3478

                #8
                @WhatsOEver: -T is useful when a file is completely missing a header. Otherwise, it doesn't do much.

                @JadeB: The "[sam_read1] reference 'SN:GC01-(1934) LN:17090" means that samtools is seeing part of your header as a read. This is pretty unusual, but you're correct that this will only happen if it's not parsing the header correctly (internally, sam_hdr_read() moves the file pointer to just past the header). We're up to samtools 1.1 now, so go ahead and upgrade in any case, though I suspect there's something wrong with the header (maybe spaces rather than tabs) that will also prevent the newer versions from working. If 1.1 also doesn't work, post the first 100 or so lines (just "head -n 100 file.sam > file.txt") or so as a text file and I can have a look.

                Comment

                • JadeB
                  Junior Member
                  • Oct 2014
                  • 5

                  #9
                  Originally posted by WhatsOEver View Post
                  2) Your "GC01.concordant_uniq" file is a sam file created from one of the bam files using samtools view -h file.sam > GC01.concordant_uniq, isn't it? A more accurate comparison would be to use "diff file1 file2". If the output is empty, your files are equal.
                  No, my sam files are gsnap output, not made with samtools view, then I'm trying to have bam files...

                  I'm currently trying an other thing : error could maybe be linked with different names between my fasta file and inside my fasta file, in the header. I homogenize everything, and if it doesn't change anything, I'll ask for an update of samtools version to the bioinformatics server I use...

                  Thanks again !

                  Comment

                  Latest Articles

                  Collapse

                  • SEQadmin2
                    Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                    by SEQadmin2



                    CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                    Despite this, “CRISPR helped turn genome editing from a specialized technique into
                    ...
                    07-31-2026, 11:01 AM
                  • SEQadmin2
                    Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                    by SEQadmin2


                    Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                    The systematic characterization of the human proteome has
                    ...
                    07-20-2026, 11:48 AM
                  • SEQadmin2
                    Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                    by SEQadmin2



                    Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                    ...
                    07-09-2026, 11:10 AM

                  ad_right_rmr

                  Collapse

                  News

                  Collapse

                  Topics Statistics Last Post
                  Started by SEQadmin2, 07-31-2026, 02:55 AM
                  0 responses
                  17 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 07-24-2026, 12:17 PM
                  0 responses
                  15 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 07-23-2026, 11:41 AM
                  0 responses
                  13 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 07-20-2026, 11:10 AM
                  0 responses
                  24 views
                  0 reactions
                  Last Post SEQadmin2  
                  Working...