Source:
private Interval parseIntervalString(final String line, final SAMSequenceDictionary dict) { final int SEQUENCE_POS = 0; final int START_POS = 1; final int END_POS = 2; final int STRAND_POS = 3; final int NAME_POS = 4; final FormatUtil format = new FormatUtil(); final String[] fields = line.split("\t"); if (fields.length != 5) { throw new SAMException("Invalid interval record contains " + fields.length + " fields: " + line); } String seq = fields[SEQUENCE_POS]; if (seq.equals(lastSeq)) { seq = lastSeq; } lastSeq = seq; final int start = format.parseInt(fields[START_POS]); final int end = format.parseInt(fields[END_POS]); if (start < 1) { throw new IllegalArgumentException("Coordinate less than 1: start value of " + start + " is less than 1 and thus illegal"); } if (start > end + 1) { throw new IllegalArgumentException("Start value of " + start + " is greater than end + 1 for end of value: " + end + ". I'm afraid I cannot let you do that."); } final boolean negative; switch (fields[STRAND_POS]) { case "-": negative = true; break; case "+": negative = false; break; default: throw new IllegalArgumentException("Invalid strand field: " + fields[STRAND_POS]); } final String name = fields[NAME_POS]; final Interval interval = new Interval(seq, start, end, negative, name); final SAMSequenceRecord sequence = dict.getSequence(seq); if (sequence == null) { log.warn("Ignoring interval for unknown reference: " + interval); return null; } else { final int sequenceLength = sequence.getSequenceLength(); if (sequenceLength > 0 && sequenceLength < end) { throw new IllegalArgumentException("interval with end: " + end + " extends beyond end of sequence with length: " + sequenceLength); } return interval; } }

Target:
private Interval parseIntervalString(final String line, final SAMSequenceDictionary dict) { final int SEQUENCE_POS = 0; final int START_POS = 1; final int END_POS = 2; final int STRAND_POS = 3; final int NAME_POS = 4; final FormatUtil format = new FormatUtil(); final String[] fields = line.split("\t"); if (fields.length != 5) { throw new TribbleException("Invalid interval record contains " + fields.length + " fields: " + line); } String seq = fields[SEQUENCE_POS]; if (seq.equals(lastSeq)) { seq = lastSeq; } lastSeq = seq; final int start = format.parseInt(fields[START_POS]); final int end = format.parseInt(fields[END_POS]); if (start < 1) { throw new IllegalArgumentException("Coordinate less than 1: start value of " + start + " is less than 1 and thus illegal"); } if (start > end + 1) { throw new IllegalArgumentException("Start value of " + start + " is greater than end + 1 for end of value: " + end + ". I'm afraid I cannot let you do that."); } Strand strand = Strand.decode(fields[STRAND_POS]); if (strand==Strand.NONE) throw new IllegalArgumentException("Invalid strand field: " + fields[STRAND_POS]); final String name = fields[NAME_POS]; final Interval interval = new Interval(seq, start, end, strand==Strand.NEGATIVE, name); final SAMSequenceRecord sequence = dict.getSequence(seq); if (sequence == null) { log.warn("Ignoring interval for unknown reference: " + interval); return null; } else { final int sequenceLength = sequence.getSequenceLength(); if (sequenceLength > 0 && sequenceLength < end) { throw new IllegalArgumentException("interval with end: " + end + " extends beyond end of sequence with length: " + sequenceLength); } return interval; } }