Fix for concordance: samples found only in truth no longer kill it.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3160 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
8573b0bc6f
commit
0b575596f8
|
|
@ -5,7 +5,6 @@ import org.broadinstitute.sting.gatk.refdata.*;
|
||||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.*;
|
import org.broadinstitute.sting.gatk.contexts.variantcontext.*;
|
||||||
import org.broadinstitute.sting.playground.utils.report.tags.Analysis;
|
import org.broadinstitute.sting.playground.utils.report.tags.Analysis;
|
||||||
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
import org.broadinstitute.sting.playground.utils.report.tags.DataPoint;
|
||||||
import org.broadinstitute.sting.playground.utils.report.tags.Param;
|
|
||||||
import org.broadinstitute.sting.playground.utils.report.utils.TableType;
|
import org.broadinstitute.sting.playground.utils.report.utils.TableType;
|
||||||
import org.broadinstitute.sting.utils.StingException;
|
import org.broadinstitute.sting.utils.StingException;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -369,9 +368,10 @@ class SampleStats implements TableType {
|
||||||
* @param called the called type
|
* @param called the called type
|
||||||
*/
|
*/
|
||||||
public void incrValue(String sample, Genotype.Type truth, Genotype.Type called) {
|
public void incrValue(String sample, Genotype.Type truth, Genotype.Type called) {
|
||||||
if (!concordanceStats.containsKey(sample))
|
if ( concordanceStats.containsKey(sample) )
|
||||||
|
concordanceStats.get(sample)[truth.ordinal()][called.ordinal()]++;
|
||||||
|
else if ( called != Genotype.Type.NO_CALL )
|
||||||
throw new StingException("Sample " + sample + " has not been seen in a previous eval; this analysis module assumes that all samples are present in each variant context");
|
throw new StingException("Sample " + sample + " has not been seen in a previous eval; this analysis module assumes that all samples are present in each variant context");
|
||||||
concordanceStats.get(sample)[truth.ordinal()][called.ordinal()]++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -398,19 +398,20 @@ class SampleStats implements TableType {
|
||||||
Genotype.Type type = Genotype.Type.values()[(y/6)+1]; // get the row type
|
Genotype.Type type = Genotype.Type.values()[(y/6)+1]; // get the row type
|
||||||
// save some repeat work, get the total every time
|
// save some repeat work, get the total every time
|
||||||
long total = 0;
|
long total = 0;
|
||||||
|
Object[] rowKeys = getRowKeys();
|
||||||
for (int called = 0; called < nGenotypeTypes; called++)
|
for (int called = 0; called < nGenotypeTypes; called++)
|
||||||
total += concordanceStats.get((String) getRowKeys()[x])[type.ordinal()][called];
|
total += concordanceStats.get(rowKeys[x])[type.ordinal()][called];
|
||||||
|
|
||||||
// now get the cell they're interested in
|
// now get the cell they're interested in
|
||||||
switch (y % 6) {
|
switch (y % 6) {
|
||||||
case (0): // get the total_true for this type
|
case (0): // get the total_true for this type
|
||||||
return total;
|
return total;
|
||||||
case (1):
|
case (1):
|
||||||
return concordanceStats.get((String)getRowKeys()[x])[type.ordinal()][type.ordinal()];
|
return concordanceStats.get(rowKeys[x])[type.ordinal()][type.ordinal()];
|
||||||
case (2):
|
case (2):
|
||||||
return total == 0 ? 0.0 : (100.0 * (double) concordanceStats.get((String)getRowKeys()[x])[type.ordinal()][type.ordinal()] / (double) total);
|
return total == 0 ? 0.0 : (100.0 * (double) concordanceStats.get(rowKeys[x])[type.ordinal()][type.ordinal()] / (double) total);
|
||||||
default:
|
default:
|
||||||
return concordanceStats.get((String)getRowKeys()[x])[type.ordinal()][(y % 6) - 3];
|
return concordanceStats.get(rowKeys[x])[type.ordinal()][(y % 6) - 3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue