The previous commit broke the build, so this is a temporary patch to get it to compile. ConcordanceTruthTable should use enums (esp. now that all of the concordance variables need to be public), but VariantEval will need to be rewritten soon anyways so I'll just push it off until then.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2413 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-12-20 02:34:41 +00:00
parent ee8bcdc61d
commit a5f75cbfd4
2 changed files with 25 additions and 21 deletions

View File

@ -68,11 +68,11 @@ public class HapmapPoolAllelicInfoWalker extends LocusWalker<String, PrintWriter
long pos = loc.getStart();
char refBase = Character.toUpperCase(ref.getBase());
List<Pair<Genotype, Genotype>> chips = getChips(sampleNames, tracker);
Pair<Genotype,Pair<Integer,Integer>> alleleFreqInfo = ctt.getPooledAlleleFrequency(chips,refBase);
Pair<Integer,Pair<Integer,Integer>> alleleFreqInfo = ctt.getPooledAlleleFrequency(chips,refBase);
char alternate;
if ( alleleFreqInfo.getFirst() != null && alleleFreqInfo.getFirst().isVariant(refBase)) {
if ( alleleFreqInfo.first == ConcordanceTruthTable.VARIANT ) {
//System.out.println(refBase + " " + alleleFreqInfo.getFirst().getBases());
alternate = getAlternateBase(alleleFreqInfo.getFirst(),refBase);
alternate = getAlternateBase(chips,refBase);
} else {
return null; // early return
@ -96,8 +96,8 @@ public class HapmapPoolAllelicInfoWalker extends LocusWalker<String, PrintWriter
// sanity check
if ( refBase == alternate ) {
if ( alleleFreqInfo.getFirst().isVariant(refBase) ) {
logger.warn("Called as a variant! Ref: "+ refBase +"Chip data: " + alleleFreqInfo.getFirst().getBases());
if ( alleleFreqInfo.first == ConcordanceTruthTable.VARIANT ) {
;//logger.warn("Called as a variant! Ref: "+ refBase +"Chip data: " + alleleFreqInfo.getFirst().getBases());
}
}
@ -105,12 +105,16 @@ public class HapmapPoolAllelicInfoWalker extends LocusWalker<String, PrintWriter
}
public char getAlternateBase(Genotype g, char ref) {
char[] bases = g.getBases().toCharArray();
if ( Character.toUpperCase(bases[0]) != ref )
return bases[0];
else
return bases[1];
public char getAlternateBase(List<Pair<Genotype, Genotype>> chips, char ref) {
for ( Pair<Genotype, Genotype> chip : chips ) {
Genotype g = chip.first;
char[] bases = g.getBases().toCharArray();
if ( Character.toUpperCase(bases[0]) != ref )
return bases[0];
if ( Character.toUpperCase(bases[1]) != ref )
return bases[1];
}
return ref;
}
public PrintWriter reduce(String s, PrintWriter p) {

View File

@ -18,18 +18,18 @@ import java.util.*;
* the Broad Institute nor MIT can be responsible for its use, misuse, or functionality.
*/
public class ConcordanceTruthTable {
private static final int TRUE_POSITIVE = 0;
private static final int TRUE_NEGATIVE = 1;
private static final int FALSE_POSITIVE = 2;
private static final int FALSE_NEGATIVE = 3;
private static final int VARIANT = 1;
public static final int TRUE_POSITIVE = 0;
public static final int TRUE_NEGATIVE = 1;
public static final int FALSE_POSITIVE = 2;
public static final int FALSE_NEGATIVE = 3;
public static final int VARIANT = 1;
private static final String[] POOL_HEADERS = {"TP","TN","FP","FN"};
private static final int REF = 0;
private static final int VAR_HET = 1;
private static final int VAR_HOM = 2;
private static final int UNKNOWN = 3;
private static final int NO_CALL = 3; // synonym
public static final int REF = 0;
public static final int VAR_HET = 1;
public static final int VAR_HOM = 2;
public static final int UNKNOWN = 3;
public static final int NO_CALL = 3; // synonym
private static final String[] TRUTH_NAMES = {"IS_REF", "IS_VAR_HET", "IS_VAR_HOM", "UNKNOWN"};
private static final String[] CALL_NAMES = {"CALLED_REF", "CALLED_VAR_HET", "CALLED_VAR_HOM", "NO_CALL"};