diff --git a/uk/ac/sanger/artemis/io/IndexedGFFDocumentEntry.java b/uk/ac/sanger/artemis/io/IndexedGFFDocumentEntry.java index b9d517959c4cf510e3df1b1ee37e1411c8dcf509..8b5f9fe49c6b07bab2c7f6704d8ab8029712018a 100644 --- a/uk/ac/sanger/artemis/io/IndexedGFFDocumentEntry.java +++ b/uk/ac/sanger/artemis/io/IndexedGFFDocumentEntry.java @@ -106,15 +106,24 @@ public class IndexedGFFDocumentEntry implements DocumentEntry int cnt = 0; while( (ln = in.readLine()) != null && ln.startsWith("#")) { + // ##sequence-region seqid start end if(ln.startsWith("##sequence-region ")) { logger4j.debug(ln); final String parts[] = ln.split(" "); - //sequenceNames[cnt++] = parts[1]; - contigHash.put(parts[1], new IndexContig(parts[1], 1, Integer.parseInt(parts[3]), offset)); - offset+=Integer.parseInt(parts[3]); - cnt++; + try + { + contigHash.put(parts[1], new IndexContig(parts[1], 1, Integer.parseInt(parts[3]), offset)); + offset+=Integer.parseInt(parts[3]); + cnt++; + } + catch(Exception ae) + { + contigHash.clear(); + cnt = 0; + break; + } } } in.close(); @@ -289,7 +298,12 @@ public class IndexedGFFDocumentEntry implements DocumentEntry if(!combinedReference) { if(contig != null) - list.add(contigHash.get(contig)); + { + if(contigHash.get(contig) == null) + System.err.println(contig+" not found in "+this.getName()); + else + list.add(contigHash.get(contig)); + } else list.add(contigHash.get(sequenceNames[0])); return list;