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
              Current Approaches to Protein Sequencing
              by seqadmin


              Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
              04-04-2024, 04:25 PM
            • 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

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, 04-11-2024, 12:08 PM
            0 responses
            18 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-10-2024, 10:19 PM
            0 responses
            22 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-10-2024, 09:21 AM
            0 responses
            16 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-04-2024, 09:00 AM
            0 responses
            47 views
            0 likes
            Last Post seqadmin  
            Working...
            X