\r
/**\r
* DOCUMENT ME!\r
- *\r
+ * \r
* @author $author$\r
* @version $Revision$\r
*/\r
Vector selectedSources;\r
\r
boolean cancelled = false;\r
+\r
private void debug(String mesg)\r
{\r
debug(mesg, null);\r
}\r
+\r
private void debug(String mesg, Exception e)\r
{\r
- if (Cache.log!=null)\r
+ if (Cache.log != null)\r
{\r
Cache.log.debug(mesg, e);\r
- } else {\r
+ }\r
+ else\r
+ {\r
System.err.println(mesg);\r
- if (e!=null)\r
- { \r
- e.printStackTrace(); \r
+ if (e != null)\r
+ {\r
+ e.printStackTrace();\r
}\r
}\r
}\r
+\r
long startTime;\r
\r
/**\r
- * Creates a new SequenceFeatureFetcher object.\r
- * Uses default\r
- *\r
- * @param align DOCUMENT ME!\r
- * @param ap DOCUMENT ME!\r
+ * Creates a new SequenceFeatureFetcher object. Uses default\r
+ * \r
+ * @param align\r
+ * DOCUMENT ME!\r
+ * @param ap\r
+ * DOCUMENT ME!\r
*/\r
public DasSequenceFeatureFetcher(SequenceI[] sequences,\r
FeatureSettings fsettings, Vector selectedSources)\r
{\r
this(sequences, fsettings, selectedSources, true, true);\r
}\r
+\r
public DasSequenceFeatureFetcher(SequenceI[] sequences,\r
- FeatureSettings fsettings, Vector selectedSources, boolean checkDbrefs, boolean promptFetchDbrefs)\r
+ FeatureSettings fsettings, Vector selectedSources,\r
+ boolean checkDbrefs, boolean promptFetchDbrefs)\r
{\r
this.selectedSources = selectedSources;\r
this.sequences = sequences;\r
- if (fsettings!=null)\r
+ if (fsettings != null)\r
{\r
this.fsettings = fsettings;\r
this.af = fsettings.af;\r
DasCoordinateSystem[] coords = source.getCoordinateSystem();\r
for (int c = 0; c < coords.length; c++)\r
{\r
- // TODO: match UniProt coord system canonically (?) - does UniProt==uniprot==UNIPROT ? \r
+ // TODO: match UniProt coord system canonically (?) - does\r
+ // UniProt==uniprot==UNIPROT ?\r
if (coords[c].getName().indexOf("UniProt") > -1)\r
{\r
uniprotCount++;\r
int reply = JOptionPane.YES_OPTION;\r
if (promptFetchDbrefs)\r
{\r
- reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,\r
- "Do you want Jalview to find\n"\r
- + "Uniprot Accession ids for given sequence names?",\r
- "Find Uniprot Accession Ids", JOptionPane.YES_NO_OPTION,\r
- JOptionPane.QUESTION_MESSAGE);\r
+ reply = JOptionPane\r
+ .showInternalConfirmDialog(\r
+ Desktop.desktop,\r
+ "Do you want Jalview to find\n"\r
+ + "Uniprot Accession ids for given sequence names?",\r
+ "Find Uniprot Accession Ids",\r
+ JOptionPane.YES_NO_OPTION,\r
+ JOptionPane.QUESTION_MESSAGE);\r
}\r
- \r
\r
if (reply == JOptionPane.YES_OPTION)\r
{\r
}\r
\r
/**\r
- * Spawns a number of dasobert Fetcher threads to add features to sequences in the dataset\r
+ * Spawns a number of dasobert Fetcher threads to add features to sequences in\r
+ * the dataset\r
*/\r
void startFetching()\r
{\r
cancelled = false;\r
startTime = System.currentTimeMillis();\r
- if (af!=null)\r
+ if (af != null)\r
{\r
af.setProgressBar("Fetching DAS Sequence Features", startTime);\r
}\r
}\r
\r
sourcesRemaining = selectedSources.size();\r
- //Now sending requests one at a time to each server\r
+ // Now sending requests one at a time to each server\r
for (int sourceIndex = 0; sourceIndex < selectedSources.size()\r
&& !cancelled; sourceIndex++)\r
{\r
private void setGuiNoDassourceActive()\r
{\r
\r
- if (af!=null)\r
+ if (af != null)\r
{\r
af.setProgressBar("No DAS Sources Active", startTime);\r
}\r
- if (getFeatSettings()!=null)\r
+ if (getFeatSettings() != null)\r
{\r
fsettings.noDasSourceActive();\r
- }\r
+ }\r
}\r
\r
/**\r
- * Update our fsettings dialog reference if we didn't have one when we were first initialised.\r
+ * Update our fsettings dialog reference if we didn't have one when we were\r
+ * first initialised.\r
+ * \r
* @return fsettings\r
*/\r
private FeatureSettings getFeatSettings()\r
\r
public void cancel()\r
{\r
- if (af!=null)\r
+ if (af != null)\r
{\r
af.setProgressBar("DAS Feature Fetching Cancelled", startTime);\r
}\r
\r
void featuresAdded(SequenceI seq)\r
{\r
- if (af==null)\r
+ if (af == null)\r
{\r
// no gui to update with features.\r
return;\r
DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(\r
seq.getDBRef(), new String[]\r
{\r
- // jalview.datamodel.DBRefSource.PDB,\r
+ // jalview.datamodel.DBRefSource.PDB,\r
jalview.datamodel.DBRefSource.UNIPROT,\r
- // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord sys sources\r
+ // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord\r
+ // sys sources\r
});\r
- // TODO: minimal list of DAS queries to make by querying with untyped ID if distinct from any typed IDs\r
+ // TODO: minimal list of DAS queries to make by querying with untyped ID if\r
+ // distinct from any typed IDs\r
\r
boolean dasCoordSysFound = false;\r
\r
{\r
debug("Launched fetcher for coordinate system "\r
+ cs[0].getName());\r
- // Will have to pass any mapping information to the fetcher\r
- //- the start/end for the DBRefEntry may not be the same as the sequence's start/end\r
+ // Will have to pass any mapping information to the fetcher\r
+ // - the start/end for the DBRefEntry may not be the same as the\r
+ // sequence's start/end\r
\r
System.out.println(seq.getName() + " "\r
+ (seq.getDatasetSequence() == null) + " "\r
if (seq.getName().indexOf("|") > -1)\r
{\r
id = seq.getName().substring(seq.getName().lastIndexOf("|") + 1);\r
- if (id.trim().length()<4)\r
+ if (id.trim().length() < 4)\r
{\r
- // hack - we regard a significant ID as being at least 4 non-whitespace characters\r
+ // hack - we regard a significant ID as being at least 4\r
+ // non-whitespace characters\r
id = seq.getName().substring(0, seq.getName().lastIndexOf("|"));\r
- if (id.indexOf("|")>-1)\r
+ if (id.indexOf("|") > -1)\r
{\r
- id = id.substring(id.lastIndexOf("|")+1);\r
+ id = id.substring(id.lastIndexOf("|") + 1);\r
}\r
}\r
}\r
}\r
\r
/**\r
- * fetch and add das features to a sequence using the given source URL and compatible DbRef id.\r
- * new features are mapped using the DbRef mapping to the local coordinate system.\r
+ * fetch and add das features to a sequence using the given source URL and\r
+ * compatible DbRef id. new features are mapped using the DbRef mapping to the\r
+ * local coordinate system.\r
+ * \r
* @param seq\r
* @param SourceUrl\r
* @param dbref\r
final DasSource dasSource, final DBRefEntry dbref)\r
{\r
\r
- //////////////\r
- /// fetch DAS features\r
+ // ////////////\r
+ // / fetch DAS features\r
final Das1Source source = new Das1Source();\r
source.setUrl(dasSource.getUrl());\r
source.setNickname(dasSource.getNickname());\r
responseComplete(dasSource, seq); // reduce thread count anyhow\r
return;\r
}\r
- debug("new Das Feature Fetcher for " + dbref.getSource()\r
- + ":" + dbref.getAccessionId() + " querying "\r
- + dasSource.getUrl());\r
+ debug("new Das Feature Fetcher for " + dbref.getSource() + ":"\r
+ + dbref.getAccessionId() + " querying " + dasSource.getUrl());\r
FeatureThread fetcher = new FeatureThread(dbref.getAccessionId()\r
- // + ":" + start + "," + end,\r
+ // + ":" + start + "," + end,\r
, source);\r
\r
fetcher.addFeatureListener(new FeatureListener()\r
\r
Map[] features = e.getFeatures();\r
// add features to sequence\r
- debug("das source " + ds.getUrl() + " returned "\r
- + features.length + " features");\r
+ debug("das source " + ds.getUrl() + " returned " + features.length\r
+ + " features");\r
\r
if (features.length > 0)\r
{\r
if (dbref.getMap() != null && f.getBegin() > 0\r
&& f.getEnd() > 0)\r
{\r
- debug("mapping from " + f.getBegin() + " - "\r
- + f.getEnd());\r
+ debug("mapping from " + f.getBegin() + " - " + f.getEnd());\r
SequenceFeature vf[] = null;\r
\r
try\r
{\r
for (int v = 0; v < vf.length; v++)\r
{\r
- debug("mapping to " + v + ": "\r
- + vf[v].getBegin() + " - " + vf[v].getEnd());\r
+ debug("mapping to " + v + ": " + vf[v].getBegin() + " - "\r
+ + vf[v].getEnd());\r
seq.addSequenceFeature(vf[v]);\r
}\r
}\r
}\r
else\r
{\r
- // System.out.println("No features found for " + seq.getName()\r
- // + " from: " + e.getDasSource().getNickname());\r
+ // System.out.println("No features found for " + seq.getName()\r
+ // + " from: " + e.getDasSource().getNickname());\r
}\r
responseComplete(dasSource, seq);\r
\r
protected void createFeatureFetcher(final SequenceI seq,\r
final DasSource dasSource, String id)\r
{\r
- //////////////\r
- /// fetch DAS features\r
+ // ////////////\r
+ // / fetch DAS features\r
final Das1Source source = new Das1Source();\r
source.setUrl(dasSource.getUrl());\r
source.setNickname(dasSource.getNickname());\r
- \r
- if (id!=null)\r
+\r
+ if (id != null)\r
{\r
id = id.trim();\r
}\r
debug("new Das Feature Fetcher for " + id + " querying "\r
+ dasSource.getUrl());\r
FeatureThread fetcher = new FeatureThread(id\r
- // + ":" + start + "," + end,\r
+ // + ":" + start + "," + end,\r
, source);\r
\r
fetcher.addFeatureListener(new FeatureListener()\r
}\r
else\r
{\r
- // System.out.println("No features found for " + seq.getName()\r
- // + " from: " + e.getDasSource().getNickname());\r
+ // System.out.println("No features found for " + seq.getName()\r
+ // + " from: " + e.getDasSource().getNickname());\r
}\r
responseComplete(dasSource, seq);\r
\r
);\r
\r
fetcher.start();\r
- } else {\r
+ }\r
+ else\r
+ {\r
// invalid fetch - indicate it is finished.\r
- debug("Skipping empty ID for querying "\r
- + dasSource.getUrl());\r
+ debug("Skipping empty ID for querying " + dasSource.getUrl());\r
responseComplete(dasSource, seq);\r
}\r
}\r
\r
/**\r
* creates a jalview sequence feature from a das feature document\r
+ * \r
* @param dasfeature\r
* @return sequence feature object created using dasfeature information\r
*/\r
try\r
{\r
/**\r
- * Different qNames for a DAS Feature - are string keys to the HashMaps in features\r
- * "METHOD") ||\r
- qName.equals("TYPE") ||\r
- qName.equals("START") ||\r
- qName.equals("END") ||\r
- qName.equals("NOTE") ||\r
- qName.equals("LINK") ||\r
- qName.equals("SCORE")\r
+ * Different qNames for a DAS Feature - are string keys to the HashMaps in\r
+ * features "METHOD") || qName.equals("TYPE") || qName.equals("START") ||\r
+ * qName.equals("END") || qName.equals("NOTE") || qName.equals("LINK") ||\r
+ * qName.equals("SCORE")\r
*/\r
String desc = new String();\r
if (dasfeature.containsKey("NOTE"))\r
return null;\r
}\r
}\r
+\r
/**\r
- * query the default DAS Source Registry for sources.\r
- * Uses value of jalview property DAS_REGISTRY_URL and the DasSourceBrowser.DEFAULT_REGISTRY if that doesn't exist. \r
+ * query the default DAS Source Registry for sources. Uses value of jalview\r
+ * property DAS_REGISTRY_URL and the DasSourceBrowser.DEFAULT_REGISTRY if that\r
+ * doesn't exist.\r
+ * \r
* @return list of sources\r
*/\r
public static DasSource[] getDASSources()\r
DasSourceBrowser.DEFAULT_REGISTRY);\r
return getDASSources(registryURL);\r
}\r
+\r
/**\r
* query the given URL for DasSources.\r
+ * \r
* @param registryURL\r
- * return sources from registryURL\r
+ * return sources from registryURL\r
*/\r
public static DasSource[] getDASSources(String registryURL)\r
{\r