X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FStockholmFile.java;h=23c4d2179e8d2934e20a9c3f8291e6a400a26759;hb=df7802fdd54e7d3b12bda12ac55e6057c985bdf2;hp=96c462c11e9b5c24ff1c62affbd68ab833080840;hpb=0dc330c0d829ac668fbc8a323f5ad3e6d60c28f9;p=jalview.git diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index 96c462c..23c4d21 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -420,8 +420,8 @@ public class StockholmFile extends AlignFile { // logger.error("Could not parse sequence line: " + line); throw new IOException(MessageManager.formatMessage( - "exception.couldnt_parse_sequence_line", new String[] - { line })); + "exception.couldnt_parse_sequence_line", + new String[] { line })); } String ns = seqs.get(x.stringMatched(1)); if (ns == null) @@ -533,9 +533,9 @@ public class StockholmFile extends AlignFile } else { - throw new IOException(MessageManager.formatMessage( - "exception.error_parsing_line", new String[] - { line })); + // throw new IOException(MessageManager.formatMessage( + // "exception.error_parsing_line", new String[] { line })); + System.err.println(">> missing annotation: " + line); } } else if (annType.equals("GC")) @@ -665,8 +665,8 @@ public class StockholmFile extends AlignFile else { throw new IOException(MessageManager.formatMessage( - "exception.unknown_annotation_detected", new String[] - { annType, annContent })); + "exception.unknown_annotation_detected", new String[] { + annType, annContent })); } } } @@ -779,9 +779,8 @@ public class StockholmFile extends AlignFile { for (DBRefEntry d : dbrs) { - jalview.util.MapList mp = new jalview.util.MapList(new int[] - { seqO.getStart(), seqO.getEnd() }, new int[] - { st, en }, 1, 1); + jalview.util.MapList mp = new jalview.util.MapList(new int[] { + seqO.getStart(), seqO.getEnd() }, new int[] { st, en }, 1, 1); jalview.datamodel.Mapping mping = new Mapping(mp); d.setMap(mping); } @@ -826,7 +825,7 @@ public class StockholmFile extends AlignFile // be written out if (ss) { - //if (" .-_".indexOf(pos) == -1) + // if (" .-_".indexOf(pos) == -1) { if (detectbrackets.search(pos)) { @@ -848,7 +847,7 @@ public class StockholmFile extends AlignFile ann.displayCharacter = " " + ann.displayCharacter; } } - + } els[i] = ann; @@ -901,18 +900,18 @@ public class StockholmFile extends AlignFile { maxid = tmp.length(); } - if (s[in].getDBRef() != null) + if (s[in].getDBRefs() != null) { - for (int idb = 0; idb < s[in].getDBRef().length; idb++) + for (int idb = 0; idb < s[in].getDBRefs().length; idb++) { if (dataRef == null) { dataRef = new Hashtable(); } - String datAs1 = s[in].getDBRef()[idb].getSource().toString() + String datAs1 = s[in].getDBRefs()[idb].getSource().toString() + " ; " - + s[in].getDBRef()[idb].getAccessionId().toString(); + + s[in].getDBRefs()[idb].getAccessionId().toString(); dataRef.put(tmp, datAs1); } } @@ -978,6 +977,7 @@ public class StockholmFile extends AlignFile { feature = ds.getSequenceFeatures()[0].type; } + // ?bug - feature may still have previous loop value String key = type2id(feature); if (key == null) @@ -1027,13 +1027,21 @@ public class StockholmFile extends AlignFile } else { - label = (key = type2id(aa.label.toLowerCase())) + "_cons"; + key = type2id(aa.label.toLowerCase()); + if (key == null) + { + label = aa.label; + } + else + { + label = key + "_cons"; + } } - if (label == null) { label = aa.label; } + label = label.replace(" ", "_"); out.append(new Format("%-" + maxid + "s").form("#=GC " + label + " ")); @@ -1059,21 +1067,19 @@ public class StockholmFile extends AlignFile * @param ann * @param sequenceI */ - private char outputCharacter(String key, int k, - boolean isrna, Annotation[] ann, SequenceI sequenceI) + private char outputCharacter(String key, int k, boolean isrna, + Annotation[] ann, SequenceI sequenceI) { char seq = ' '; Annotation annot = ann[k]; String ch = (annot == null) ? ((sequenceI == null) ? "-" : Character - .toString(sequenceI.getCharAt(k))) - : annot.displayCharacter; - if (key.equals("SS")) + .toString(sequenceI.getCharAt(k))) : annot.displayCharacter; + if (key != null && key.equals("SS")) { if (annot == null) { // sensible gap character if one is available or make one up - return sequenceI == null ? '-' : sequenceI - .getCharAt(k); + return sequenceI == null ? '-' : sequenceI.getCharAt(k); } else {