X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FStockholmFile.java;fp=src%2Fjalview%2Fio%2FStockholmFile.java;h=4697262a7143db6b8fb022a0c98fe26b910801e6;hb=90cf1b4dbeb37554fd4b654c1da523f5791383e4;hp=b9f127422970240e15a05b4cf0325aa776826226;hpb=beaa6e0c46460e1ddcea461ffee16f5c4fccca08;p=jalview.git diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index b9f1274..4697262 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -334,17 +334,14 @@ public class StockholmFile extends AlignFile if (accAnnotations != null && accAnnotations.containsKey("AC")) { - if (dbsource != null) + String dbr = (String) accAnnotations.get("AC"); + if (dbr != null) { - String dbr = (String) accAnnotations.get("AC"); - if (dbr != null) - { - // we could get very clever here - but for now - just try to - // guess accession type from source of alignment plus structure - // of accession - guessDatabaseFor(seqO, dbr, dbsource); - - } + // we could get very clever here - but for now - just try to + // guess accession type from type of sequence, source of alignment plus + // structure + // of accession + guessDatabaseFor(seqO, dbr, dbsource); } // else - do what ? add the data anyway and prompt the user to // specify what references these are ? @@ -760,6 +757,12 @@ public class StockholmFile extends AlignFile st = -1; } } + if (dbsource == null) + { + // make up an origin based on whether the sequence looks like it is nucleotide + // or protein + dbsource = (seqO.isProtein()) ? "PFAM" : "RFAM"; + } if (dbsource.equals("PFAM")) { seqdb = "UNIPROT"; @@ -952,9 +955,10 @@ public class StockholmFile extends AlignFile int maxid = 0; int in = 0; Hashtable dataRef = null; + boolean isAA = s[in].isProtein(); while ((in < s.length) && (s[in] != null)) { - boolean isAA = s[in].isProtein(); + String tmp = printId(s[in], jvSuffix); max = Math.max(max, s[in].getLength()); @@ -1023,7 +1027,8 @@ public class StockholmFile extends AlignFile String type = (String) dataRef.remove(idd); out.append(new Format("%-" + (maxid - 2) + "s") .form("#=GS " + idd.toString() + " ")); - if (type.contains("PFAM") || type.contains("RFAM")) + if (isAA && type.contains("UNIPROT") + || (!isAA && type.contains("EMBL"))) { out.append(" AC " + type.substring(type.indexOf(";") + 1));