Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • FASTA sequence From large BAM file

    I hope I would be able to get some help even though my question will sound very basic, I am new to sequencing formats.

    I am working on a project that involves obtaining reference sequences from the .bam files in the 1000 genomes database, to perform disease studies for a group. I used samtools view to download the genomic region I am interested in, but the actual sequence column in the .bam files seem to have reads for both forward and reverse strands. I would like to know, how I could get the simple nucleotide sequence of the reference strand from .bam file ... some kind of consensus sequence I am guessing.

  • #2
    Are you trying to get the consensus sequence from a BAM file?

    The reference sequence would be the same standard human genome used for all the 1000 genomes, and can probably be downloaded from their site as FASTA.

    Comment


    • #3
      Yes, I want to get the consensus FASTA sequence from the BAM file for a given chromosome region(not necessarily the whole chromosome sequence).

      Comment


      • #4
        Have you tried searching the forum (or Google) for the terms BAM consensus?

        Look at the samtools mpileup command (which replaced the older samtools pileup command).

        Comment


        • #5
          I have the same question. I used the command
          Code:
          samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcfutils.pl vcf2fq > cns.fq
          However I got an error.
          Code:
          the 'Argument “f” isn’t numeric in numeric

          Comment


          • #6
            You're not the only person to hit that,

            Comment


            • #7
              Well. I think that it is the bug of samtools manual.
              I used the command
              Code:
              samtools pileup -cf ref.fa aln.bam | samtools.pl pileup2fq -D100 > cns.fastq
              Everything is fine.

              Comment


              • #8
                Originally posted by ardmore View Post
                Well. I think that it is the bug of samtools manual.
                I used the command
                Code:
                samtools pileup -cf ref.fa aln.bam | samtools.pl pileup2fq -D100 > cns.fastq
                Everything is fine.
                Pileup is deprecated. Everyone uses mpileup. Don't expect a lot of help if you stay with pileup.

                And you do realize that neither method will touch putative indels, right?

                Comment


                • #9
                  Originally posted by swbarnes2 View Post
                  And you do realize that neither method will touch putative indels, right?
                  What do you recommend for getting an indel aware consensus from a BAM file?

                  Comment


                  • #10
                    See here for one way to get a .vcf file with SNPs and indels from the .bam file, or a consensus sequence:


                    The consensus sequence generated by this method has the problem that it only applies the SNPs to the reference sequence, but not the indels.
                    The .vcf file is better since it includes both SNPs and indels.

                    The .vcf file can be converted to a .fasta sequence using this tool:

                    However, note that this tool will only take into account indels of length up to 2 bases (as of January 2013). You may want to write your own script to insert all the indels (including the longer ones) from the .vcf into the .fasta.
                    Last edited by kriikku; 01-13-2013, 06:46 AM.

                    Comment

                    Latest Articles

                    Collapse

                    • seqadmin
                      Strategies for Sequencing Challenging Samples
                      by seqadmin


                      Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
                      03-22-2024, 06:39 AM
                    • seqadmin
                      Techniques and Challenges in Conservation Genomics
                      by seqadmin



                      The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

                      Avian Conservation
                      Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
                      03-08-2024, 10:41 AM

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by seqadmin, Yesterday, 06:37 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, Yesterday, 06:07 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, 03-22-2024, 10:03 AM
                    0 responses
                    49 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, 03-21-2024, 07:32 AM
                    0 responses
                    66 views
                    0 likes
                    Last Post seqadmin  
                    Working...
                    X