Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove reads that are mapped close each other #12

Open
wsuplantpathology opened this issue Dec 25, 2018 · 2 comments
Open

remove reads that are mapped close each other #12

wsuplantpathology opened this issue Dec 25, 2018 · 2 comments

Comments

@wsuplantpathology
Copy link

Dear bazam team:

I have a quick question. Could you please write a script to remove the PE reads when the two reads in a pair are mapped within 1000 bp from a bam file? e.g.: if the mapping distance of the two reads in the pair is below 1000bp, then remove this pair from the bam file. Thanks so much.

Sincerely,
Chongjing

@ssadedin
Copy link
Owner

Hi @wsuplantpathology -

Bazam can do this by using the -f option to filter the reads. An example (which you might want to tweak) would be like this:

java -jar build/libs/bazam.jar  \
    -f '(pair.r1.referenceIndex == pair.r2.referenceIndex) && (Math.abs(pair.r1.alignmentStart-pair.r2.alignmentStar
t)>1000)' \
-bam test.bam > filtered.interleaved.fastq

Hope this helps and let me know if it doesn't make sense.

@wsuplantpathology
Copy link
Author

Dear @ssadedin

Thanks so much for your quick response. For my understanding, your script was to keep the reads pairs that are mapped at distance above 1000 bp, am I right?

I think my situation is more complicated. Because my mapping has difference cases, please refer to this cartoon:

image

What I want to do is just discard the read pairs that are mapped within 1000 bp, and keep all read pairs in all other situations. I am looking forward to some suggestions. Thanks for your help, I really appreciate.

Sincerely,
Chongjing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants