Skip to content

Commit 3ae048c

Browse files
committed
Build command accepts 'coeffecients' for backwards compatibility.
1 parent e044765 commit 3ae048c

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/EMBuildCommandTask.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ public class EMBuildCommandTask extends AbstractTask {
154154
@Tunable(description = "Similarity Coeffecient", groups = { "User Input", "Parameters" }, gravity = 20.0, tooltip = "coeffecient between 0 and 1.")
155155
public ListSingleSelection<String> coefficients;
156156

157+
@Tunable(description = "Deprecated, use 'coefficients' instead.")
158+
public ListSingleSelection<String> coeffecients; // misspelled, but must keep for backwards compatibility
159+
157160
@Tunable
158161
public double combinedConstant = LegacySupport.combinedConstant_default;
159162

@@ -185,21 +188,38 @@ public EMBuildCommandTask() {
185188
coefficients = new ListSingleSelection<String>(EnrichmentMapParameters.SM_OVERLAP,
186189
EnrichmentMapParameters.SM_JACCARD, EnrichmentMapParameters.SM_COMBINED);
187190

191+
coeffecients = new ListSingleSelection<String>("null", EnrichmentMapParameters.SM_OVERLAP,
192+
EnrichmentMapParameters.SM_JACCARD, EnrichmentMapParameters.SM_COMBINED);
193+
194+
188195
edgeStrategy = ResolverCommandTask.enumNames(EdgeStrategy.values());
189196
edgeStrategy.setSelectedValue(EdgeStrategy.AUTOMATIC.name());
190197

191198
nesFilter = ResolverCommandTask.enumNames(NESFilter.values());
192199
nesFilter.setSelectedValue(NESFilter.ALL.name());
193200
}
201+
194202

203+
private SimilarityMetric getSimilarityMetric() {
204+
String value;
205+
if(!"null".equals(coeffecients.getSelectedValue())) {
206+
// the old field overrides the new field
207+
value = coeffecients.getSelectedValue();
208+
} else {
209+
value = coefficients.getSelectedValue();
210+
}
211+
212+
return EnrichmentMapParameters.stringToSimilarityMetric(value);
213+
}
214+
195215

196216
/**
197217
* buildEnrichmentMap - parses all GSEA input files and creates an enrichment map
198218
*/
199219
public void buildEnrichmentMap() {
200220
// Note we must continue to use the old constants from EnrichmentMapParameters for backwards compatibility
201221
Method method = EnrichmentMapParameters.stringToMethod(analysisType.getSelectedValue());
202-
SimilarityMetric metric = EnrichmentMapParameters.stringToSimilarityMetric(coefficients.getSelectedValue());
222+
SimilarityMetric metric = getSimilarityMetric();
203223

204224
//Set Dataset1 Files
205225
DataSetFiles dataset1files = new DataSetFiles();

0 commit comments

Comments
 (0)