Now that VCFGenotypeRecords implement SampleBacked (as they should), a quick fix was needed to get the GenotypeConcordance working when no direct samples were provided in a samples file.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2348 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-12-14 04:27:16 +00:00
parent bd7b07f3f1
commit c7b23d6ca5
3 changed files with 16 additions and 13 deletions

View File

@ -88,11 +88,8 @@ public abstract class ChipConcordance extends BasicVariantAnalysis {
}
}
// don't procede if we have no truth data and no call
if ( eval != null || chips.size() > 0 )
return inc(chips, eval, ref);
else
return null;
// evaluate only if we have truth data or a call
return ( eval != null || chips.size() > 0 ) ? inc(chips, eval, ref) : null;
}
public String inc(Map<String, Genotype> chips, Variation eval, char ref) {

View File

@ -16,8 +16,12 @@ import java.util.*;
*/
public class GenotypeConcordance extends ChipConcordance implements GenotypeAnalysis {
private String providedChipName = null;
public GenotypeConcordance(final String chipName, boolean chipNameIsFile) {
super("genotype_concordance", chipName, chipNameIsFile);
if ( !chipNameIsFile )
providedChipName = chipName;
}
protected void assertVariationIsValid(Variation eval) {
@ -44,7 +48,9 @@ public class GenotypeConcordance extends ChipConcordance implements GenotypeAnal
// associate each Genotype with the appropriate sample
for ( Genotype eval : evals ) {
if ( eval instanceof SampleBacked )
if ( providedChipName != null )
hash.put(providedChipName, eval);
else if ( eval instanceof SampleBacked )
hash.put(((SampleBacked)eval).getSampleName(), eval);
else if ( rodNames.size() == 1 )
hash.put(rodNames.get(0), eval);

View File

@ -51,7 +51,7 @@ public class VariantEvalWalker extends RefWalker<Integer, Integer> {
@Argument(fullName = "numPeopleInPool", shortName="PS", doc="If using a variant file from a pooled caller, this field provides the number of individuals in each pool", required=false)
public int numPeopleInPool = -1;
@Argument(fullName = "samplesFile", shortName="samples", doc="When running an analysis on a number of individuals with truth data, this field provides a filepath to the listing of which samples are used (and are used to name corresponding rods with -B)", required=false)
@Argument(fullName = "samplesFile", shortName="samples", doc="When running an analysis on one or more individuals with truth data, this field provides a filepath to the listing of which samples are used (and are used to name corresponding rods with -B)", required=false)
public String samplesFile = null;
String analysisFilenameBase = null;
@ -130,13 +130,13 @@ public class VariantEvalWalker extends RefWalker<Integer, Integer> {
analyses.add(new VariantCounter());
analyses.add(new VariantDBCoverage(knownSNPDBName));
//analyses.add(new PooledFrequencyAnalysis(numPeopleInPool,knownSNPDBName));
if ( samplesFile == null )
if ( samplesFile != null ) {
if ( numPeopleInPool < 1 )
analyses.add(new GenotypeConcordance(samplesFile, true));
else
analyses.add(new PooledConcordance(samplesFile, true));
} else {
analyses.add(new GenotypeConcordance(genotypeChipName, false));
else if ( numPeopleInPool < 1)
analyses.add(new GenotypeConcordance(samplesFile, true));
else {
analyses.add(new PooledConcordance(samplesFile,true));
}
analyses.add(new TransitionTranversionAnalysis());
analyses.add(new NeighborDistanceAnalysis());