Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Extracting fasta sequence from bam file with bed intervals

    Hello,
    maybe the question have already been answered, but I cannot find anything about...
    I'm mining 4 transcriptomes to identify common loci, for developing new loci for phylogenetic analyses.
    I have bam files from the transcriptomes sequences aligned against a reference genome (after some filters), I have a bed file containing the intervals found in the 4 transcriptomes (multiIntersect in BedTools), and I would like to retrieve the sequences for these intervals in each of the transcriptomes. I don't want the complete scaffolds, just the portion of the transcriptome scaffold (not from the reference genome) that is located in the intervals.
    I looked to the bedtools getfasta, but I got my reference sequence, and several other tools or combination of tools, but each time, I got only the reference sequence, or the entire scaffolds...
    Any idea that could help me ?

  • #2
    If you want the fasta from BAM file, I don't think so there is any tool. But what could you do is to get the reads mapped to regions of interests using samtools with -L option and then try to merge them based on overlaps.

    Comment


    • #3
      You can try the samtools pipeline to extract a consensus-sequence like here:
      Code:
      samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcfutils.pl vcf2fq > cns.fq
      In order to restrict it to your targets, you can loop it over them and restricting it with -r in the mpileup call.
      Afterwards, you need to convert the fastq to fasta with e.g. fastq_to_fasta from the fastx toolkit.

      Cheers,
      Michael

      Comment


      • #4
        Originally posted by Michael.Ante View Post
        You can try the samtools pipeline to extract a consensus-sequence like here:
        Code:
        samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcfutils.pl vcf2fq > cns.fq
        In order to restrict it to your targets, you can loop it over them and restricting it with -r in the mpileup call.
        Afterwards, you need to convert the fastq to fasta with e.g. fastq_to_fasta from the fastx toolkit.

        Cheers,
        Michael
        Hi Michael,

        I am new to RNAseq data analysis. I also want to obtain the complete sequence for every transcript that has been aligned from a bam file not just only consensus part. With the above is it possible to obtain the complete sequence?

        I used your above code and generated the fastq file but when opened the fastq file I found 'n's in between sequences. Also I found that some nucleotides are in Capital letters and while some are in small letters. Is the Nucleotides with Capital letters means they are consensus region?

        kindly guide me

        Comment


        • #5
          Hi Dena,

          I'd suggest to have a look at your data with the IGV browser first to get an impression of your read-distribution and coverage. Alternatively, you can use samtools tview.
          You mapped your reads against the genome while your data is from the transcriptome. The Ns are most likely derived from exon-exon junctions. If more than 80% of the nucleotides are identical, they are depicted in capital letters.

          Comment


          • #6
            Originally posted by Michael.Ante View Post
            Hi Dena,

            I'd suggest to have a look at your data with the IGV browser first to get an impression of your read-distribution and coverage. Alternatively, you can use samtools tview.
            You mapped your reads against the genome while your data is from the transcriptome. The Ns are most likely derived from exon-exon junctions. If more than 80% of the nucleotides are identical, they are depicted in capital letters.
            Hi Michael,

            The organism on which I work has no genome available so far so all I have to depend only on transcriptome for alignment.

            I want to find the mutation from RNAseq data. So I mapped the RNAseq data to my reference transcription and later generate a bam file. Using the command
            Code:
            samtools mpileup -uf ref.fa aln.bam | bcftools view -cg - | vcfutils.pl vcf2fq > cns.fq
            I generated fasta file only with aligned reads. To find the mutation, the aligned transcript will be compared with its own reference transcript from trancriptome to find the number of nucleotides have been mutated. Is my approach is right?

            Comment

            Latest Articles

            Collapse

            • seqadmin
              Recent Developments in Metagenomics
              by seqadmin





              Metagenomics has improved the way researchers study microorganisms across diverse environments. Historically, studying microorganisms relied on culturing them in the lab, a method that limits the investigation of many species since most are unculturable1. Metagenomics overcomes these issues by allowing the study of microorganisms regardless of their ability to be cultured or the environments they inhabit. Over time, the field has evolved, especially with the advent...
              09-23-2024, 06:35 AM
            • seqadmin
              Understanding Genetic Influence on Infectious Disease
              by seqadmin




              During the COVID-19 pandemic, scientists observed that while some individuals experienced severe illness when infected with SARS-CoV-2, others were barely affected. These disparities left researchers and clinicians wondering what causes the wide variations in response to viral infections and what role genetics plays.

              Jean-Laurent Casanova, M.D., Ph.D., Professor at Rockefeller University, is a leading expert in this crossover between genetics and infectious...
              09-09-2024, 10:59 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, 10-02-2024, 04:51 AM
            0 responses
            13 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 10-01-2024, 07:10 AM
            0 responses
            21 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 09-30-2024, 08:33 AM
            0 responses
            25 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 09-26-2024, 12:57 PM
            0 responses
            18 views
            0 likes
            Last Post seqadmin  
            Working...
            X