CycleCovariate now tolerates SOLEXA as machine type. Also, exception handling is now written to stderr.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4274 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-09-14 12:35:57 +00:00
parent 71d2d69b41
commit dbb641280e
2 changed files with 20 additions and 5 deletions

View File

@ -337,10 +337,10 @@ public abstract class CommandLineProgram {
String formatted = String.format(format, s); String formatted = String.format(format, s);
if ( formatted.trim().equals("") ) if ( formatted.trim().equals("") )
System.out.println("##### ERROR"); System.err.println("##### ERROR");
else { else {
for ( String part : formatted.split("\n") ) { for ( String part : formatted.split("\n") ) {
System.out.println("##### ERROR " + part); System.err.println("##### ERROR " + part);
} }
} }
} }

View File

@ -5,6 +5,9 @@ import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.exceptions.UserException;
import java.util.Arrays;
import java.util.List;
/* /*
* Copyright (c) 2009 The Broad Institute * Copyright (c) 2009 The Broad Institute
* *
@ -156,6 +159,19 @@ public class CycleCovariate implements StandardCovariate {
} }
*/ */
// todo -- this should be put into a common place in the code base
private static List<String> ILLUMINA_NAMES = Arrays.asList("ILLUMINA", "SLX", "SOLEXA");
private static List<String> SOLID_NAMES = Arrays.asList("SOLID");
private static List<String> LS454_NAMES = Arrays.asList("454");
private static boolean isPlatform(SAMRecord read, List<String> names) {
String pl = read.getReadGroup().getPlatform().toUpperCase();
for ( String name : names )
if ( pl.contains( name ) )
return true;
return false;
}
// Used to pick out the covariate's value from attributes of the read // Used to pick out the covariate's value from attributes of the read
public void getValues(SAMRecord read, Comparable[] comparable) { public void getValues(SAMRecord read, Comparable[] comparable) {
@ -163,9 +179,8 @@ public class CycleCovariate implements StandardCovariate {
// ILLUMINA and SOLID // ILLUMINA and SOLID
//----------------------------- //-----------------------------
if( read.getReadGroup().getPlatform().equalsIgnoreCase( "ILLUMINA" ) || read.getReadGroup().getPlatform().equalsIgnoreCase( "SLX" ) || // Some bams have "illumina" and others have "SLX"
read.getReadGroup().getPlatform().equalsIgnoreCase( "SOLID" ) || read.getReadGroup().getPlatform().equalsIgnoreCase( "ABI_SOLID" )) { // Some bams have "solid" and others have "ABI_SOLID"
if( isPlatform(read, ILLUMINA_NAMES) || isPlatform(read, SOLID_NAMES) ) {
final int init; final int init;
final int increment; final int increment;
if( !read.getReadNegativeStrandFlag() ) { if( !read.getReadNegativeStrandFlag() ) {
@ -207,7 +222,7 @@ public class CycleCovariate implements StandardCovariate {
cycle += increment; cycle += increment;
} }
} }
else if( read.getReadGroup().getPlatform().contains( "454" ) ) { // Some bams have "LS454" and others have just "454" else if ( isPlatform(read, LS454_NAMES) ) { // Some bams have "LS454" and others have just "454"
final int readLength = read.getReadLength(); final int readLength = read.getReadLength();
final byte[] bases = read.getReadBases(); final byte[] bases = read.getReadBases();