Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • how to extract both ends mapped to different reference from bam

    Is there an easy & robust way to extract from a mapping bam file all the read pairs where both ends mapped, but to different reference pieces?

    I had thought it might be possible using:

    samtools view -F (or -f) <some flag>

    but I can't figure out exactly what flag to use. Is there a bit for read pairs mapping to different reference pieces?

  • #2
    The simplest method would be with awk, since there's no flag to designate this:
    Code:
    samtools view foo.bam | awk '{if($7!="=") print $0}' > different_chromosomes.sam
    Note that the produced SAM file is missing its header, but you can change the samtools and awk commands if that's important to you.
    Last edited by dpryan; 02-26-2015, 11:54 PM. Reason: One too many equals signs!

    Comment


    • #3
      Thanks, thats a good idea. Would I not also need to exclude cases where the 7th column contained '*' as well? So I think it should be:

      samtools view foo.bam | awk '{if (($7!="=") && ($7!="*")) print $0}' > different_chromosomes.sam

      Comment


      • #4
        If your aligner is outputing singletons then yes, something like that should work.

        Comment

        Latest Articles

        Collapse

        • seqadmin
          Essential Discoveries and Tools in Epitranscriptomics
          by seqadmin




          The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
          04-22-2024, 07:01 AM
        • 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

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, 04-11-2024, 12:08 PM
        0 responses
        59 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 10:19 PM
        0 responses
        57 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 09:21 AM
        0 responses
        53 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-04-2024, 09:00 AM
        0 responses
        56 views
        0 likes
        Last Post seqadmin  
        Working...
        X