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:
parent
29ab59a7b3
commit
f5a3b128c8
|
|
@ -78,12 +78,10 @@ public class SimpleMetricsByAC extends VariantEvaluator {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MetricsByAc implements TableType {
|
class MetricsByAc implements TableType {
|
||||||
int nchromosomes = -1;
|
|
||||||
ArrayList<MetricsAtAC> metrics = new ArrayList<MetricsAtAC>();
|
ArrayList<MetricsAtAC> metrics = new ArrayList<MetricsAtAC>();
|
||||||
Object[] rows = null;
|
Object[] rows = null;
|
||||||
|
|
||||||
public MetricsByAc( int nchromosomes ) {
|
public MetricsByAc( int nchromosomes ) {
|
||||||
this.nchromosomes = nchromosomes;
|
|
||||||
rows = new Object[nchromosomes+1];
|
rows = new Object[nchromosomes+1];
|
||||||
metrics = new ArrayList<MetricsAtAC>(nchromosomes+1);
|
metrics = new ArrayList<MetricsAtAC>(nchromosomes+1);
|
||||||
for ( int i = 0; i < nchromosomes + 1; i++ ) {
|
for ( int i = 0; i < nchromosomes + 1; i++ ) {
|
||||||
|
|
@ -115,11 +113,8 @@ public class SimpleMetricsByAC extends VariantEvaluator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrValue( VariantContext eval ) {
|
public void incrValue( VariantContext eval ) {
|
||||||
int an = eval.getChromosomeCount();
|
int ac = eval.getChromosomeCount(eval.getAlternateAllele(0));
|
||||||
if ( an == nchromosomes ) { // ignore sites with no calls
|
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) {
|
public String update1(VariantContext eval, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||||
final String interesting = null;
|
final String interesting = null;
|
||||||
|
|
||||||
if (eval != null && eval.isSNP() && eval.hasGenotypes() ) {
|
if (eval != null &&
|
||||||
|
eval.isSNP() &&
|
||||||
|
eval.hasGenotypes() &&
|
||||||
|
eval.getNoCallCount() == 0 ) {
|
||||||
if ( metrics == null )
|
if ( metrics == null )
|
||||||
metrics = new MetricsByAc(2 * eval.getNSamples());
|
metrics = new MetricsByAc(2 * eval.getNSamples());
|
||||||
metrics.incrValue(eval);
|
metrics.incrValue(eval);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue