Thank you very much! This is a very interesting tool and it seems to work.
Edit: It definitly worked right away
• 1 views
•
link
Hello,
After mapping with STAR, I would like to remove all reads (single-end) from my Bam file, which show a gap in their alignment. Can this be done with samtools somehow?
using samjdk: http://lindenb.github.io/jvarkit/SamJdk.html
$ java -jar dist/samjdk.jar -e 'return !record.getReadUnmappedFlag() && record.getCigar()!=null && record.getCigar().getCigarElements().stream().map(C->C.getOperator()).noneMatch(OP->OP.equals(CigarOperator.N) || OP.equals(CigarOperator.D));' in.bam
!record.getReadUnmappedFlag() read must be mappedrecord.getCigar()!=null read has cigarrecord.getCigar().getCigarElements().stream(). get a stream of cigar componenetsmap(C->C.getOperator()) map to the cigar operatornoneMatch(OP->OP.equals(CigarOperator.N) || OP.equals(CigarOperator.D)); no operator can be 'N' or 'D'Thank you very much! This is a very interesting tool and it seems to work.
Edit: It definitly worked right away
Log in to answer this question.
Are deletions OK or do you want them filtered too?
I would like to remove deletions as well
GAP = single nucleotide variation + indels ?
I mean the remaining reads should be only continiously mapped to the reference genome, without a gap in their alignment, through splicing or deletions. The occurrence of SNPs was allowed during mapping and should be disregarded at this step.
Edit: Sry, with gap, I meant a splice junction in the reads alignment