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
              Advanced Methods for the Detection of Infectious Disease
              by seqadmin




              The recent pandemic caused worldwide health, economic, and social disruptions with its reverberations still felt today. A key takeaway from this event is the need for accurate and accessible tools for detecting and tracking infectious diseases. Timely identification is essential for early intervention, managing outbreaks, and preventing their spread. This article reviews several valuable tools employed in the detection and surveillance of infectious diseases.
              ...
              Yesterday, 01:15 PM
            • seqadmin
              Strategies for Investigating the Microbiome
              by seqadmin




              Microbiome research has led to the discovery of important connections to human and environmental health. Sequencing has become a core investigational tool in microbiome research, a subject that we covered during a recent webinar. Our expert speakers shared a number of advancements including improved experimental workflows, research involving transmission dynamics, and invaluable analysis resources. This article recaps their informative presentations, offering insights...
              11-09-2023, 07:02 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, Yesterday, 08:12 AM
            0 responses
            15 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 11-22-2023, 09:29 AM
            1 response
            51 views
            0 likes
            Last Post VilliamPast  
            Started by seqadmin, 11-22-2023, 08:53 AM
            0 responses
            57 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 11-21-2023, 08:24 AM
            0 responses
            31 views
            0 likes
            Last Post seqadmin  
            Working...
            X