Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #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


    • #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


      • #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


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

          Comment


          • #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


            • #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


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

                Thanks!

                Comment

                Latest Articles

                Collapse

                • seqadmin
                  Recent Advances in Sequencing Analysis Tools
                  by seqadmin


                  The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
                  05-06-2024, 07:48 AM
                • seqadmin
                  Essential Discoveries and Tools in Epitranscriptomics
                  by seqadmin




                  The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
                  04-22-2024, 07:01 AM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by seqadmin, 05-14-2024, 07:03 AM
                0 responses
                19 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 05-10-2024, 06:35 AM
                0 responses
                42 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 05-09-2024, 02:46 PM
                0 responses
                53 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 05-07-2024, 06:57 AM
                0 responses
                42 views
                0 likes
                Last Post seqadmin  
                Working...
                X