import jalview.analysis.AlignmentUtils;
import jalview.bin.Cache;
import jalview.datamodel.DBRefSource;
+import jalview.util.Platform;
import jalview.ws.seqfetcher.DbSourceProxyImpl;
import com.stevesoft.pat.Regex;
// domain properties default values:
protected static final String DEFAULT_ENSEMBL_BASEURL = "https://rest.ensembl.org";
- protected static final String DEFAULT_ENSEMBL_GENOMES_BASEURL = "https://rest.ensemblgenomes.org";
+ // ensemblgenomes REST service merged to ensembl 9th April 2019
+ protected static final String DEFAULT_ENSEMBL_GENOMES_BASEURL = DEFAULT_ENSEMBL_BASEURL;
- /*
- * accepts ENSG/T/E/P with 11 digits
- * or ENSMUSP or similar for other species
- * or CCDSnnnnn.nn with at least 3 digits
- */
- private static final Regex ACCESSION_REGEX = new Regex(
- "(ENS([A-Z]{3}|)[GTEP]{1}[0-9]{11}$)" + "|"
- + "(CCDS[0-9.]{3,}$)");
+ private static Regex ACCESSION_REGEX;
protected final String ensemblGenomesDomain;
* this allows an easy change from http to https in future if needed
*/
ensemblDomain = Cache.getDefault(ENSEMBL_BASEURL,
- DEFAULT_ENSEMBL_BASEURL);
+ DEFAULT_ENSEMBL_BASEURL).trim();
ensemblGenomesDomain = Cache.getDefault(ENSEMBL_GENOMES_BASEURL,
- DEFAULT_ENSEMBL_GENOMES_BASEURL);
+ DEFAULT_ENSEMBL_GENOMES_BASEURL).trim();
domain = ensemblDomain;
}
public String getDbSource()
{
// NB ensure Uniprot xrefs are canonicalised from "Ensembl" to "ENSEMBL"
- if (ensemblGenomesDomain.equals(getDomain()))
- {
- return DBRefSource.ENSEMBLGENOMES;
- }
return DBRefSource.ENSEMBL;
}
@Override
public Regex getAccessionValidator()
{
+ if (ACCESSION_REGEX == null)
+ {
+ /*
+ * accepts ENSG/T/E/P with 11 digits
+ * or ENSMUSP or similar for other species
+ * or CCDSnnnnn.nn with at least 3 digits
+ */
+ ACCESSION_REGEX = Platform
+ .newRegex("(ENS([A-Z]{3}|)[GTEP]{1}[0-9]{11}$)" + "|"
+ + "(CCDS[0-9.]{3,}$)", null);
+ }
return ACCESSION_REGEX;
}
protected void setDomain(String d)
{
- domain = d;
+ domain = d == null ? null : d.trim();
}
}