From: Jim Procter Date: Tue, 18 Feb 2020 18:38:12 +0000 (+0000) Subject: JAL-3529 attempt to guess database for a sequence’s AC record based on the sequence... X-Git-Tag: Develop-2_11_2_0-d20201215~35^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=90cf1b4dbeb37554fd4b654c1da523f5791383e4;p=jalview.git JAL-3529 attempt to guess database for a sequence’s AC record based on the sequence type if the alignment had no PFAM or RFAM accession --- 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));