package jalview.ws;
import jalview.analysis.AlignSeq;
+import jalview.api.FeatureSettingsModelI;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
Arrays.asList(dataset));
List<String> warningMessages = new ArrayList<>();
+ // clear any old feature display settings recorded from past sessions
+ featureDisplaySettings = null;
+
int db = 0;
while (sdataset.size() > 0 && db < dbSources.length)
{
}
if (retrieved != null)
{
- transferReferences(sdataset, dbsource.getDbSource(), retrieved,
+ transferReferences(sdataset, dbsource, retrieved,
trimDsSeqs, warningMessages);
}
}
* @param warningMessages
* a list of messages to add to
*/
- boolean transferReferences(Vector<SequenceI> sdataset, String dbSource,
+ boolean transferReferences(Vector<SequenceI> sdataset,
+ DbSourceProxy dbSourceProxy,
AlignmentI retrievedAl, boolean trimDatasetSeqs,
List<String> warningMessages)
{
return false;
}
+ String dbSource = dbSourceProxy.getDbName();
boolean modified = false;
SequenceI[] retrieved = recoverDbSequences(
retrievedAl.getSequencesArray());
* seqs.elementAt(jj); if (!sequenceMatches.contains(sequence)) {
* sequenceMatches.addElement(sequence); } } } }
*/
+ if (sequenceMatches.size() > 0)
+ {
+ addFeatureSettings(dbSourceProxy);
+ }
// sequenceMatches now contains the set of all sequences associated with
// the returned db record
final String retrievedSeqString = retrievedSeq.getSequenceAsString();
return modified;
}
+ Map<String, FeatureSettingsModelI> featureDisplaySettings = null;
+
+ private void addFeatureSettings(DbSourceProxy dbSourceProxy)
+ {
+ FeatureSettingsModelI fsettings = dbSourceProxy
+ .getFeatureColourScheme();
+ if (fsettings != null)
+ {
+ if (featureDisplaySettings == null)
+ {
+ featureDisplaySettings = new HashMap<>();
+ }
+ featureDisplaySettings.put(dbSourceProxy.getDbName(), fsettings);
+ }
+ }
+
+ /**
+ *
+ * @return any feature settings associated with sources that have provided sequences
+ */
+ public List<FeatureSettingsModelI>getFeatureSettingsModels()
+ {
+ return featureDisplaySettings == null
+ ? Arrays.asList(new FeatureSettingsModelI[0])
+ : Arrays.asList(featureDisplaySettings.values()
+ .toArray(new FeatureSettingsModelI[1]));
+ }
/**
* Adds the message to the list unless it already contains it
*