GenotypeConcordance now prints interesting sites more nicely. RMDTrackBuilder is now uses the root class FeatureSource not BasicFeatureSource.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4525 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
7a291a8ff3
commit
f7ce18553e
|
|
@ -27,7 +27,6 @@ import net.sf.samtools.SAMSequenceDictionary;
|
||||||
import net.sf.samtools.util.CloseableIterator;
|
import net.sf.samtools.util.CloseableIterator;
|
||||||
import org.broad.tribble.FeatureCodec;
|
import org.broad.tribble.FeatureCodec;
|
||||||
import org.broad.tribble.FeatureSource;
|
import org.broad.tribble.FeatureSource;
|
||||||
import org.broad.tribble.source.BasicFeatureSource;
|
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.FeatureToGATKFeatureIterator;
|
import org.broadinstitute.sting.gatk.refdata.utils.FeatureToGATKFeatureIterator;
|
||||||
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
|
@ -55,7 +54,7 @@ public class RMDTrack {
|
||||||
private final File file; // the associated file we create the reader from
|
private final File file; // the associated file we create the reader from
|
||||||
|
|
||||||
// our feature reader - allows queries
|
// our feature reader - allows queries
|
||||||
private BasicFeatureSource reader;
|
private FeatureSource reader;
|
||||||
|
|
||||||
// our sequence dictionary, which can be null
|
// our sequence dictionary, which can be null
|
||||||
private final SAMSequenceDictionary dictionary;
|
private final SAMSequenceDictionary dictionary;
|
||||||
|
|
@ -102,7 +101,7 @@ public class RMDTrack {
|
||||||
* @param dict the sam sequence dictionary
|
* @param dict the sam sequence dictionary
|
||||||
* @param codec the feature codec we use to decode this type
|
* @param codec the feature codec we use to decode this type
|
||||||
*/
|
*/
|
||||||
public RMDTrack(Class type, String name, File file, BasicFeatureSource reader, SAMSequenceDictionary dict, FeatureCodec codec) {
|
public RMDTrack(Class type, String name, File file, FeatureSource reader, SAMSequenceDictionary dict, FeatureCodec codec) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.recordType = codec.getFeatureType();
|
this.recordType = codec.getFeatureType();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import org.broad.tribble.*;
|
||||||
import org.broad.tribble.index.Index;
|
import org.broad.tribble.index.Index;
|
||||||
import org.broad.tribble.index.IndexFactory;
|
import org.broad.tribble.index.IndexFactory;
|
||||||
import org.broad.tribble.source.BasicFeatureSource;
|
import org.broad.tribble.source.BasicFeatureSource;
|
||||||
|
import org.broad.tribble.source.CachingFeatureSource;
|
||||||
import org.broad.tribble.util.LittleEndianOutputStream;
|
import org.broad.tribble.util.LittleEndianOutputStream;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackCreationException;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackCreationException;
|
||||||
|
|
@ -121,7 +122,7 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
|
||||||
*/
|
*/
|
||||||
public RMDTrack createInstanceOfTrack(Class targetClass, String name, File inputFile) throws RMDTrackCreationException {
|
public RMDTrack createInstanceOfTrack(Class targetClass, String name, File inputFile) throws RMDTrackCreationException {
|
||||||
// return a feature reader track
|
// return a feature reader track
|
||||||
Pair<BasicFeatureSource, SAMSequenceDictionary> pair = createFeatureReader(targetClass, name, inputFile);
|
Pair<FeatureSource, SAMSequenceDictionary> pair = createFeatureReader(targetClass, name, inputFile);
|
||||||
if (pair == null) throw new UserException.CouldNotReadInputFile(inputFile, "Unable to make the feature reader for input file");
|
if (pair == null) throw new UserException.CouldNotReadInputFile(inputFile, "Unable to make the feature reader for input file");
|
||||||
return new RMDTrack(targetClass, name, inputFile, pair.first, pair.second, createCodec(targetClass, name));
|
return new RMDTrack(targetClass, name, inputFile, pair.first, pair.second, createCodec(targetClass, name));
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +133,7 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
|
||||||
* @param inputFile the input file, that corresponds to the feature type
|
* @param inputFile the input file, that corresponds to the feature type
|
||||||
* @return a pair of <BasicFeatureSource, SAMSequenceDictionary>
|
* @return a pair of <BasicFeatureSource, SAMSequenceDictionary>
|
||||||
*/
|
*/
|
||||||
public Pair<BasicFeatureSource, SAMSequenceDictionary> createFeatureReader(Class targetClass, File inputFile) {
|
public Pair<FeatureSource, SAMSequenceDictionary> createFeatureReader(Class targetClass, File inputFile) {
|
||||||
return createFeatureReader(targetClass, "anonymous", inputFile);
|
return createFeatureReader(targetClass, "anonymous", inputFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,8 +144,8 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
|
||||||
* @param inputFile the input file to create the track from (of the codec type)
|
* @param inputFile the input file to create the track from (of the codec type)
|
||||||
* @return the FeatureReader instance
|
* @return the FeatureReader instance
|
||||||
*/
|
*/
|
||||||
public Pair<BasicFeatureSource, SAMSequenceDictionary> createFeatureReader(Class targetClass, String name, File inputFile) {
|
public Pair<FeatureSource, SAMSequenceDictionary> createFeatureReader(Class targetClass, String name, File inputFile) {
|
||||||
Pair<BasicFeatureSource, SAMSequenceDictionary> pair;
|
Pair<FeatureSource, SAMSequenceDictionary> pair;
|
||||||
if (inputFile.getAbsolutePath().endsWith(".gz"))
|
if (inputFile.getAbsolutePath().endsWith(".gz"))
|
||||||
pair = createBasicFeatureSourceNoAssumedIndex(targetClass, name, inputFile);
|
pair = createBasicFeatureSourceNoAssumedIndex(targetClass, name, inputFile);
|
||||||
else
|
else
|
||||||
|
|
@ -162,11 +163,11 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
|
||||||
* @param inputFile the file to load
|
* @param inputFile the file to load
|
||||||
* @return a feature reader implementation
|
* @return a feature reader implementation
|
||||||
*/
|
*/
|
||||||
private Pair<BasicFeatureSource, SAMSequenceDictionary> createBasicFeatureSourceNoAssumedIndex(Class targetClass, String name, File inputFile) {
|
private Pair<FeatureSource, SAMSequenceDictionary> createBasicFeatureSourceNoAssumedIndex(Class targetClass, String name, File inputFile) {
|
||||||
// we might not know the index type, try loading with the default reader constructor
|
// we might not know the index type, try loading with the default reader constructor
|
||||||
logger.info("Attempting to blindly load " + inputFile + " as a tabix indexed file");
|
logger.info("Attempting to blindly load " + inputFile + " as a tabix indexed file");
|
||||||
try {
|
try {
|
||||||
return new Pair<BasicFeatureSource, SAMSequenceDictionary>(BasicFeatureSource.getFeatureSource(inputFile.getAbsolutePath(), createCodec(targetClass, name)),null);
|
return new Pair<FeatureSource, SAMSequenceDictionary>(BasicFeatureSource.getFeatureSource(inputFile.getAbsolutePath(), createCodec(targetClass, name)),null);
|
||||||
} catch (TribbleException e) {
|
} catch (TribbleException e) {
|
||||||
throw new UserException(e.getMessage(), e);
|
throw new UserException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -192,8 +193,8 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
|
||||||
* @param inputFile the tribble file to parse
|
* @param inputFile the tribble file to parse
|
||||||
* @return the input file as a FeatureReader
|
* @return the input file as a FeatureReader
|
||||||
*/
|
*/
|
||||||
private Pair<BasicFeatureSource, SAMSequenceDictionary> getFeatureSource(Class targetClass, String name, File inputFile) {
|
private Pair<FeatureSource, SAMSequenceDictionary> getFeatureSource(Class targetClass, String name, File inputFile) {
|
||||||
Pair<BasicFeatureSource, SAMSequenceDictionary> reader;
|
Pair<FeatureSource, SAMSequenceDictionary> reader;
|
||||||
try {
|
try {
|
||||||
Index index = loadIndex(inputFile, createCodec(targetClass, name));
|
Index index = loadIndex(inputFile, createCodec(targetClass, name));
|
||||||
try { logger.info(String.format(" Index for %s has size in bytes %d", inputFile, Sizeof.getObjectGraphSize(index))); }
|
try { logger.info(String.format(" Index for %s has size in bytes %d", inputFile, Sizeof.getObjectGraphSize(index))); }
|
||||||
|
|
@ -207,11 +208,10 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
|
||||||
setIndexSequenceDictionary(index,dict,indexFile,true);
|
setIndexSequenceDictionary(index,dict,indexFile,true);
|
||||||
dictFromIndex = getSequenceDictionaryFromProperties(index);
|
dictFromIndex = getSequenceDictionaryFromProperties(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
reader = new Pair<BasicFeatureSource, SAMSequenceDictionary>(new BasicFeatureSource(inputFile.getAbsolutePath(),
|
FeatureSource source = new BasicFeatureSource(inputFile.getAbsolutePath(), index, createCodec(targetClass, name));
|
||||||
index,
|
//source = new CachingFeatureSource(source, 100, 100000);
|
||||||
createCodec(targetClass, name)),
|
reader = new Pair<FeatureSource, SAMSequenceDictionary>(source, dictFromIndex);
|
||||||
dictFromIndex);
|
|
||||||
} catch (TribbleException e) {
|
} catch (TribbleException e) {
|
||||||
throw new UserException(e.getMessage());
|
throw new UserException(e.getMessage());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
|
|
@ -312,10 +312,10 @@ public class GenotypeConcordance extends VariantEvaluator implements StandardEva
|
||||||
} else {
|
} else {
|
||||||
truth = validation.getGenotype(sample).getType();
|
truth = validation.getGenotype(sample).getType();
|
||||||
// interesting = "ConcordanceStatus=FP";
|
// interesting = "ConcordanceStatus=FP";
|
||||||
if (discordantInteresting && truth.ordinal() != called.ordinal())
|
if (discordantInteresting && truth.ordinal() != called.ordinal())
|
||||||
{
|
{
|
||||||
interesting = "ConcordanceStatus=" + truth.ordinal() + "/" + called.ordinal();
|
interesting = "ConcordanceStatus=" + truth + "/" + called;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sampleStats.incrValue(sample, truth, called);
|
sampleStats.incrValue(sample, truth, called);
|
||||||
|
|
|
||||||
|
|
@ -84,9 +84,8 @@ public class XReadLines implements Iterator<String>, Iterable<String> {
|
||||||
* Creates a new xReadLines object to read lines from an input stream
|
* Creates a new xReadLines object to read lines from an input stream
|
||||||
*
|
*
|
||||||
* @param inputStream
|
* @param inputStream
|
||||||
* @throws FileNotFoundException
|
|
||||||
*/
|
*/
|
||||||
public XReadLines(final InputStream inputStream, final boolean trimWhitespace) throws FileNotFoundException {
|
public XReadLines(final InputStream inputStream, final boolean trimWhitespace) {
|
||||||
this(new BufferedReader(new InputStreamReader(inputStream)), trimWhitespace);
|
this(new BufferedReader(new InputStreamReader(inputStream)), trimWhitespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,9 +98,8 @@ public class XReadLines implements Iterator<String>, Iterable<String> {
|
||||||
* Creates a new xReadLines object to read lines from an bufferedReader
|
* Creates a new xReadLines object to read lines from an bufferedReader
|
||||||
*
|
*
|
||||||
* @param reader
|
* @param reader
|
||||||
* @throws FileNotFoundException
|
|
||||||
*/
|
*/
|
||||||
public XReadLines(final BufferedReader reader, final boolean trimWhitespace) throws FileNotFoundException {
|
public XReadLines(final BufferedReader reader, final boolean trimWhitespace) {
|
||||||
try {
|
try {
|
||||||
this.in = reader;
|
this.in = reader;
|
||||||
nextline = readNextLine();
|
nextline = readNextLine();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue