
org.snpeff.probablility.bootstrap.ReSampleMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SnpEff Show documentation
Show all versions of SnpEff Show documentation
Variant annotation and effect prediction package.
The newest version!
package org.snpeff.probablility.bootstrap;
import java.util.Collection;
import java.util.HashMap;
/**
* Resample statistic
*
* @author pablocingolani
*/
public class ReSampleMap extends ReSampleInt {
HashMap scoreByName; // All name-score relations
public ReSampleMap(HashMap scoresByName, int sampleSize) {
super(null, sampleSize);
scoreByName = scoresByName;
// Initialize scores array
int i = 0;
scores = new int[scoresByName.size()];
for( Integer score : scoresByName.values() )
scores[i++] = score;
}
public int score(Collection names) {
int sum = 0;
for( String name : names ) {
if( scoreByName.get(name) == null ) throw new RuntimeException("Error: Entry '" + name + "' not found!");
sum += scoreByName.get(name);
}
return sum;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy