From: jprocter Date: Tue, 24 Feb 2009 17:27:33 +0000 (+0000) Subject: bug fixes (infinite loop when fetcher given same sequence several times, race conditi... X-Git-Tag: Release_2_5~342 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=07f37fd11cf7cc2e6c04f7ad88cf7abfcbcea227;p=jalview.git bug fixes (infinite loop when fetcher given same sequence several times, race conditions when fetching features immediatly after fetching sequences) and enhanced parsing of protein_name dbref types and URL link handling for features with no label. --- diff --git a/src/jalview/ws/DasSequenceFeatureFetcher.java b/src/jalview/ws/DasSequenceFeatureFetcher.java index 56ca9ea..2448402 100644 --- a/src/jalview/ws/DasSequenceFeatureFetcher.java +++ b/src/jalview/ws/DasSequenceFeatureFetcher.java @@ -31,6 +31,7 @@ import org.biojava.dasobert.eventmodel.*; import jalview.bin.Cache; import jalview.datamodel.*; import jalview.gui.*; +import jalview.util.UrlLink; /** * DOCUMENT ME! @@ -89,12 +90,30 @@ public class DasSequenceFeatureFetcher this(sequences, fsettings, selectedSources, true, true); } - public DasSequenceFeatureFetcher(SequenceI[] sequences, + public DasSequenceFeatureFetcher(SequenceI[] oursequences, FeatureSettings fsettings, Vector selectedSources, boolean checkDbrefs, boolean promptFetchDbrefs) { - this.selectedSources = selectedSources; - this.sequences = sequences; + this.selectedSources = new Vector(); + Enumeration sources = selectedSources.elements(); + // filter both sequences and sources to eliminate duplicates + while (sources.hasMoreElements()) + { + Object src = sources.nextElement(); + if (this.selectedSources.contains(src)) { selectedSources.addElement(src); }; + } + Vector sqs = new Vector(); + for (int i=0; i 0) + { + // feature is also appended to enable links to be seen. + // TODO: consider extending dbrefs to have their own links ? + // TODO: new feature: extract dbref links from DAS servers and add the URL pattern to the list of DB name associated links in the user's preferences ? + // for the moment - just fix up the existing feature so it displays correctly. + // f.setType(dbr.getSource()); + //f.setDescription(); + f.setValue("linkonly", Boolean.TRUE); + //f.setDescription(""); + Vector newlinks = new Vector(); + Enumeration it = f.links.elements(); + while (it.hasMoreElements()) + { + String elm; + UrlLink urllink = new UrlLink(elm = (String)it.nextElement()); + if (urllink.isValid()) { + urllink.setLabel(f.getDescription()); + newlinks.addElement(urllink.toString()); + } else { + // couldn't parse the link properly. Keep it anyway - just in case. + debug("couldn't parse link string - "+elm); + newlinks.addElement(elm); + } + } + f.links = newlinks; + seq.addSequenceFeature(f); + } + return true; } - seq.addDBRef(dbr); - return true; } return false; } @@ -695,10 +777,11 @@ public class DasSequenceFeatureFetcher try { Object scr = dasfeature.get("SCORE"); - if (scr!=null) - {score = (float) Double.parseDouble(scr.toString()); - - } + if (scr != null) + { + score = (float) Double.parseDouble(scr.toString()); + + } } catch (Exception ex) { }