Importing read pairs from BAM with specific R1 and R2 start/end positions for pair
1
0
Entering edit mode
10 months ago
Emily Wasson ▴ 30

Hi there,

Is it possible to set up a ScanBamParam() to import read pairs where the R1 and R2 reads start and end at specific positions? Note that this is not a range, but rather a conditional to only import the read pair if the R1 has a certain position AND its R2 pair has a certain position.

If not with ScanBamParam(), is there another way to filter for this? Help would be very much appreciated :)

Kind regards, Emily

Rsamtools • 356 views
ADD COMMENT
0
Entering edit mode
10 months ago

using samjdk https://jvarkit.readthedocs.io/en/latest/SamJdk/ assuming the MC (mate cigar) attribute is available.

java -jar dist/jvarkit.jar samjdk -e 'return record.getReadPairedFlag() && !record.getReadUnmappedFlag() && record.getContig().equals("chr1") && record.getReadPairedFlag() && !record.getMateUnmappedFlag() && record.getContig().equals(record.getMateReferenceName())  && record.getStart()==12345 && SAMUtils.getMateAlignmentEnd(record)==56789;' in.bam
ADD COMMENT

Login before adding your answer.

Traffic: 1651 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6