read filter for FLAG 0x2 in BAM file

wkretzschwkretzsch Posts: 6Member

Hi,
I would like to perform base quality score recalibration on only the reads that have the "properly aligned" bit (0x2) set in the FLAG column of the SAM format. Ideally, I would like to use the --read_filter argument. Below is some code that does this to my satisfaction with the PrintReads walker of GATK 2 lite. However, GATK 2 lite does not support base quality score recalibration table creation. Is there any way someone could add the code to the GATK 2 full version?

I am not sure why, but the code seems to only work with the System.out.println() line.

Thanks,
Winni

/*
* code written by Kiran Garimella
*/

package org.broadinstitute.sting.gatk.filters;

import net.sf.samtools.SAMRecord;

public class ProperPairFilter extends ReadFilter {
@Override
public boolean filterOut(SAMRecord samRecord) {
System.out.println(samRecord.getProperPairFlag());
return !samRecord.getProperPairFlag();
}
}

Tagged:

Best Answer

Answers

  • wkretzschwkretzsch Posts: 6Member

    scratch that, this code works fine as well:

    /* * code written by Kiran Garimella */

    package org.broadinstitute.sting.gatk.filters;

    import net.sf.samtools.SAMRecord;

    public class ProperPairFilter extends ReadFilter {
    @Override
    public boolean filterOut(SAMRecord samRecord) {
    return !samRecord.getProperPairFlag();
    }
    }

  • wkretzschwkretzsch Posts: 6Member

    It looks like this will become a non-issue with the opening of the source code of GATK 2.0.

Sign In or Register to comment.