Some checking to protect the BasicGenotype

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2509 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-01-06 14:53:24 +00:00
parent 71ecbe75d7
commit ec774f62be
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package org.broadinstitute.sting.utils.genotype;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.StingException;
import java.util.List;
@ -38,6 +40,12 @@ public class BasicGenotype implements Genotype {
*/
public BasicGenotype(GenomeLoc location, String genotype, char ref, double negLog10PError) {
mNegLog10PError = negLog10PError;
for ( char base : genotype.toCharArray() ) {
if (! ( BaseUtils.isRegularBase(base) || BaseUtils.isNBase((byte)base) ) )
throw new StingException(String.format("Unexpected base in Genotype at %s: '%s'", location, genotype));
}
mGenotype = genotype;
mLocation = location;
mRef = ref;