Bringing in the changes from the CMI repo

This commit is contained in:
Mauricio Carneiro 2012-12-13 21:59:37 -05:00
commit 74344a3871
5 changed files with 113 additions and 108 deletions

View File

@ -17,6 +17,7 @@ public class ReduceReadsIntegrationTest extends WalkerTest {
final String COREDUCTION_BAM_A = validationDataLocation + "coreduction.test.A.bam"; final String COREDUCTION_BAM_A = validationDataLocation + "coreduction.test.A.bam";
final String COREDUCTION_BAM_B = validationDataLocation + "coreduction.test.B.bam"; final String COREDUCTION_BAM_B = validationDataLocation + "coreduction.test.B.bam";
final String COREDUCTION_L = " -L 1:1,853,860-1,854,354 -L 1:1,884,131-1,892,057"; final String COREDUCTION_L = " -L 1:1,853,860-1,854,354 -L 1:1,884,131-1,892,057";
final String OFFCONTIG_BAM = privateTestDir + "readOffb37contigMT.bam";
private void RRTest(String testName, String args, String md5) { private void RRTest(String testName, String args, String md5) {
String base = String.format("-T ReduceReads -npt -R %s -I %s ", REF, BAM) + " -o %s "; String base = String.format("-T ReduceReads -npt -R %s -I %s ", REF, BAM) + " -o %s ";
@ -86,5 +87,15 @@ public class ReduceReadsIntegrationTest extends WalkerTest {
executeTest("testCoReduction", new WalkerTestSpec(base, Arrays.asList("5c30fde961a1357bf72c15144c01981b"))); executeTest("testCoReduction", new WalkerTestSpec(base, Arrays.asList("5c30fde961a1357bf72c15144c01981b")));
} }
/**
* Bug happens when reads are soft-clipped off the contig (usually in the MT). This test guarantees no changes to the upstream code will
* break the current hard-clipping routine that protects reduce reads from such reads.
*/
@Test(enabled = true)
public void testReadOffContig() {
String base = String.format("-T ReduceReads -npt -R %s -I %s ", REF, OFFCONTIG_BAM) + " -o %s ";
executeTest("testReadOffContig", new WalkerTestSpec(base, Arrays.asList("53e16367d333da0b7d40a7683a35c95f")));
}
} }

View File

@ -397,9 +397,6 @@ public class GATKSAMRecord extends BAMRecord {
else if (op != CigarOperator.HARD_CLIP) else if (op != CigarOperator.HARD_CLIP)
break; break;
} }
if ( softStart < 1 )
softStart = 1;
} }
return softStart; return softStart;
} }

View File

