Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pguilha
    Member
    • Jan 2011
    • 10

    #1

    Intersect BAM files from alignments to human and mouse

    Hi,

    I have searched the forums (closest thing was this: seqanswers.com/forums/showthread.php?t=31625 but no replies) and done a lot of trial and error on my own, but can't come up with a good solution to this so I'm hoping someone here will have an idea!

    I'm working with xenograft models so have aligned my reads (paired end) separately to human and mouse as I want to get an idea of the levels of contamination from mouse, and devise the best strategy to deal with mouse reads from there.

    So I have two BAM files (1 for human, 1 for mouse); for each of those I've extracted the mapped and unmapped reads using samtools (-f4 and -F4 options).

    I now want to, for example, compare/intersect the reads that map to both human and mouse for a given sample. A sort of intersectBed but with 2 BAM files (bedtools only seems to accept one BAM file + 1 bed file);

    I have tried using the CompareSAMs function in Picard tools but it just tells me for each read that they're not the same in each file "read name ceases agreeing" (doesn't seem to do any searching):

    Code:
    java -jar CompareSAMs.jar mapped_to_human.sorted.bam mapped_to_mouse.sorted.bam
    Any hints would be much appreciated!
    Thanks

    PS: I'm also using the Xenome tools in parallel, but want to do this manually as well as a form of sanity check.
  • lindenb
    Senior Member
    • Apr 2010
    • 143

    #2
    CmpBams

    I wrote a tool named CmpBams ( https://github.com/lindenb/jvarkit/wiki/CmpBams ) that might help you. It takes two or more BAM and show the differences for each read F/R.

    Code:
    #READ-Name	tmp1.sam tmp2.sam|tmp1.sam tmp3.sam|tmp2.sam tmp3.sam	tmp1.sam	tmp2.sam	tmp3.sam
    HWI-1KL149:20:C1CU7ACXX:1:1101:17626:32431/1	EQ|EQ|EQ	K01:2136=83/43M3I54M	K01:2136=83/43M3I54M	K01:2136=83/43M3I54M
    HWI-1KL149:20:C1CU7ACXX:1:1101:17626:32431/2	EQ|EQ|EQ	K01:2059=163/100M	K01:2059=163/100M	K01:2059=163/100M
    HWI-1KL149:20:C1CU7ACXX:1:1102:16831:71728/1	EQ|EQ|EQ	K01:2133=83/100M	K01:2133=83/100M	K01:2133=83/100M
    HWI-1KL149:20:C1CU7ACXX:1:1102:16831:71728/2	EQ|EQ|EQ	K01:2059=163/100M	K01:2059=163/100M	K01:2059=163/100M
    HWI-1KL149:20:C1CU7ACXX:1:1105:3309:27760/1	EQ|EQ|EQ	K01:2213=83/100M	K01:2213=83/100M	K01:2213=83/100M
    HWI-1KL149:20:C1CU7ACXX:1:1105:3309:27760/2	EQ|EQ|EQ	K01:2081=163/100M	K01:2081=163/100M	K01:2081=163/100M
    HWI-1KL149:20:C1CU7ACXX:1:1106:2914:12111/1	EQ|EQ|EQ	K01:2136=83/43M3I54M	K01:2136=83/43M3I54M	K01:2136=83/43M3I54M
    HWI-1KL149:20:C1CU7ACXX:1:1106:2914:12111/2	EQ|EQ|EQ	K01:2059=163/100M	K01:2059=163/100M	K01:2059=163/100M
    HWI-1KL149:20:C1CU7ACXX:1:1107:11589:17295/1	EQ|EQ|EQ	K01:2123=83/56M3I41M	K01:2123=83/56M3I41M	K01:2123=83/56M3I41M
    HWI-1KL149:20:C1CU7ACXX:1:1107:11589:17295/2	EQ|EQ|EQ	K01:1990=163/100M	K01:1990=163/100M	K01:1990=163/100M
    HWI-1KL149:20:C1CU7ACXX:1:1110:14096:95943/1	EQ|EQ|EQ	K01:2123=83/56M3I41M	K01:2123=83/56M3I41M	K01:2123=83/56M3I41M
    HWI-1KL149:20:C1CU7ACXX:1:1110:14096:95943/2	EQ|EQ|EQ	K01:1990=163/100M	K01:1990=163/100M	K01:1990=163/100M
    HWI-1KL149:20:C1CU7ACXX:1:1110:15369:59046/1	EQ|EQ|EQ	K01:2213=83/100M	K01:2213=83/100M	K01:2213=83/100M
    you could pipe the output in awk to select the reads that have been (un)mapped in on or more genome.

    Comment

    • pguilha
      Member
      • Jan 2011
      • 10

      #3
      Thanks, I'll give that a go!

      Comment

      Latest Articles

      Collapse

      • SEQadmin2
        Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
        by SEQadmin2



        Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

        Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
        ...
        10-14-2026, 09:55 AM
      • SEQadmin2
        New Genomics Technologies Take Aim at Long-Standing Limits
        by SEQadmin2


        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
        ...
        09-28-2026, 10:25 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, 10-15-2026, 10:52 AM
      0 responses
      28 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-14-2026, 05:39 AM
      0 responses
      36 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-13-2026, 09:56 AM
      0 responses
      31 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-09-2026, 11:14 AM
      0 responses
      29 views
      0 reactions
      Last Post SEQadmin2  
      Working...