/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
* Copyright (C) 2014 The Jalview Authors
- *
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jalview. If not, see <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
* Defines internal constants for unambiguous annotation of DbRefEntry source
* strings and describing the data retrieved from external database sources (see
* jalview.ws.DbSourcProxy)
- *
+ *
* @author JimP
- *
+ *
*/
public class DBRefSource
{
public static String UNIPROT = "UNIPROT";
/**
+ * INTERMINE Accession Number
+ */
+ public static String INTERMINE = "INTERMINE";
+
+
+ /**
* UNIPROT Entry Name
*/
public static String UP_NAME = "UNIPROT_NAME";
* List of databases whose sequences might have coding regions annotated
*/
public static final String[] DNACODINGDBS =
- { EMBL, EMBLCDS, GENEDB };
+ { EMBL, EMBLCDS, GENEDB };
public static final String[] CODINGDBS =
- { EMBLCDS, GENEDB };
+ { EMBLCDS, GENEDB };
public static final String[] PROTEINDBS =
- { UNIPROT, PDB, UNIPROTKB };
+ { UNIPROT, PDB, UNIPROTKB };
public static final String[] PROTEINSEQ =
- { UNIPROT, UNIPROTKB };
+ { UNIPROT, UNIPROTKB };
public static final String[] PROTEINSTR =
- { PDB };
+ { PDB };
public static final String[] DOMAINDBS =
- { PFAM, RFAM };
+ { PFAM, RFAM };
/**
* set of unique DBRefSource property constants. These could be used to
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
* Copyright (C) 2014 The Jalview Authors
- *
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jalview. If not, see <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
* and abstract class in jalview.ws.seqfetcher. This implements the run-time
* discovery of sequence database clients, and provides a hardwired main for
* testing all registered handlers.
- *
+ *
*/
public class SequenceFetcher extends ASequenceFetcher
{
* Thread safe construction of database proxies TODO: extend to a configurable
* database plugin mechanism where classes are instantiated by reflection and
* queried for their DbRefSource and version association.
- *
+ *
*/
public SequenceFetcher()
{
// PFAM
addDBRefSourceImpl(jalview.ws.dbsources.RfamFull.class);
addDBRefSourceImpl(jalview.ws.dbsources.RfamSeed.class);
+ addDBRefSourceImpl(jalview.ws.dbsources.Intermine.class);
if (addDas)
{
registerDasSequenceSources();
{
String[] srcs = this.getSupportedDb();
ArrayList<String> dassrc = new ArrayList<String>(), nondas = new ArrayList<String>();
- for (int i = 0; i < srcs.length; i++)
+ for (String src : srcs)
{
boolean das = false, skip = false;
String nm;
- for (DbSourceProxy dbs : getSourceProxy(srcs[i]))
+ for (DbSourceProxy dbs : getSourceProxy(src))
{
// Skip the alignment databases for the moment - they're not useful for
// verifying a single sequence against its reference source
else
{
nm = dbs.getDbName();
- if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
+ if (getSourceProxy(src) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
{
if (nm.startsWith("das:"))
{
}
if (das)
{
- dassrc.add(srcs[i]);
+ dassrc.add(src);
}
else
{
- nondas.add(srcs[i]);
+ nondas.add(src);
}
}
String[] tosort = nondas.toArray(new String[0]), sorted = nondas
{
String[] srcs = this.getSupportedDb();
ArrayList dassrc = new ArrayList(), nondas = new ArrayList();
- for (int i = 0; i < srcs.length; i++)
+ for (String src : srcs)
{
- for (DbSourceProxy dbs : getSourceProxy(srcs[i]))
+ for (DbSourceProxy dbs : getSourceProxy(src))
{
String nm = dbs.getDbName();
- if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
+ if (getSourceProxy(src) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
{
if (nm.startsWith("das:"))
{
nm = nm.substring(4);
}
dassrc.add(new String[]
- { srcs[i], nm.toUpperCase() });
+ { src, nm.toUpperCase() });
}
else
{
nondas.add(new String[]
- { srcs[i], nm.toUpperCase() });
+ { src, nm.toUpperCase() });
}
}
}
/**
* simple run method to test dbsources.
- *
+ *
* @param argv
*/
public static void main(String[] argv)
if (argv != null && argv.length > 0)
{
List<DbSourceProxy> sps = new SequenceFetcher(withDas)
- .getSourceProxy(argv[0]);
+ .getSourceProxy(argv[0]);
if (sps != null)
{
}
ASequenceFetcher sfetcher = new SequenceFetcher(withDas);
String[] dbSources = sfetcher.getSupportedDb();
- for (int dbsource = 0; dbsource < dbSources.length; dbsource++)
+ for (String db : dbSources)
{
- String db = dbSources[dbsource];
// skip me
if (db.equals(DBRefSource.PDB))
+ {
continue;
+ }
for (DbSourceProxy sp : sfetcher.getSourceProxy(db))
{
System.out.println("Source: " + sp.getDbName() + " (" + db
DBRefSource.DNACODINGSEQDB)
|| sp.getDbSourceProperties().containsKey(
DBRefSource.DNASEQDB)
- || sp.getDbSourceProperties().containsKey(
- DBRefSource.CODINGSEQDB);
+ || sp.getDbSourceProperties().containsKey(
+ DBRefSource.CODINGSEQDB);
// try and find products
String types[] = jalview.analysis.CrossRef
.findSequenceXrefTypes(dna, al.getSequencesArray());
{
System.out.println("Xref Types for: "
+ (dna ? "dna" : "prot"));
- for (int t = 0; t < types.length; t++)
+ for (String type : types)
{
- System.out.println("Type: " + types[t]);
+ System.out.println("Type: " + type);
SequenceI[] prod = jalview.analysis.CrossRef
.findXrefSequences(al.getSequencesArray(), dna,
- types[t]).getSequencesArray();
+ type).getSequencesArray();
System.out.println("Found "
+ ((prod == null) ? "no" : "" + prod.length)
+ " products");
else
{
noProds.addElement((dna ? new Object[]
- { al, al } : new Object[]
- { al }));
+ { al, al } : new Object[]
+ { al }));
}
}
System.out.println("ERROR:No alignment retrieved.");
StringBuffer raw = sp.getRawRecords();
if (raw != null)
+ {
System.out.println(raw.toString());
+ }
else
+ {
System.out.println("ERROR:No Raw results.");
+ }
}
else
{
if (ds == null)
{
ds = new Alignment(new SequenceI[]
- { sq });
+ { sq });
}
else
--- /dev/null
+package jalview.ws.dbsources;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefSource;
+import jalview.ws.seqfetcher.DbSourceProxy;
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+import com.stevesoft.pat.Regex;
+
+public class Intermine extends DbSourceProxyImpl implements DbSourceProxy
+{
+
+ @Override
+ public String getDbSource()
+ {
+ return DBRefSource.INTERMINE;
+ }
+
+ @Override
+ public String getDbName()
+ {
+ return "Intermine";
+ }
+
+ @Override
+ public String getDbVersion()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Regex getAccessionValidator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ // @Override
+ // public Hashtable getDbSourceProperties()
+ // {
+ // // TODO Auto-generated method stub
+ // return null;
+ // }
+
+ @Override
+ public String getTestQuery()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isValidReference(String accession)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean queryInProgress()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public StringBuffer getRawRecords()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isA(Object dbsourceproperty)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int getTier()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}