package jalview.ws.dbsources;\r
\r
import java.io.File;\r
+import java.io.FileReader;\r
import java.io.IOException;\r
import java.util.Enumeration;\r
import java.util.Hashtable;\r
import java.util.Vector;\r
\r
+import org.exolab.castor.xml.Unmarshaller;\r
+\r
import com.stevesoft.pat.Regex;\r
\r
import jalview.datamodel.Alignment;\r
import jalview.datamodel.SequenceFeature;\r
import jalview.datamodel.SequenceI;\r
import jalview.datamodel.UniprotEntry;\r
+import jalview.datamodel.UniprotFile;\r
import jalview.io.FormatAdapter;\r
import jalview.io.IdentifyFile;\r
import jalview.ws.DBRefFetcher;\r
super();\r
addDbSourceProperty(DBRefSource.SEQDB, DBRefSource.SEQDB);\r
addDbSourceProperty(DBRefSource.PROTSEQDB);\r
- addDbSourceProperty(DBRefSource.MULTIACC);\r
+ addDbSourceProperty(DBRefSource.MULTIACC, new Integer(50));\r
}\r
\r
/*\r
\r
private EBIFetchClient ebi = null;\r
\r
+ public Vector getUniprotEntries(File file)\r
+ {\r
+ UniprotFile uni = new UniprotFile();\r
+ try\r
+ {\r
+ // 1. Load the mapping information from the file\r
+ org.exolab.castor.mapping.Mapping map = new org.exolab.castor.mapping.Mapping(uni.getClass().getClassLoader());\r
+ java.net.URL url = getClass().getResource("/uniprot_mapping.xml");\r
+ map.loadMapping(url);\r
+\r
+ // 2. Unmarshal the data\r
+ Unmarshaller unmar = new Unmarshaller(uni);\r
+ unmar.setIgnoreExtraElements(true);\r
+ unmar.setMapping(map);\r
+\r
+ uni = (UniprotFile) unmar.unmarshal(new FileReader(file));\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ System.out.println("Error getUniprotEntries() " + e);\r
+ }\r
+\r
+ return uni.getUniprotEntries();\r
+ }\r
+\r
/*\r
* (non-Javadoc)\r
* \r
Alignment al=null;\r
ebi = new EBIFetchClient();\r
StringBuffer result=new StringBuffer();\r
- File file = ebi.fetchDataAsFile("uniprot:" + queries, "xml", null);\r
- DBRefFetcher dbref = new DBRefFetcher();\r
- Vector entries = dbref.getUniprotEntries(file);\r
+ // uniprotxml parameter required since december 2007\r
+ File file = ebi.fetchDataAsFile("uniprot:" + queries, "uniprotxml", null);\r
+ Vector entries = getUniprotEntries(file);\r
\r
if (entries != null)\r
{\r
Enumeration en2 = entry.getAccession().elements();\r
while (en2.hasMoreElements())\r
{\r
+ // we always add as uniprot if we retrieved from uniprot or uniprot name\r
sq.addDBRef(\r
- new DBRefEntry(getDbSource(), getDbVersion(), en2.nextElement()\r
+ new DBRefEntry(DBRefSource.UNIPROT, getDbVersion(), en2.nextElement()\r
.toString()));\r
}\r
sq.setPDBId(onlyPdbEntries);\r
{\r
return "P00340";\r
}\r
+ public String getDbName()\r
+ {\r
+ return getDbSource();\r
+ }\r
}\r