Fixing bug that's not caught by integration tests:

If the first eval seen has one or more no-calls, then that's the 2N chromosome count that gets set as the max for the metrics.  Instead, just check that any eval's no-call count is 0.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3255 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-04-26 02:40:34 +00:00
parent 29ab59a7b3
commit f5a3b128c8
1 changed files with 6 additions and 8 deletions

View File

@ -78,12 +78,10 @@ public class SimpleMetricsByAC extends VariantEvaluator {
}
class MetricsByAc implements TableType {
int nchromosomes = -1;
ArrayList<MetricsAtAC> metrics = new ArrayList<MetricsAtAC>();
Object[] rows = null;
public MetricsByAc( int nchromosomes ) {
this.nchromosomes = nchromosomes;
rows = new Object[nchromosomes+1];
metrics = new ArrayList<MetricsAtAC>(nchromosomes+1);
for ( int i = 0; i < nchromosomes + 1; i++ ) {
@ -115,11 +113,8 @@ public class SimpleMetricsByAC extends VariantEvaluator {
}
public void incrValue( VariantContext eval ) {
int an = eval.getChromosomeCount();
if ( an == nchromosomes ) { // ignore sites with no calls
int ac = eval.getChromosomeCount(eval.getAlternateAllele(0));
metrics.get(ac).update(eval);
}
int ac = eval.getChromosomeCount(eval.getAlternateAllele(0));
metrics.get(ac).update(eval);
}
}
@ -146,7 +141,10 @@ public class SimpleMetricsByAC extends VariantEvaluator {
public String update1(VariantContext eval, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
final String interesting = null;
if (eval != null && eval.isSNP() && eval.hasGenotypes() ) {
if (eval != null &&
eval.isSNP() &&
eval.hasGenotypes() &&
eval.getNoCallCount() == 0 ) {
if ( metrics == null )
metrics = new MetricsByAc(2 * eval.getNSamples());
metrics.incrValue(eval);