}
private Genome doParsing(File genomeFile) throws IOException,
GenomeFileParsingException {
Genome genome = new Genome();
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(genomeFile));
while ((line = reader.readLine()) != null) {
lineNumber++;
if (line.startsWith("##")){
continue;
}
// chromosome, source, type, start, stop, score, strand, phase,
// attributes
String[] parts = line.split("\\t", 9);
if (parts.length < 9) {
// throw new
// GenomeFileParsingException("Line "+lineNumber+": not in expected format");
LOG.warn("Line " + lineNumber + ": not in expected format");
continue;
}
String type = parts[2];
if (type == null) {
continue;
}
if (GENE_RE.matcher(type).matches()) {
GeneInfo gene = parseGene(parts);
processGene(genome, gene);
} else if (SEQUENCE_RE.matcher(type).find()) {
GeneSequence sequence = parseSequence(parts);
processSequence(genome, parts[CHROMOSOME_PART], sequence);
}
}
} finally {
if (reader != null) {
reader.close();
}
}
genome.verify();
return genome;
}