Prevent NullPointerException in cases where SNP is filtered

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5641 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
fromer 2011-04-14 19:59:59 +00:00
parent ee94af3539
commit 8e0f5bc5a5
1 changed files with 12 additions and 10 deletions

View File

@ -73,7 +73,9 @@ public class ReadBasedPhasingValidationWalker extends RodWalker<Integer, Integer
private final static int NUM_IN_PAIR = 2; // trivial private final static int NUM_IN_PAIR = 2; // trivial
// enable deletions in the pileup // enable deletions in the pileup
public boolean includeReadsWithDeletionAtLoci() { return true; } public boolean includeReadsWithDeletionAtLoci() {
return true;
}
public void initialize() { public void initialize() {
rodNames = new LinkedList<String>(); rodNames = new LinkedList<String>();
@ -85,8 +87,7 @@ public class ReadBasedPhasingValidationWalker extends RodWalker<Integer, Integer
InputStream sitePairsStream = null; InputStream sitePairsStream = null;
try { try {
sitePairsStream = new FileInputStream(sitePairsFile); sitePairsStream = new FileInputStream(sitePairsFile);
} } catch (FileNotFoundException fnfe) {
catch (FileNotFoundException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
throw new UserException("Problem opening file: " + sitePairsFile); throw new UserException("Problem opening file: " + sitePairsFile);
} }
@ -96,8 +97,7 @@ public class ReadBasedPhasingValidationWalker extends RodWalker<Integer, Integer
String line = null; String line = null;
try { try {
line = sitePairsReader.readLine(); line = sitePairsReader.readLine();
} } catch (IOException ioe) {
catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
throw new UserException("Problem reading file: " + sitePairsFile); throw new UserException("Problem reading file: " + sitePairsFile);
} }
@ -261,12 +261,14 @@ public class ReadBasedPhasingValidationWalker extends RodWalker<Integer, Integer
System.out.println("% MATCHING reads: " + percentMatchingReads + " [of " + totalCount + " TOTAL reads]"); System.out.println("% MATCHING reads: " + percentMatchingReads + " [of " + totalCount + " TOTAL reads]");
out.print(sp); out.print(sp);
for (Haplotype hap : allPossibleHaplotypes) { if (allPossibleHaplotypes != null) {
Integer count = haplotypeCounts.get(hap); for (Haplotype hap : allPossibleHaplotypes) {
if (count == null) // haplotype may not have been observed in ANY reads Integer count = haplotypeCounts.get(hap);
count = 0; if (count == null) // haplotype may not have been observed in ANY reads
count = 0;
out.print("\t" + count); out.print("\t" + count);
}
} }
out.println(); out.println();
} }