X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fws%2FDasSequenceFeatureFetcher.java;h=0a61dffdb19c0e989a24f00322b7e3420b2e4726;hb=a990c2c6facfd04d61d316dcafba31d03747d162;hp=2d8617a62943755279273733a2919271ce7cc70a;hpb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;p=jalview.git
diff --git a/src/jalview/ws/DasSequenceFeatureFetcher.java b/src/jalview/ws/DasSequenceFeatureFetcher.java
index 2d8617a..0a61dff 100644
--- a/src/jalview/ws/DasSequenceFeatureFetcher.java
+++ b/src/jalview/ws/DasSequenceFeatureFetcher.java
@@ -1,30 +1,36 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ 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
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * 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
* 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 .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws;
import jalview.bin.Cache;
import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.gui.FeatureSettings;
+import jalview.gui.JvOptionPane;
+import jalview.util.DBRefUtils;
+import jalview.util.MessageManager;
import jalview.util.UrlLink;
import jalview.ws.dbsources.das.api.DasSourceRegistryI;
import jalview.ws.dbsources.das.api.jalviewSourceI;
@@ -41,8 +47,6 @@ import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
-import javax.swing.JOptionPane;
-
import org.biodas.jdas.client.FeaturesClient;
import org.biodas.jdas.client.adapters.features.DasGFFAdapter;
import org.biodas.jdas.client.adapters.features.DasGFFAdapter.GFFAdapter;
@@ -178,13 +182,12 @@ public class DasSequenceFeatureFetcher
int refCount = 0;
for (int i = 0; i < sequences.length; i++)
{
- DBRefEntry[] dbref = sequences[i].getDBRef();
+ DBRefEntry[] dbref = sequences[i].getDBRefs();
if (dbref != null)
{
for (int j = 0; j < dbref.length; j++)
{
- if (dbref[j].getSource().equals(
- jalview.datamodel.DBRefSource.UNIPROT))
+ if (dbref[j].getSource().equals(DBRefSource.UNIPROT))
{
refCount++;
break;
@@ -196,20 +199,18 @@ public class DasSequenceFeatureFetcher
if (checkDbrefs && refCount < sequences.length && uniprotCount > 0)
{
- int reply = JOptionPane.YES_OPTION;
+ int reply = JvOptionPane.YES_OPTION;
if (promptFetchDbrefs)
{
- reply = JOptionPane
- .showInternalConfirmDialog(
- Desktop.desktop,
- "Do you want Jalview to find\n"
- + "Uniprot Accession ids for given sequence names?",
- "Find Uniprot Accession Ids",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
+ reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ MessageManager.getString(
+ "info.you_want_jalview_to_find_uniprot_accessions"),
+ MessageManager
+ .getString("label.find_uniprot_accession_ids"),
+ JvOptionPane.YES_NO_OPTION, JvOptionPane.QUESTION_MESSAGE);
}
- if (reply == JOptionPane.YES_OPTION)
+ if (reply == JvOptionPane.YES_OPTION)
{
Thread thread = new Thread(new FetchDBRefs());
thread.start();
@@ -234,6 +235,7 @@ public class DasSequenceFeatureFetcher
class FetchSeqFeatures implements Runnable
{
+ @Override
public void run()
{
startFetching();
@@ -243,10 +245,14 @@ public class DasSequenceFeatureFetcher
class FetchDBRefs implements Runnable
{
+ @Override
public void run()
{
running = true;
- new DBRefFetcher(sequences, af).fetchDBRefs(true);
+ boolean isNucleotide = af.getViewport().getAlignment().isNucleotide();
+ new DBRefFetcher(sequences, af, null, af.featureSettings,
+ isNucleotide).fetchDBRefs(true);
+
startFetching();
setGuiFetchComplete();
}
@@ -262,7 +268,8 @@ public class DasSequenceFeatureFetcher
startTime = System.currentTimeMillis();
if (af != null)
{
- af.setProgressBar("Fetching DAS Sequence Features", startTime);
+ af.setProgressBar(MessageManager.getString(
+ "status.fetching_das_sequence_features"), startTime);
}
if (sourceRegistry == null)
{
@@ -272,10 +279,9 @@ public class DasSequenceFeatureFetcher
{
try
{
- jalviewSourceI[] sources = sourceRegistry.getSources().toArray(
- new jalviewSourceI[0]);
- String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
- "uniprot");
+ jalviewSourceI[] sources = sourceRegistry.getSources()
+ .toArray(new jalviewSourceI[0]);
+ String active = Cache.getDefault("DAS_ACTIVE_SOURCE", "uniprot");
StringTokenizer st = new StringTokenizer(active, "\t");
selectedSources = new Vector();
String token;
@@ -371,13 +377,12 @@ public class DasSequenceFeatureFetcher
for (List idl : ids)
{
String source = sources.next();
- FeaturesClient featuresc = new FeaturesClient(sourceRegistry
- .getSessionHandler().getConnectionPropertyProviderFor(
- source));
+ FeaturesClient featuresc = new FeaturesClient(
+ sourceRegistry.getSessionHandler()
+ .getConnectionPropertyProviderFor(source));
for (String id : idl)
{
- List qid = Arrays.asList(new String[]
- { id });
+ List qid = Arrays.asList(new String[] { id });
try
{
DasGFFAdapter dga = featuresc.fetchData(source, qid);
@@ -429,8 +434,8 @@ public class DasSequenceFeatureFetcher
}
private void processResponse(Map sequencemap,
- jalviewSourceI jvsource, List ids,
- List idobj, Map, DasGFFAdapter> results,
+ jalviewSourceI jvsource, List ids, List idobj,
+ Map, DasGFFAdapter> results,
Map, Exception> errors)
{
Set sequences = new HashSet();
@@ -493,14 +498,14 @@ public class DasSequenceFeatureFetcher
vf = dbref.getMap().locateFeature(f);
} catch (Exception ex)
{
- Cache.log
- .info("Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss@jalview.org.");
- Cache.log.info("Mapping feature from " + f.getBegin()
+ Cache.log.warn(
+ "Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss@jalview.org.");
+ Cache.log.warn("Mapping feature from " + f.getBegin()
+ " to " + f.getEnd() + " in dbref "
+ dbref.getAccessionId() + " in "
+ dbref.getSource());
- Cache.log.info("using das Source " + source);
- Cache.log.info("Exception", ex);
+ Cache.log.warn("using das Source " + source);
+ Cache.log.warn("Exception", ex);
}
if (vf != null)
@@ -535,7 +540,9 @@ public class DasSequenceFeatureFetcher
if (af != null)
{
- af.setProgressBar("No DAS Sources Active", startTime);
+ af.setProgressBar(
+ MessageManager.getString("status.no_das_sources_active"),
+ startTime);
}
if (getFeatSettings() != null)
{
@@ -565,7 +572,8 @@ public class DasSequenceFeatureFetcher
{
if (af != null)
{
- af.setProgressBar("DAS Feature Fetching Cancelled", startTime);
+ af.setProgressBar(MessageManager.getString(
+ "status.das_feature_fetching_cancelled"), startTime);
}
cancelled = true;
}
@@ -580,12 +588,13 @@ public class DasSequenceFeatureFetcher
if (!cancelled && af != null)
{
// only update the progress bar if we've completed the fetch normally
- af.setProgressBar("DAS Feature Fetching Complete", startTime);
+ af.setProgressBar(MessageManager.getString(
+ "status.das_feature_fetching_complete"), startTime);
}
if (af != null && af.featureSettings != null)
{
- af.featureSettings.setTableData();
+ af.featureSettings.discoverAllFeatureData();
}
if (getFeatSettings() != null)
@@ -603,8 +612,8 @@ public class DasSequenceFeatureFetcher
}
af.getFeatureRenderer().featuresAdded();
- int start = af.getViewport().getStartSeq();
- int end = af.getViewport().getEndSeq();
+ int start = af.getViewport().getRanges().getStartSeq();
+ int end = af.getViewport().getRanges().getEndSeq();
int index;
for (index = start; index < end; index++)
{
@@ -624,12 +633,14 @@ public class DasSequenceFeatureFetcher
Object[] nextSequence(jalviewSourceI dasSource, SequenceI seq)
{
if (cancelled)
+ {
return null;
- DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
- seq.getDBRef(), new String[]
+ }
+ DBRefEntry[] uprefs = DBRefUtils.selectRefs(seq.getDBRefs(),
+ new String[]
{
- // jalview.datamodel.DBRefSource.PDB,
- jalview.datamodel.DBRefSource.UNIPROT,
+ // jalview.datamodel.DBRefSource.PDB,
+ DBRefSource.UNIPROT,
// jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord
// sys sources
});
@@ -648,8 +659,8 @@ public class DasSequenceFeatureFetcher
for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())
{
- if (jalview.util.DBRefUtils.isDasCoordinateSystem(
- csys.getAuthority(), uprefs[j]))
+ if (DBRefUtils.isDasCoordinateSystem(csys.getAuthority(),
+ uprefs[j]))
{
debug("Launched fetcher for coordinate system "
+ csys.getAuthority());
@@ -657,16 +668,18 @@ public class DasSequenceFeatureFetcher
// - the start/end for the DBRefEntry may not be the same as the
// sequence's start/end
- System.out.println(seq.getName() + " "
- + (seq.getDatasetSequence() == null) + " "
- + csys.getUri());
+ System.out.println(
+ seq.getName() + " " + (seq.getDatasetSequence() == null)
+ + " " + csys.getUri());
dasCoordSysFound = true; // break's out of the loop
ids.add(uprefs[j]);
qstring.add(uprefs[j].getAccessionId());
}
else
+ {
System.out.println("IGNORE " + csys.getAuthority());
+ }
}
}
}
@@ -704,8 +717,7 @@ public class DasSequenceFeatureFetcher
}
}
- return new Object[]
- { ids, qstring };
+ return new Object[] { ids, qstring };
}
/**
@@ -837,7 +849,7 @@ public class DasSequenceFeatureFetcher
{
for (String note : feat.getNOTE())
{
- desc += (String) note;
+ desc += note;
}
}
@@ -868,9 +880,8 @@ public class DasSequenceFeatureFetcher
{
}
- SequenceFeature f = new SequenceFeature(
- getTypeString(feat.getTYPE()), desc, start, end, score,
- nickname);
+ SequenceFeature f = new SequenceFeature(getTypeString(feat.getTYPE()),
+ desc, start, end, score, nickname);
if (feat.getLINK() != null)
{