A cleaner interface: now everyone can use UG's initialize method

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1860 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-10-16 14:09:16 +00:00
parent 96972c3a5c
commit 418e007ca6
5 changed files with 21 additions and 26 deletions

View File

@ -85,13 +85,27 @@ public class UnifiedGenotyper extends LocusWalker<Pair<List<GenotypeCall>, Genot
/**
* Initialize the samples, output, and genotype calculation model
*
* *** OTHER WALKERS SHOULD NOT CALL THIS METHOD. USE initializePublic() INSTEAD! ***
*
**/
public void initialize() {
initializePublic();
// get all of the unique sample names
samples = new HashSet<String>();
List<SAMReadGroupRecord> readGroups = getToolkit().getSAMFileHeader().getReadGroups();
for ( SAMReadGroupRecord readGroup : readGroups )
samples.add(readGroup.getSample());
// print them out for debugging (need separate loop to ensure uniqueness)
for ( String sample : samples )
logger.debug("SAMPLE: " + sample);
gcm = GenotypeCalculationModelFactory.makeGenotypeCalculation(samples, logger, UAC);
// *** If we were called by another walker, then we don't ***
// *** want to do any of the other initialization steps. ***
if ( VARIANTS_FILE == null && out == null )
return;
// if we got here, then we were instantiated by the GATK engine
calledByAnotherWalker = false;
// create the output writer stream
@ -107,25 +121,6 @@ public class UnifiedGenotyper extends LocusWalker<Pair<List<GenotypeCall>, Genot
callsMetrics = new CallMetrics();
}
/**
* This method should be called by other walkers wanting to use the UnifiedGenotyper.
* If the regular initialize() method is called, subsequent calls to map() may result in
* exceptions being thrown.
*/
public void initializePublic() {
// get all of the unique sample names
samples = new HashSet<String>();
List<SAMReadGroupRecord> readGroups = getToolkit().getSAMFileHeader().getReadGroups();
for ( SAMReadGroupRecord readGroup : readGroups )
samples.add(readGroup.getSample());
// print them out for debugging (need separate loop to ensure uniqueness)
for ( String sample : samples )
logger.debug("SAMPLE: " + sample);
gcm = GenotypeCalculationModelFactory.makeGenotypeCalculation(samples, logger, UAC);
}
/**
* Compute at a given locus.
*

View File

@ -41,7 +41,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker<Referen
public void initialize() {
ug = new UnifiedGenotyper();
ug.initializePublic();
ug.initialize();
refWindow = new ReferenceContextWindow(nPreviousBases);
}

View File

@ -41,7 +41,7 @@ public class CoverageEvalWalker extends LocusWalker<List<String>, String> {
public void initialize() {
UG = new UnifiedGenotyper();
UG.initializePublic();
UG.initialize();
String header = "#Sequence Position ReferenceBase NumberOfReads MaxMappingQuality BestGenotype BtrLod BtnbLod AA AC AG AT CC CG CT GG GT TT";
out.println("DownsampledCoverage\tAvailableCoverage\tHapmapChipGenotype\tGenotypeCallType\t"+header.substring(1));

View File

@ -37,7 +37,7 @@ public class DeNovoSNPWalker extends RefWalker<String, Integer>{
public void initialize() {
UG = new UnifiedGenotyper();
UG.initializePublic();
UG.initialize();
readGroupSets = getToolkit().getMergedReadGroupsByReaders();
}

View File

@ -74,7 +74,7 @@ public class ArtificialPoolContext {
}
public void initializeUG() {
ug.initializePublic();
ug.initialize();
}
public void setReadGroupSets(List<Set<String>> rgSets) {