Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • mez
    Junior Member
    • Nov 2011
    • 5

    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.
  • maubp
    Peter (Biopython etc)
    • Jul 2009
    • 1544

    #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

    • mez
      Junior Member
      • Nov 2011
      • 5

      #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

      • maubp
        Peter (Biopython etc)
        • Jul 2009
        • 1544

        #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

        • ardmore
          Member
          • Jun 2011
          • 51

          #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

          • maubp
            Peter (Biopython etc)
            • Jul 2009
            • 1544

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

            Comment

            • ardmore
              Member
              • Jun 2011
              • 51

              #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

              • swbarnes2
                Senior Member
                • May 2008
                • 910

                #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

                • maubp
                  Peter (Biopython etc)
                  • Jul 2009
                  • 1544

                  #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

                  • kriikku
                    Junior Member
                    • Jan 2013
                    • 5

                    #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

                    • 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
                    • 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, 11:41 AM
                    0 responses
                    10 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-20-2026, 11:10 AM
                    0 responses
                    23 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-13-2026, 10:26 AM
                    0 responses
                    37 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-09-2026, 10:04 AM
                    0 responses
                    45 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...