Unconfigured Ad

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

    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

                • mylaser
                  Reply to Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                  by mylaser
                  Kheloyaar: The Complete Guide to Kheloyaar Loginand Kheloyaar ID
                  The online gaming industry has transformed the way people enjoy digital entertainment. As technology continues to improve, players are looking for platforms that offer convenience, security, and a seamless user experience. Kheloyaarhas gained attention among users who value an easy-to-use platform, quick account access, and a simple registration process.
                  Whether you're exploring Kheloyaar for the first time or want to understand...
                  Yesterday, 09:27 PM
                • 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.
                  ...
                  Yesterday, 11:10 AM
                • SEQadmin2
                  Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                  by SEQadmin2



                  Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                  There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                  07-08-2026, 05:17 AM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by SEQadmin2, Yesterday, 10:04 AM
                0 responses
                8 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-08-2026, 10:08 AM
                0 responses
                7 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-07-2026, 11:05 AM
                0 responses
                12 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-02-2026, 11:08 AM
                0 responses
                31 views
                0 reactions
                Last Post SEQadmin2  
                Working...