*/
package jalview.ws.dbsources;
+import java.util.Locale;
+
import jalview.bin.Cache;
import jalview.datamodel.DBRefSource;
import jalview.util.Platform;
*/
abstract public class Pfam extends Xfam
{
- /*
- * append to URLs to retrieve as a gzipped file
- */
- protected static final String GZIPPED = "/gzipped";
-
- static final String PFAM_BASEURL_KEY = "PFAM_BASEURL";
+ public static final String FULL="full",RP35="rp35",RP15="rp15",RP75="rp75",RP55="rp55",SEED="seed";
+
+ public String getPfamDownloadURL(String id,String alType) {
+ String url = Cache.getDefault(PFAM_BASEURL_KEY,DEFAULT_PFAM_BASEURL);
+ url = url.replace("$PFAMID$",id);
+ url = url.replace("$ALTYPE$",alType);
+ return url;
+ }
+ static final String PFAM_BASEURL_KEY = "PFAM_INTERPRO_URL_TEMPLATE";
+
+ protected String alignmentType;
+ private static final String DEFAULT_PFAM_BASEURL = "https://www.ebi.ac.uk/interpro/wwwapi/entry/pfam/$PFAMID$/?annotation=alignment:$ALTYPE$&download";
- private static final String DEFAULT_PFAM_BASEURL = "https://pfam.xfam.org";
static
{
Platform.addJ2SDirectDatabaseCall(DEFAULT_PFAM_BASEURL);
super();
}
+
+ String getURL(String queries)
+ {
+ return getPfamDownloadURL(
+ queries.trim().toUpperCase(Locale.ROOT), alignmentType);
+ }
+
/*
* (non-Javadoc)
*
{
return DBRefSource.PFAM;
}
-
}
@Test(groups = "Functional")
public void testGetURL()
{
- String path = "pfam.xfam.org/family/ABC/alignment/full/gzipped";
+ String path = "www.ebi.ac.uk/interpro/wwwapi/entry/pfam/ABC/?annotation=alignment:full&download";
// with default value for domain
String url = new PfamFull().getURL(" abc ");
assertEquals(url, "https://" + path);
// with override in properties
- Cache.setProperty(Pfam.PFAM_BASEURL_KEY, "http://pfam.xfam.org");
+ Cache.setProperty(Pfam.PFAM_BASEURL_KEY, "http://www.ebi.ac.uk/interpro/wwwapi/entry/pfam/$PFAMID$/?annotation=alignment:$ALTYPE$&download");
url = new PfamFull().getURL(" abc ");
assertEquals(url, "http://" + path);
}