Unconfigured Ad

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

    #1

    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:
                    https://www.broadinstitute.org/gatk/...Reference.html
                    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
                      Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                      by SEQadmin2



                      CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                      Despite this, “CRISPR helped turn genome editing from a specialized technique into
                      ...
                      07-31-2026, 11:01 AM
                    • 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

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by SEQadmin2, 07-31-2026, 02:55 AM
                    0 responses
                    19 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-24-2026, 12:17 PM
                    0 responses
                    16 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-23-2026, 11:41 AM
                    0 responses
                    16 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 07-20-2026, 11:10 AM
                    0 responses
                    26 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...