From: kiramt Date: Wed, 2 Nov 2016 09:39:10 +0000 (+0000) Subject: JAL-2282 Renamed internal use of sequence id / db accession for X-Git-Tag: Release_2_10_1^2~18^2~2^2~5 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8c53a6c0bda186beb949efd99cecbb815eab2210;p=jalview.git JAL-2282 Renamed internal use of sequence id / db accession for consistency --- diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index b6353c3..182f20e 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -247,7 +247,7 @@ public class IdPanel extends Panel implements MouseListener, continue; } - if (urlLink.usesSeqId()) + if (urlLink.usesDBAccession()) { // this URL requires an accession id, not the name of a sequence url = null; diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index acc2a9f..e321a74 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -226,7 +226,7 @@ public class IdPanel extends JPanel implements MouseListener, continue; } - if (urlLink.usesSeqId()) + if (urlLink.usesDBAccession()) { // this URL requires an accession id, not the name of a sequence url = null; diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index be0ac05..4f094e1 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -21,8 +21,8 @@ package jalview.gui; import static jalview.util.UrlConstants.EMBLEBI_STRING; +import static jalview.util.UrlConstants.DB_ACCESSION; import static jalview.util.UrlConstants.SEQUENCE_ID; -import static jalview.util.UrlConstants.SEQUENCE_NAME; import static jalview.util.UrlConstants.SRS_STRING; import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; @@ -126,10 +126,10 @@ public class Preferences extends GPreferences String name = st.nextToken(); String url = st.nextToken(); // check for '|' within a regex - int rxstart = url.indexOf("$" + SEQUENCE_ID + "$"); + int rxstart = url.indexOf("$" + DB_ACCESSION + "$"); if (rxstart == -1) { - rxstart = url.indexOf("$" + SEQUENCE_NAME + "$"); + rxstart = url.indexOf("$" + SEQUENCE_ID + "$"); } while (rxstart == -1 && url.indexOf("/=$") == -1) { diff --git a/src/jalview/util/UrlConstants.java b/src/jalview/util/UrlConstants.java index b70edf5..1910bff 100644 --- a/src/jalview/util/UrlConstants.java +++ b/src/jalview/util/UrlConstants.java @@ -29,12 +29,12 @@ public class UrlConstants /* * Sequence ID string */ - public static final String SEQUENCE_ID = "DB_ACCESSION"; + public static final String DB_ACCESSION = "DB_ACCESSION"; /* * Sequence Name string */ - public static final String SEQUENCE_NAME = "SEQUENCE_ID"; + public static final String SEQUENCE_ID = "SEQUENCE_ID"; /* * Default sequence URL link string for EMBL-EBI search diff --git a/src/jalview/util/UrlLink.java b/src/jalview/util/UrlLink.java index 218da6c..0d92759 100644 --- a/src/jalview/util/UrlLink.java +++ b/src/jalview/util/UrlLink.java @@ -20,8 +20,8 @@ */ package jalview.util; +import static jalview.util.UrlConstants.DB_ACCESSION; import static jalview.util.UrlConstants.SEQUENCE_ID; -import static jalview.util.UrlConstants.SEQUENCE_NAME; import jalview.datamodel.DBRefEntry; import jalview.datamodel.SequenceI; @@ -46,7 +46,7 @@ public class UrlLink private boolean dynamic = false; - private boolean uses_seq_id = false; + private boolean uses_db_accession = false; private String invalidMessage = null; @@ -60,23 +60,23 @@ public class UrlLink public UrlLink(String link) { int sep = link.indexOf("|"); - int psqid = link.indexOf("$" + SEQUENCE_ID); - int nsqid = link.indexOf("$" + SEQUENCE_NAME); + int psqid = link.indexOf("$" + DB_ACCESSION); + int nsqid = link.indexOf("$" + SEQUENCE_ID); if (psqid > -1) { dynamic = true; - uses_seq_id = true; + uses_db_accession = true; sep = parseTargetAndLabel(sep, psqid, link); - parseUrl(link, SEQUENCE_ID, psqid, sep); + parseUrl(link, DB_ACCESSION, psqid, sep); } else if (nsqid > -1) { dynamic = true; sep = parseTargetAndLabel(sep, nsqid, link); - parseUrl(link, SEQUENCE_NAME, nsqid, sep); + parseUrl(link, SEQUENCE_ID, nsqid, sep); } else { @@ -268,7 +268,7 @@ public class UrlLink @Override public String toString() { - String var = (uses_seq_id ? SEQUENCE_ID : SEQUENCE_NAME); + String var = (uses_db_accession ? DB_ACCESSION : SEQUENCE_ID); return label + "|" @@ -439,7 +439,7 @@ public class UrlLink descr = null; } - if (usesSeqId()) // link is ID + if (usesDBAccession()) // link is ID { // collect matching db-refs DBRefEntry[] dbr = DBRefUtils.selectRefs(seq.getDBRefs(), @@ -455,7 +455,7 @@ public class UrlLink } } } - else if (!usesSeqId() && id != null) // link is name + else if (!usesDBAccession() && id != null) // link is name { // create Bare ID link for this URL createBareURLLink(id, false, linkset); @@ -533,7 +533,7 @@ public class UrlLink * "PF3|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/PFAM:(.+)/=$" * , "NOTFER|http://notfer.org/$SEQUENCE_ID=/(?> linkset = new LinkedHashMap>(); @@ -307,11 +307,11 @@ public class UrlLinkTest // links as might be added into Preferences | Connections dialog links.add("EMBL-EBI Search | http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$" - + SEQUENCE_NAME + "$"); - links.add("UNIPROT | http://www.uniprot.org/uniprot/$" + SEQUENCE_ID + + SEQUENCE_ID + "$"); + links.add("UNIPROT | http://www.uniprot.org/uniprot/$" + DB_ACCESSION + "$"); links.add("INTERPRO | http://www.ebi.ac.uk/interpro/entry/$" - + SEQUENCE_ID + "$"); + + DB_ACCESSION + "$"); // make seq0 dbrefs refs.add(new DBRefEntry(DBRefSource.UNIPROT, "1", "P83527")); @@ -329,7 +329,7 @@ public class UrlLinkTest seq0.createDatasetSequence(); // Test where link takes a sequence id as replacement - UrlLink ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + SEQUENCE_NAME + UrlLink ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + SEQUENCE_ID + DELIM + URL_SUFFIX); Map> linkset = new LinkedHashMap>(); @@ -392,7 +392,7 @@ public class UrlLinkTest "http://www.ebi.ac.uk/interpro/entry/IPR012675"); // Test where there are no matching dbrefs for the link - ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + SEQUENCE_ID + DELIM + ul = new UrlLink(DB + SEP + URL_PREFIX + DELIM + DB_ACCESSION + DELIM + URL_SUFFIX); linkset = new LinkedHashMap>(); ul.createLinksFromSeq(seq0, linkset);