@ -110,6 +110,9 @@ class QCommandLine extends CommandLineProgram with Logging {
* functions, and then builds and runs a QGraph based on the dependencies. * functions, and then builds and runs a QGraph based on the dependencies.
*/ */
def execute = { def execute = {
var success = false
var result = 1
try {
ClassFieldCache.parsingEngine = this.parser ClassFieldCache.parsingEngine = this.parser
if (settings.qSettings.runName == null) if (settings.qSettings.runName == null)
@ -166,7 +169,6 @@ class QCommandLine extends CommandLineProgram with Logging {
qGraph.run() qGraph.run()
val functionsAndStatus = qGraph.getFunctionsAndStatus val functionsAndStatus = qGraph.getFunctionsAndStatus
val success = qGraph.success
// walk over each script, calling onExecutionDone // walk over each script, calling onExecutionDone
for (script <- allQScripts) { for (script <- allQScripts) {
@ -180,14 +182,7 @@ class QCommandLine extends CommandLineProgram with Logging {
logger.info("Writing final jobs report...") logger.info("Writing final jobs report...")
qGraph.writeJobsReport() qGraph.writeJobsReport()
if (!success) { if (qGraph.success) {
logger.info("Done with errors")
qGraph.logFailed()
for (commandPlugin <- allCommandPlugins)
if (commandPlugin.statusMessenger != null)
commandPlugin.statusMessenger.exit("Done with errors: %s".format(qGraph.formattedStatusCounts))
1
} else {
if (settings.run) { if (settings.run) {
allQScripts.foreach(_.pushOutputs()) allQScripts.foreach(_.pushOutputs())
for (commandPlugin <- allCommandPlugins) for (commandPlugin <- allCommandPlugins)
@ -197,8 +192,21 @@ class QCommandLine extends CommandLineProgram with Logging {
commandPlugin.statusMessenger.done(allInputs, allOutputs) commandPlugin.statusMessenger.done(allInputs, allOutputs)
} }
} }
0 success = true
result = 0
} }
} finally {
if (!success) {
logger.info("Done with errors")
qGraph.logFailed()
if (settings.run) {
for (commandPlugin <- allCommandPlugins)
if (commandPlugin.statusMessenger != null)
commandPlugin.statusMessenger.exit("Done with errors: %s".format(qGraph.formattedStatusCounts))
}
}
}
result
} }
/** /**

View File

@ -124,7 +124,7 @@ trait QScript extends Logging with PrimitiveOptionConversions with StringFileCon
} }
/** /**
* Pull all remote files to the local disk. * Pull all remote files to the local disk
*/ */
def pullInputs() { def pullInputs() {
val inputs = ClassFieldCache.getFieldFiles(this, inputFields) val inputs = ClassFieldCache.getFieldFiles(this, inputFields)
@ -135,7 +135,7 @@ trait QScript extends Logging with PrimitiveOptionConversions with StringFileCon
} }
/** /**
* Push all remote files from the local disk. * Push all remote files from the local disk
*/ */
def pushOutputs() { def pushOutputs() {
val outputs = ClassFieldCache.getFieldFiles(this, outputFields) val outputs = ClassFieldCache.getFieldFiles(this, outputFields)
@ -145,28 +145,17 @@ trait QScript extends Logging with PrimitiveOptionConversions with StringFileCon
} }
} }
/**
* List out the remote outputs
* @return the RemoteFile outputs by argument source
*/
def remoteInputs: Map[String, Seq[RemoteFile]] = tagMap(remoteFieldMap(inputFields))
/**
* List out the remote outputs
* @return the RemoteFile outputs by argument source
*/
def remoteOutputs: Map[String, Seq[RemoteFile]] = tagMap(remoteFieldMap(outputFields))
private def tagMap(remoteFieldMap: Map[ArgumentSource, Seq[RemoteFile]]): Map[String, Seq[RemoteFile]] = {
remoteFieldMap.collect{ case (k, v) => ClassFieldCache.fullName(k) -> v }.toMap
}
private def remoteFieldMap(fields: Seq[ArgumentSource]): Map[ArgumentSource, Seq[RemoteFile]] = {
fields.map(field => (field -> filterRemoteFiles(ClassFieldCache.getFieldFiles(this, field)))).filter(tuple => !tuple._2.isEmpty).toMap
}
private def filterRemoteFiles(fields: Seq[File]): Seq[RemoteFile] = private def filterRemoteFiles(fields: Seq[File]): Seq[RemoteFile] =
fields.filter(field => field != null && field.isInstanceOf[RemoteFile]).map(_.asInstanceOf[RemoteFile]) fields.filter(field => field != null && field.isInstanceOf[RemoteFile]).map(_.asInstanceOf[RemoteFile])
/**
* @return the inputs or null if there are no inputs
*/
def remoteInputs: AnyRef = null
/**
* @return the outputs or null if there are no outputs
*/
def remoteOutputs: AnyRef = null
/** The complete list of fields. */ /** The complete list of fields. */
def functionFields: Seq[ArgumentSource] = ClassFieldCache.classFunctionFields(this.getClass) def functionFields: Seq[ArgumentSource] = ClassFieldCache.classFunctionFields(this.getClass)

View File

@ -7,7 +7,7 @@ import org.broadinstitute.sting.queue.util.RemoteFile
*/ */
trait QStatusMessenger { trait QStatusMessenger {
def started() def started()
def done(inputs: Seq[Map[String, Seq[RemoteFile]]], outputs: Seq[Map[String, Seq[RemoteFile]]]) def done(inputs: Seq[_], outputs: Seq[_])
def exit(message: String) def exit(message: String)
def started(job: String) def started(job: String)