X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fws%2Fdbsources%2FUniprot.java;h=3afe8ec2233aaf3b0040a54293af5e6267ddb7a4;hb=864558097ceffef983b15f24598cfdaf20efd52d;hp=7ecd32413f7e862d6bdadaa83bc3cb679ae40349;hpb=dad8955628659a3478493cc5121311030df20426;p=jalview.git diff --git a/src/jalview/ws/dbsources/Uniprot.java b/src/jalview/ws/dbsources/Uniprot.java index 7ecd324..3afe8ec 100644 --- a/src/jalview/ws/dbsources/Uniprot.java +++ b/src/jalview/ws/dbsources/Uniprot.java @@ -30,7 +30,6 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.datamodel.UniprotEntry; import jalview.datamodel.UniprotFile; -import jalview.util.DBRefUtils; import jalview.ws.ebi.EBIFetchClient; import jalview.ws.seqfetcher.DbSourceProxyImpl; @@ -166,7 +165,7 @@ public class Uniprot extends DbSourceProxyImpl // uniprotxml parameter required since december 2007 // uniprotkb dbname changed introduced december 2008 File file = ebi.fetchDataAsFile("uniprotkb:" + queries, "uniprotxml", - ".xml"); + "xml"); Vector entries = getUniprotEntries(new FileReader(file)); if (entries != null) @@ -194,7 +193,8 @@ public class Uniprot extends DbSourceProxyImpl * UniprotEntry * @return SequenceI instance created from the UniprotEntry instance */ - public SequenceI uniprotEntryToSequenceI(UniprotEntry entry){ + public SequenceI uniprotEntryToSequenceI(UniprotEntry entry) + { String id = getUniprotEntryId(entry); SequenceI sequence = new Sequence(id, entry.getUniprotSequence() .getContent()); @@ -226,17 +226,17 @@ public class Uniprot extends DbSourceProxyImpl if ("EMBL".equals(pdb.getType())) { // look for a CDS reference and add it, too. - String cdsId = (String) pdb.getProperty() - .get("protein sequence ID"); + String cdsId = (String) pdb.getProperty("protein sequence ID"); if (cdsId != null && cdsId.trim().length() > 0) { - dbr = new DBRefEntry(DBRefSource.EMBLCDS, DBRefSource.UNIPROT - + ":" - + dbVersion, cdsId.trim()); + // remove version + String[] vrs = cdsId.split("\\."); + dbr = new DBRefEntry(DBRefSource.EMBLCDS, vrs.length > 1 ? vrs[1] + : DBRefSource.UNIPROT + ":" + dbVersion, vrs[0]); dbRefs.add(dbr); } } - if (false) // "Ensembl".equals(pdb.getType())) + if ("Ensembl".equals(pdb.getType())) { /*UniprotXML * @@ -245,12 +245,9 @@ public class Uniprot extends DbSourceProxyImpl * * */ - String cdsId = (String) pdb.getProperty() - .get("protein sequence ID"); + String cdsId = (String) pdb.getProperty("protein sequence ID"); if (cdsId != null && cdsId.trim().length() > 0) { - // Only add the product ID - dbRefs.remove(dbr); dbr = new DBRefEntry(DBRefSource.ENSEMBL, DBRefSource.UNIPROT + ":" + dbVersion, cdsId.trim()); dbRefs.add(dbr); @@ -269,12 +266,10 @@ public class Uniprot extends DbSourceProxyImpl sequence.addSequenceFeature(sf); } } - // we use setDBRefs to assign refs quickly. - sequence.setDBRefs(dbRefs.toArray(new DBRefEntry[0])); - // need to use ensurePrimaries to reify any refs that should become primary - // refs - DBRefUtils.ensurePrimaries(sequence); // promote any direct refs to primary - // source dbs + for (DBRefEntry dbr : dbRefs) + { + sequence.addDBRef(dbr); + } return sequence; }