-Integration tests for walkers that use original quals.

-framework for pushing -OQ into GATK (not done)


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3004 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-03-15 18:46:31 +00:00
parent e365d308d4
commit 411d25c8d1
3 changed files with 69 additions and 40 deletions

View File

@ -25,6 +25,8 @@ public class GATKSAMRecord extends SAMRecord {
// the SAMRecord data we're caching
private String mReadString = null;
private String mQualString = null;
private byte[] mQualities = null;
private SAMReadGroupRecord mReadGroup = null;
private boolean mNegativeStrandFlag;
private boolean mUnmappedFlag;
@ -50,16 +52,9 @@ public class GATKSAMRecord extends SAMRecord {
// because attribute methods are declared to be final (and we can't overload them),
// we need to actually set all of the attributes here
// TODO -- remove this exception catch when Picard fixes its internal bug (PIC-291)
try {
List<SAMTagAndValue> attributes = record.getAttributes();
for ( SAMTagAndValue attribute : attributes )
setAttribute(attribute.tag, attribute.value);
} catch (NullPointerException picardError) {
; // do nothing
}
List<SAMTagAndValue> attributes = record.getAttributes();
for ( SAMTagAndValue attribute : attributes )
setAttribute(attribute.tag, attribute.value);
}
///////////////////////////////////////////////////////////////////////////////
@ -122,6 +117,27 @@ public class GATKSAMRecord extends SAMRecord {
mSecondOfPairFlag = b;
}
public byte[] getBaseQualities() {
if ( mQualities == null )
mQualities = mRecord.getBaseQualities();
return mQualities;
}
public String getBaseQualityString() {
if ( mQualString == null )
mQualString = mRecord.getBaseQualityString();
return mQualString;
}
public void setBaseQualities(byte[] bytes) {
mQualities = bytes;
mRecord.setBaseQualities(bytes);
}
public void setBaseQualityString(String s) {
mQualString = s;
mRecord.setBaseQualityString(s);
}
/**
* Checks whether an attribute has been set for the given key.
@ -130,7 +146,7 @@ public class GATKSAMRecord extends SAMRecord {
* individual GATKSAMRecords. These attributes exist in memory only,
* and are never written to disk.
*
* @param key
* @param key key
* @return True if an attribute has been set for this key.
*/
public boolean containsTemporaryAttribute(Object key) {
@ -148,8 +164,9 @@ public class GATKSAMRecord extends SAMRecord {
* individual GATKSAMRecords. These attributes exist in memory only,
* and are never written to disk.
*
* @param key
* @param value
* @param key key
* @param value value
* @return attribute
*/
public Object setTemporaryAttribute(Object key, Object value) {
if(temporaryAttributes == null) {
@ -165,7 +182,7 @@ public class GATKSAMRecord extends SAMRecord {
* individual GATKSAMRecords. These attributes exist in memory only,
* and are never written to disk.
*
* @param key
* @param key key
* @return The value, or null.
*/
public Object getTemporaryAttribute(Object key) {
@ -182,7 +199,7 @@ public class GATKSAMRecord extends SAMRecord {
* individual GATKSAMRecords. These attributes exist in memory only,
* and are never written to disk.
*
* @param key
* @param key key
* @return The value that was associated with this key, or null.
*/
public Object removeTemporaryAttribute(Object key) {
@ -192,23 +209,6 @@ public class GATKSAMRecord extends SAMRecord {
return null;
}
/////////////////////////////////////////////////////////////////////
// *** The following methods are final and cannot be overridden ***//
/////////////////////////////////////////////////////////////////////
//public final Object getAttribute(String s) { return mRecord.getAttribute(s); }
//public final Integer getIntegerAttribute(java.lang.String s) { return mRecord.getIntegerAttribute(s); }
//public final Short getShortAttribute(String s) { return mRecord.getShortAttribute(s); }
//public final Byte getByteAttribute(java.lang.String s) { return mRecord.getByteAttribute(s); }
//public final void setAttribute(String s, Object o) { mRecord.setAttribute(s, o); }
//public final List<net.sf.samtools.SAMRecord.SAMTagAndValue> getAttributes() { return mRecord.getAttributes(); }
/////////////////////////////////////////////////////////////////////////////////
// *** The following methods just call the appropriate method in the record ***//
/////////////////////////////////////////////////////////////////////////////////
@ -225,14 +225,6 @@ public class GATKSAMRecord extends SAMRecord {
public int getReadLength() { return mRecord.getReadLength(); }
public String getBaseQualityString() { return mRecord.getBaseQualityString(); }
public void setBaseQualityString(java.lang.String s) { mRecord.setBaseQualityString(s); }
public byte[] getBaseQualities() { return mRecord.getBaseQualities(); }
public void setBaseQualities(byte[] bytes) { mRecord.setBaseQualities(bytes); }
public byte[] getOriginalBaseQualities() { return mRecord.getOriginalBaseQualities(); }
public void setOriginalBaseQualities(byte[] bytes) { mRecord.setOriginalBaseQualities(bytes); }

View File

@ -78,6 +78,29 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest {
}
}
@Test
public void testCountCovariatesUseOriginalQuals() {
HashMap<String, String> e = new HashMap<String, String>();
e.put( validationDataLocation + "originalQuals.1kg.chr1.1-1K.bam", "26ae1bede4f337901b6194753f6cf914");
for ( Map.Entry<String, String> entry : e.entrySet() ) {
String bam = entry.getKey();
String md5 = entry.getValue();
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-R " + oneKGLocation + "reference/human_b36_both.fasta" +
" -T CountCovariates" +
" -I " + bam +
" -L 1:1-1,000" +
" -standard" +
" -OQ" +
" -recalFile %s",
1, // just one output file
Arrays.asList(md5));
executeTest("testCountCovariatesUseOriginalQuals", spec);
}
}
@Test
public void testTableRecalibratorMaxQ70() {
HashMap<String, String> e = new HashMap<String, String>();

View File

@ -39,4 +39,18 @@ public class ClipReadsWalkersIntegrationTest extends WalkerTest {
@Test public void testClipNs() { testClipper("testClipNs", "-QT 10 -CR WRITE_NS", Q10ClipOutput, "fb77d3122df468a71e03ca92b69493f4"); }
@Test public void testClipQ0s() { testClipper("testClipQs", "-QT 10 -CR WRITE_Q0S", Q10ClipOutput, "24053a87b00c0bc2ddf420975e9fea4d"); }
@Test public void testClipSoft() { testClipper("testClipSoft", "-QT 10 -CR SOFTCLIP_BASES", Q10ClipOutput, "aeb67cca75285a68af8a965faa547e7f"); }
@Test
public void testUseOriginalQuals() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-R " + seqLocation + "references/Homo_sapiens_assembly18/v0/Homo_sapiens_assembly18.fasta" +
" -T ClipReads" +
" -I " + validationDataLocation + "originalQuals.chr1.1-1K.bam" +
" -L chr1:1-1,000" +
" -OQ -QT 4" +
" -o %s -ob %s",
2,
Arrays.asList("55c01ccc2e84481b22d3632cdb06c8ba", "f9b1347fabbc33bb24f7c7fa8dfb798b"));
executeTest("clipOriginalQuals", spec);
}
}