end = Integer.parseInt(tokens[1]);
} catch (Exception e) {
System.err.println("Error parsing definition string");
}
SamPositionIterator position_iterator = new SamPositionIterator(INPUT, MINIMUM_COVERAGE, MAXIMUM_COVERAGE, MINIMUM_MAPQ, MIN_MATE_DISTANCE, MAX_MATE_DISTANCE, MINIMUM_BASE_QUALITY, MIN_ALIGNMENT_SCORE, seq_name, start, end);
positionIterators.add(position_iterator);
}
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
} else if (REGION.equals("")) {
SamPositionIterator position_iterator = new SamPositionIterator(INPUT, MINIMUM_COVERAGE, MAXIMUM_COVERAGE, MINIMUM_MAPQ, MIN_MATE_DISTANCE, MAX_MATE_DISTANCE, MINIMUM_BASE_QUALITY, MIN_ALIGNMENT_SCORE);
positionIterators.add(position_iterator);
} else {
//split the region string into sequence name/beginning/end
String[] tokens = REGION.split(",");
int start = 0, end = 0;
try {
start = Integer.parseInt(tokens[1]);
end = Integer.parseInt(tokens[2]);
} catch (Exception e) {
System.err.println("Error parsing definition string");
}
SamPositionIterator position_iterator = new SamPositionIterator(INPUT, MINIMUM_COVERAGE, MAXIMUM_COVERAGE, MINIMUM_MAPQ, MIN_MATE_DISTANCE, MAX_MATE_DISTANCE, MINIMUM_BASE_QUALITY, MIN_ALIGNMENT_SCORE, tokens[0], start, end);
positionIterators.add(position_iterator);
}
SolSNPCaller s = new SolSNPCaller(STRAND_MODE, CALL_BIAS, PLOIDY);
SNPCall SNP = new SNPCall();
SNPCall known_call = new SNPCall();
int coverage;
int previous_position = 0;
final Map<SNPCallPair, TreeMap<Integer, Long>> calltable_validation = new HashMap<SNPCallPair, TreeMap<Integer, Long>>();
ReferenceSequence reference = null;
while ((reference = reference_file.nextSequence()) != null) {
for (SamPositionIterator position_iterator : positionIterators) {
position_iterator.nextSequence();
String ref_name = reference.getName();
if (!position_iterator.getCurrentSequence().equals(ref_name))
continue;
System.out.println("Processing reads on sequence " + ref_name);
byte[] ref_array = reference.getBases();
// Iterate through loci with enough coverage
while (position_iterator.hasMoreElements()) {
PositionInfo p = position_iterator.nextElement();
int curp;
if (p == null)
curp = ref_array.length;
else {