Search in sources :

Example 6 with SimilarityMetric

use of org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric in project EnrichmentMapApp by BaderLab.

the class ResolverCommandTask method run.

@Override
public void run(TaskMonitor taskMonitor) throws Exception {
    logger.info("Running EnrichmentMap Data Set Resolver Task");
    // Scan root folder (note: throws exception if no data sets were found)
    ResolverTask resolverTask = new ResolverTask(rootFolder);
    // blocks
    taskManager.execute(new TaskIterator(resolverTask));
    List<DataSetParameters> dataSets = resolverTask.getDataSetResults();
    logger.info("resolved " + dataSets.size() + " data sets");
    dataSets.forEach(params -> logger.info(params.toString()));
    // Overwrite all the expression files if the common file has been provided
    if (commonExpressionFile != null) {
        if (!commonExpressionFile.canRead()) {
            throw new IllegalArgumentException("Cannot read commonExpressionFile: " + commonExpressionFile);
        }
        for (DataSetParameters dsp : dataSets) {
            dsp.getFiles().setExpressionFileName(commonExpressionFile.getAbsolutePath());
        }
    }
    // Overwrite all the gmt files if a common file has been provided
    if (commonGMTFile != null) {
        if (!commonGMTFile.canRead()) {
            throw new IllegalArgumentException("Cannot read commonGMTFile: " + commonGMTFile);
        }
        for (DataSetParameters dsp : dataSets) {
            dsp.getFiles().setGMTFileName(commonGMTFile.getAbsolutePath());
        }
    }
    // Create Enrichment Map
    String prefix = legacySupport.getNextAttributePrefix();
    SimilarityMetric sm = SimilarityMetric.valueOf(similarityMetric.getSelectedValue());
    NESFilter nesf = NESFilter.valueOf(nesFilter.getSelectedValue());
    String info = String.format("prefix:%s, pvalue:%f, qvalue:%f, nesFilter:%s, minExperiments:%d, similarityMetric:%s, similarityCutoff:%f, combinedConstant:%f", prefix, pvalue, qvalue, nesf, minExperiments, sm, similarityCutoff, combinedConstant);
    logger.info(info);
    EMCreationParameters params = new EMCreationParameters(prefix, pvalue, qvalue, nesf, Optional.ofNullable(minExperiments), sm, similarityCutoff, combinedConstant);
    params.setCreateDistinctEdges(distinctEdges);
    CreateEnrichmentMapTaskFactory taskFactory = taskFactoryFactory.create(params, dataSets);
    TaskIterator tasks = taskFactory.createTaskIterator();
    taskManager.execute(tasks);
    logger.info("Done.");
}
Also used : EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) TaskIterator(org.cytoscape.work.TaskIterator) CreateEnrichmentMapTaskFactory(org.baderlab.csplugins.enrichmentmap.task.CreateEnrichmentMapTaskFactory) DataSetParameters(org.baderlab.csplugins.enrichmentmap.resolver.DataSetParameters) SimilarityMetric(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric) NESFilter(org.baderlab.csplugins.enrichmentmap.model.EnrichmentResultFilterParams.NESFilter) ResolverTask(org.baderlab.csplugins.enrichmentmap.resolver.ResolverTask)

Aggregations

SimilarityMetric (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric)6 EMCreationParameters (org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters)4 DataSetParameters (org.baderlab.csplugins.enrichmentmap.resolver.DataSetParameters)4 CreateEnrichmentMapTaskFactory (org.baderlab.csplugins.enrichmentmap.task.CreateEnrichmentMapTaskFactory)4 ArrayList (java.util.ArrayList)3 DataSetFiles (org.baderlab.csplugins.enrichmentmap.model.DataSetFiles)3 NESFilter (org.baderlab.csplugins.enrichmentmap.model.EnrichmentResultFilterParams.NESFilter)3 Inject (com.google.inject.Inject)2 Map (java.util.Map)2 Optional (java.util.Optional)2 GroupLayout (javax.swing.GroupLayout)2 Alignment (javax.swing.GroupLayout.Alignment)2 JCheckBox (javax.swing.JCheckBox)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 ResolverTask (org.baderlab.csplugins.enrichmentmap.resolver.ResolverTask)2 SwingUtil (org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil)2 TaskIterator (org.cytoscape.work.TaskIterator)2 Strings.isNullOrEmpty (com.google.common.base.Strings.isNullOrEmpty)1 Provider (com.google.inject.Provider)1