break;
}
index.species.add(line.trim());
}
IntervalTree iv = null;
while ((line = br.readLine()) != null) {
if (line.trim().length() == 0) continue;
if (line.startsWith("#chr=")) {
String chr = ParsingUtils.EQ_PATTERN.split(line)[1];
iv = new IntervalTree();
index.putIntervalTree(chr, iv);
} else if (iv != null) {
String[] info = Globals.tabPattern.split(line);
int start = Integer.parseInt(info[0]);
int end = Integer.parseInt(info[1]) + start;
long offset = Long.parseLong(info[2]);
iv.insert(new Interval(start, end, offset));
} else {
// log.info("Skipping line " + line);
}
}
} else {
// A "legacy" index, created for Broad hosted files that are separated by chromosome.
// Every alignment is indexed, which is overkill. Below we lump them into blocks of 50.
IntervalTree iv = new IntervalTree();
int l = 0;
int intervalStart = 0;
int intervalEnd = 0;
long lastOffset = 0;
while ((line = br.readLine()) != null) {
String[] info = Globals.tabPattern.split(line);
int start = Integer.parseInt(info[0]);
intervalEnd = Integer.parseInt(info[1]) + start;
if (l % 50 == 0) {
iv.insert(new Interval(intervalStart, intervalEnd, lastOffset));
intervalStart = intervalEnd;
lastOffset = Long.parseLong(info[2]);
}
l++;
}
if(intervalEnd > intervalStart) {
iv.insert(new Interval(intervalStart, intervalEnd, lastOffset));
}
index.putIntervalTree("*", iv);
}
} finally {