X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FDBRefFetcher.java;h=95656796b40f8b432b5f0e8898dc7d4b6b318198;hb=98af16ccc5890b980f0c4f3acfb72d7128e3a6f0;hp=73d106a85fb60a9701d08bdc01ed3223fb05b24f;hpb=4ec235370b49c38ae7e7b3a46f92f926fc430bf1;p=jalview.git
diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java
index 73d106a..9565679 100644
--- a/src/jalview/ws/DBRefFetcher.java
+++ b/src/jalview/ws/DBRefFetcher.java
@@ -1,20 +1,19 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
*
- * This program 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.
+ * Jalview is free software: you can redistribute it and/or
+ * 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.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 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 .
*/
package jalview.ws;
@@ -31,6 +30,7 @@ import jalview.gui.CutAndPasteTransfer;
import jalview.gui.Desktop;
import jalview.gui.IProgressIndicator;
import jalview.gui.OOMWarning;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
import java.lang.reflect.Array;
import java.util.Enumeration;
@@ -38,8 +38,6 @@ import java.util.Hashtable;
import java.util.StringTokenizer;
import java.util.Vector;
-import org.biojava.dasobert.dasregistry.DasSource;
-
import uk.ac.ebi.picr.model.UPEntry;
/**
@@ -125,15 +123,15 @@ public class DBRefFetcher implements Runnable
{
// af.featureSettings_actionPerformed(null);
String[] defdb = null, otherdb = sfetcher
- .getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
+ .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
Vector selsources = new Vector(), dasselsrc = (af.featureSettings != null) ? af.featureSettings
- .getSelectedSources()
- : new jalview.gui.DasSourceBrowser().getSelectedSources();
+ .getSelectedSources() : new jalview.gui.DasSourceBrowser()
+ .getSelectedSources();
Enumeration en = dasselsrc.elements();
while (en.hasMoreElements())
{
- DasSource src = (DasSource) en.nextElement();
- selsources.addElement(src.getNickname());
+ jalviewSourceI src = (jalviewSourceI) en.nextElement();
+ selsources.addElement(src.getTitle());
}
int osel = 0;
for (int o = 0; otherdb != null && o < otherdb.length; o++)
@@ -189,14 +187,12 @@ public class DBRefFetcher implements Runnable
}
// append additional sources
String[] otherdb = sfetcher
- .getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
+ .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
if (otherdb != null && otherdb.length > 0)
{
String[] newsrc = new String[dbSources.length + otherdb.length];
System.arraycopy(dbSources, 0, newsrc, 0, dbSources.length);
- System
- .arraycopy(otherdb, 0, newsrc, dbSources.length,
- otherdb.length);
+ System.arraycopy(otherdb, 0, newsrc, dbSources.length, otherdb.length);
dbSources = newsrc;
}
}
@@ -388,9 +384,7 @@ public class DBRefFetcher implements Runnable
for (int j = 0; j < uprefs.length; j++)
{
addSeqId(sequence, uprefs[j].getAccessionId());
- queries
- .addElement(uprefs[j].getAccessionId()
- .toUpperCase());
+ queries.addElement(uprefs[j].getAccessionId().toUpperCase());
}
}
else
@@ -408,8 +402,9 @@ public class DBRefFetcher implements Runnable
try
{
presp = picrClient
- .getUPIForAccession(token, null, picrClient
- .getMappedDatabaseNames(), null, true);
+ .getUPIForAccession(token, null,
+ picrClient.getMappedDatabaseNames(),
+ null, true);
} catch (Exception e)
{
System.err.println("Exception with Picr for '" + token
@@ -448,11 +443,10 @@ public class DBRefFetcher implements Runnable
} // all databases have been queries.
if (sbuffer.length() > 0)
{
- output
- .setText("Your sequences have been verified against known sequence databases. Some of the ids have been\n"
- + "altered, most likely the start/end residue will have been updated.\n"
- + "Save your alignment to maintain the updated id.\n\n"
- + sbuffer.toString());
+ output.setText("Your sequences have been verified against known sequence databases. Some of the ids have been\n"
+ + "altered, most likely the start/end residue will have been updated.\n"
+ + "Save your alignment to maintain the updated id.\n\n"
+ + sbuffer.toString());
Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);
// The above is the dataset, we must now find out the index
// of the viewed sequence
@@ -497,9 +491,16 @@ public class DBRefFetcher implements Runnable
// taking into account all accessionIds and names in the file
Vector sequenceMatches = new Vector();
// look for corresponding accession ids
- DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(entry
- .getDBRef(), new String[]
- { dbSource });
+ DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(
+ entry.getDBRef(), new String[]
+ { dbSource });
+ if (entryRefs == null)
+ {
+ System.err
+ .println("Dud dbSource string ? no entryrefs selected for "
+ + dbSource + " on " + entry.getName());
+ continue;
+ }
for (int j = 0; j < entryRefs.length; j++)
{
String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString();
@@ -612,24 +613,26 @@ public class DBRefFetcher implements Runnable
// absStart+sequence.getStart()+entrySeq.length()-1},
// new int[] { entry.getStart(), entry.getEnd() }, 1, 1);
// relocate local features for updated start
- if (updateRefFrame) {
+ if (updateRefFrame)
+ {
if (sequence.getSequenceFeatures() != null)
{
- SequenceFeature[] sf = sequence.getSequenceFeatures();
- int start = sequence.getStart();
- int end = sequence.getEnd();
- int startShift = 1 - absStart - start; // how much the features are
- // to be shifted by
- for (int sfi = 0; sfi < sf.length; sfi++)
- {
- if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)
+ SequenceFeature[] sf = sequence.getSequenceFeatures();
+ int start = sequence.getStart();
+ int end = sequence.getEnd();
+ int startShift = 1 - absStart - start; // how much the features
+ // are
+ // to be shifted by
+ for (int sfi = 0; sfi < sf.length; sfi++)
{
- // shift feature along by absstart
- sf[sfi].setBegin(sf[sfi].getBegin() + startShift);
- sf[sfi].setEnd(sf[sfi].getEnd() + startShift);
+ if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)
+ {
+ // shift feature along by absstart
+ sf[sfi].setBegin(sf[sfi].getBegin() + startShift);
+ sf[sfi].setEnd(sf[sfi].getEnd() + startShift);
+ }
}
}
- }
}
}
@@ -645,21 +648,28 @@ public class DBRefFetcher implements Runnable
sequence.setStart(absStart);
sequence.setEnd(absEnd);
// search for alignment sequences to update coordinate frame for
- for (int alsq = 0; alsq