now uses the new RMDT getVariantContext() functions instead of doing the work itself.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2802 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
33760834d6
commit
995d55da81
|
|
@ -37,6 +37,8 @@ public class CountVariants extends VariantEvaluator {
|
||||||
return "counter";
|
return "counter";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean enabled() { return true; }
|
||||||
|
|
||||||
public int getComparisonOrder() {
|
public int getComparisonOrder() {
|
||||||
return 1; // we only need to see each eval track
|
return 1; // we only need to see each eval track
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,8 @@ public class DbSNPPercentage extends VariantEvaluator {
|
||||||
return HEADER;
|
return HEADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean enabled() { return true; }
|
||||||
|
|
||||||
public List<List<String>> getTableRows() {
|
public List<List<String>> getTableRows() {
|
||||||
return Arrays.asList(Arrays.asList(summaryLine().split(" ")));
|
return Arrays.asList(Arrays.asList(summaryLine().split(" ")));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ public class MendelianViolationEvaluator extends VariantEvaluator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean enabled() {
|
public boolean enabled() {
|
||||||
return parent.FAMILY_STRUCTURE != null;
|
return parent.FAMILY_STRUCTURE != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ public class TiTvVariantEvaluator extends VariantEvaluator {
|
||||||
// don't do anything
|
// don't do anything
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean enabled() { return true; }
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "titv";
|
return "titv";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
// todo -- new contexts for each comparison object too!
|
// todo -- new contexts for each comparison object too!
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// todo -- write or find a simple way to organize the table like output of variant eval 2. A generic table of strings?
|
||||||
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test routine for new VariantContext object
|
* Test routine for new VariantContext object
|
||||||
*/
|
*/
|
||||||
|
|
@ -205,22 +209,24 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
|
||||||
boolean evalWantsVC = applyVCtoEvaluation(evaluationName, vc, comps, group);
|
boolean evalWantsVC = applyVCtoEvaluation(evaluationName, vc, comps, group);
|
||||||
|
|
||||||
for ( VariantEvaluator evaluation : evaluations ) {
|
for ( VariantEvaluator evaluation : evaluations ) {
|
||||||
// we always call update0 in case the evaluation tracks things like number of bases covered
|
if ( evaluation.enabled() ) {
|
||||||
evaluation.update0(tracker, ref, context);
|
// we always call update0 in case the evaluation tracks things like number of bases covered
|
||||||
|
evaluation.update0(tracker, ref, context);
|
||||||
|
|
||||||
// now call the single or paired update function
|
// now call the single or paired update function
|
||||||
switch ( evaluation.getComparisonOrder() ) {
|
switch ( evaluation.getComparisonOrder() ) {
|
||||||
case 1:
|
case 1:
|
||||||
if ( evalWantsVC && vc != null )
|
if ( evalWantsVC && vc != null )
|
||||||
evaluation.update1(vc, tracker, ref, context);
|
evaluation.update1(vc, tracker, ref, context);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
for ( VariantContext comp : comps.values() ) {
|
for ( VariantContext comp : comps.values() ) {
|
||||||
evaluation.update2( evalWantsVC ? vc : null, comp, tracker, ref, context);
|
evaluation.update2( evalWantsVC ? vc : null, comp, tracker, ref, context);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new StingException("BUG: Unexpected evaluation order " + evaluation);
|
throw new StingException("BUG: Unexpected evaluation order " + evaluation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -252,18 +258,6 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, VariantContext> getCompVariantContexts(RefMetaDataTracker tracker, AlignmentContext context) {
|
|
||||||
Map<String, VariantContext> comps = new HashMap<String, VariantContext>();
|
|
||||||
|
|
||||||
for ( String compName : compNames ) {
|
|
||||||
comps.put(compName, getVariantContext(compName, tracker, context));
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo -- remove me when the loop works correctly for comparisons of eval x comp for each comp
|
|
||||||
if ( comps.size() > 1 ) throw new StingException("VariantEval2 currently only supports comparisons of N eval tracks vs. a single comparison track. Yes, I know...");
|
|
||||||
return comps;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean vcIsKnown(VariantContext vc, Map<String, VariantContext> comps, String[] knownNames ) {
|
private boolean vcIsKnown(VariantContext vc, Map<String, VariantContext> comps, String[] knownNames ) {
|
||||||
for ( String knownName : knownNames ) {
|
for ( String knownName : knownNames ) {
|
||||||
VariantContext known = comps.get(knownName);
|
VariantContext known = comps.get(knownName);
|
||||||
|
|
@ -281,22 +275,20 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
|
||||||
//
|
//
|
||||||
//logger.info(String.format("Ignore second+ events at locus %s in rod %s => rec is %s", context.getLocation(), rodList.getName(), rec));
|
//logger.info(String.format("Ignore second+ events at locus %s in rod %s => rec is %s", context.getLocation(), rodList.getName(), rec));
|
||||||
|
|
||||||
private VariantContext getVariantContext(String name, RefMetaDataTracker tracker, AlignmentContext context) {
|
private Map<String, VariantContext> getCompVariantContexts(RefMetaDataTracker tracker, AlignmentContext context) {
|
||||||
if ( tracker != null ) {
|
Map<String, VariantContext> comps = new HashMap<String, VariantContext>();
|
||||||
RODRecordList<ReferenceOrderedDatum> rodList = tracker.getTrackData(name, null);
|
|
||||||
if ( rodList != null ) {
|
for ( String compName : compNames ) {
|
||||||
for ( ReferenceOrderedDatum rec : rodList.getRecords() ) {
|
comps.put(compName, getVariantContext(compName, tracker, context));
|
||||||
if ( rec.getLocation().getStart() == context.getLocation().getStart() ) {
|
|
||||||
VariantContext vc = VariantContextAdaptors.toVariantContext(name, rec);
|
|
||||||
if ( vc != null ) {
|
|
||||||
return vc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
// todo -- remove me when the loop works correctly for comparisons of eval x comp for each comp
|
||||||
|
if ( comps.size() > 1 ) throw new StingException("VariantEval2 currently only supports comparisons of N eval tracks vs. a single comparison track. Yes, I know...");
|
||||||
|
return comps;
|
||||||
|
}
|
||||||
|
|
||||||
|
private VariantContext getVariantContext(String name, RefMetaDataTracker tracker, AlignmentContext context) {
|
||||||
|
return tracker.getVariantContext(name, null, context.getLocation(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------
|
||||||
|
|
@ -374,14 +366,16 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
|
||||||
Set<VariantEvaluator> evalSet = group.get(evalSubgroupName);
|
Set<VariantEvaluator> evalSet = group.get(evalSubgroupName);
|
||||||
VariantEvaluator eval = getEvalByName(evalName, evalSet);
|
VariantEvaluator eval = getEvalByName(evalName, evalSet);
|
||||||
String keyWord = contextName + "." + evalSubgroupName;
|
String keyWord = contextName + "." + evalSubgroupName;
|
||||||
|
if ( eval.enabled() ) {
|
||||||
|
|
||||||
if ( first ) {
|
if ( first ) {
|
||||||
out.printf("%20s %s %s%n", evalName, formatKeyword(CONTEXT_HEADER), Utils.join("\t", eval.getTableHeader()));
|
out.printf("%20s %s %s%n", evalName, formatKeyword(CONTEXT_HEADER), Utils.join("\t", eval.getTableHeader()));
|
||||||
first = false;
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( List<String> row : eval.getTableRows() )
|
||||||
|
out.printf("%20s %s %s%n", evalName, formatKeyword(keyWord), Utils.join("\t", row));
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( List<String> row : eval.getTableRows() )
|
|
||||||
out.printf("%20s %s %s%n", evalName, formatKeyword(keyWord), Utils.join("\t", row));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,9 @@ abstract class VariantEvaluator {
|
||||||
System.out.printf("%40s %s%n", interestingSitePrefix, why);
|
System.out.printf("%40s %s%n", interestingSitePrefix, why);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean processedAnySites() { return processedASite; }
|
public abstract boolean enabled();
|
||||||
protected void markSiteAsProcessed() { processedASite = true; }
|
//public boolean processedAnySites() { return processedASite; }
|
||||||
|
//protected void markSiteAsProcessed() { processedASite = true; }
|
||||||
|
|
||||||
/** Should return the number of VariantContexts expected as inputs to update. Can be 1 or 2 */
|
/** Should return the number of VariantContexts expected as inputs to update. Can be 1 or 2 */
|
||||||
public abstract int getComparisonOrder();
|
public abstract int getComparisonOrder();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue