From ff6d28e672fca61bf5795751783f9ad57c36d654 Mon Sep 17 00:00:00 2001 From: tcarver <tjc> Date: Wed, 30 Jan 2013 15:20:42 +0000 Subject: [PATCH] ignore sequence-region lines that cannot be parsed --- .../artemis/io/IndexedGFFDocumentEntry.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/uk/ac/sanger/artemis/io/IndexedGFFDocumentEntry.java b/uk/ac/sanger/artemis/io/IndexedGFFDocumentEntry.java index b9d517959..8b5f9fe49 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; -- GitLab