*/
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;
private boolean dynamic = false;
- private boolean uses_seq_id = false;
+ private boolean uses_db_accession = false;
private String invalidMessage = null;
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
{
@Override
public String toString()
{
- String var = (uses_seq_id ? SEQUENCE_ID : SEQUENCE_NAME);
+ String var = (uses_db_accession ? DB_ACCESSION : SEQUENCE_ID);
return label
+ "|"
descr = null;
}
- if (usesSeqId()) // link is ID
+ if (usesDBAccession()) // link is ID
{
// collect matching db-refs
DBRefEntry[] dbr = DBRefUtils.selectRefs(seq.getDBRefs(),
}
}
}
- 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);
* "PF3|http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID=/PFAM:(.+)/=$"
* , "NOTFER|http://notfer.org/$SEQUENCE_ID=/(?<!\\s)(.+)/=$",
*/
- "NESTED|http://nested/$" + SEQUENCE_ID
+ "NESTED|http://nested/$" + DB_ACCESSION
+ "=/^(?:Label:)?(?:(?:gi\\|(\\d+))|([^:]+))/=$/nested" };
String[] idstrings = new String[] {
/*
return dynamic;
}
- public boolean usesSeqId()
+ public boolean usesDBAccession()
{
- return uses_seq_id;
+ return uses_db_accession;
}
public void setLabel(String newlabel)