Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sharmi
    Junior Member
    • Apr 2014
    • 7

    #1

    samtools view giving error in reading .fa file

    Hi,

    I am new to Bioinformatics and I am trying to use the samtools view command. I have generated the SAM file but the header is missing so I followed this link (http://davetang.org/wiki/tiki-index.php?page=SAMTools) and tried the commands, but I get the following error -

    samtools view -bS new_test.sam > new_test.bam
    [samopen] no @SQ lines in the header.
    [sam_read1] missing header? Abort!
    cbil@cbil-desktop:~/bowtie-linux/bowtie-1.0.1$ samtools view -bT e_coli_1000.fa new_test.sam > new_test.bam
    [samfaipath] fail to read file e_coli_1000.fa.
    [main_samview] fail to open "new_test.sam" for reading.

    Can someone please help me?

    Thanks!
  • blancha
    Senior Member
    • May 2013
    • 367

    #2
    Converting a FASTA file (sequence file) directly to a BAM (Binary Alignment Map) file makes no sense to me.

    You would normally align your sequences in the FASTQ format to a reference genome in the FASTA format, using a program like Bowtie2, to generate a BAM file.

    Comment

    • dpryan
      Devon Ryan
      • Jul 2011
      • 3478

      #3
      @blancha: Sharmi isn't trying to convert a fasta file to BAM. His/her problem is that the SAM file lacks a header, which Sharmi is trying to replace with the -T option, though that won't work here since the e_coli_1000.fasta file isn't a reference sequence...

      @Sharmi: Don't use the --sam-nohead option with bowtie if that's what you did. The header from the example should be:

      Code:
      @HD     VN:1.0  SO:unsorted
      @SQ     SN:gi|110640213|ref|NC_008253.1|        LN:4938920
      @PG     ID:Bowtie       VN:1.0.1        CL:"./bowtie -S e_coli reads/e_coli_1000.fq"
      You could just add it in manually, since there output file is so small (remember to separate fields with a tab rather than a space).

      Comment

      • blancha
        Senior Member
        • May 2013
        • 367

        #4
        @dpryan: Yes, you are right. I was trying to be helpful, and answer a question instead of asking one for once, but my answer was wrong .

        Comment

        • dpryan
          Devon Ryan
          • Jul 2011
          • 3478

          #5
          @blancha: No worries and don't let that dissuade you from answering posts!

          Comment

          • Sharmi
            Junior Member
            • Apr 2014
            • 7

            #6
            Hi,
            Thank you for the reply. I am sorry I have a few questions-

            I have a e_coli_1000.fa.fai file in the bowtie folder, but if I use -
            cbil@cbil-desktop:~/bowtie-linux/bowtie-1.0.1$ samtools view -bt e_coli_1000.fa.fai new_test.sam > new_test.bam
            I get the following error -
            [main_samview] fail to open "new_test.sam" for reading.
            cbil@cbil-desktop:~/bowtie-linux/bowtie-1.0.1$

            Is it because of missing headers in the SAM file?

            If I compare the SAM file I have with the format mentioned in the link (http://biobits.org/samtools_primer.html), my files start with r0,r1 and the the -/+ for the reverse/forward and then gi... But in the link after the header section there is no r0 or r1. Is there something wrong with my SAM files?

            Also should I manually add the first three lines of the header in the SAM file? The current SAM file starts like this (sorry if the questions sound stupid, I am trying to learn the tools for my research) -
            r0 - gi|110640213|ref|NC_008253.1| 3658049 ATGCTGGAATGGCGATAGTTGGGTGGGTATCGTTC 45567778999:9;;<===>?@@@@AAAABCCCDE 0 32:T>G,34:G>A
            r1 - gi|110640213|ref|NC_008253.1| 1902085 CGGATGATTTTTATCCCATGAGACATCCAGTTCGG 45567778999:9;;<===>?@@@@AAAABCCCDE 0
            r2 - gi|110640213|ref|NC_008253.1| 3989609 CATAAAGCAACAGTGTTATACTATAACAATTTTGA 45567778999:9;;<===>?@@@@AAAABCCCDE 0
            r5 + gi|110640213|ref|NC_008253.1| 4249841 CAGCATAAGTGGATATTCAAAGTTTTGCTGTTTTA EDCCCBAAAA@@@@?>===<;;9:99987776554 0
            r7 + gi|110640213|ref|NC_008253.1| 4086913 GCATATTGCCAATTTTCGCTTCGGGGATCAGGCTA EDCCCBAAAA@@@@?>===<;;9:99987776554 0
            r8 + gi|110640213|ref|NC_008253.1| 2679194 GGTTCAGTTCAGTATACGCCTTATCCGGCCTACGG EDCCCBAAAA@@@@?>===<;;9:99987776554 0 14:A>T,33:C>G
            r9 - gi|110640213|ref|NC_008253.1| 2430559

            Thanks,
            Sharmi

            Comment

            • dpryan
              Devon Ryan
              • Jul 2011
              • 3478

              #7
              That error might be fixed by using the -S option, but if not it just means that "new_test.sam" doesn't exist in the current working directory.

              BTW, the example alignments you posted aren't in SAM format. That's probably the old bowtie format. Never use that.

              Comment

              • Sharmi
                Junior Member
                • Apr 2014
                • 7

                #8
                I have installed bowtie 1, do I need to install bowtie 2?

                Thanks!

                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
                  ...
                  10-14-2026, 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, 10-22-2026, 11:13 AM
                0 responses
                23 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 10-22-2026, 10:48 AM
                0 responses
                20 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 10-15-2026, 10:52 AM
                0 responses
                36 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 10-14-2026, 05:39 AM
                0 responses
                42 views
                0 reactions
                Last Post SEQadmin2  
                Working...