Search in sources :

Example 1 with PostAnalysisParameters

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

the class BaseNetworkTest method runPostAnalysis.

protected void runPostAnalysis(CyNetwork emNetwork, PostAnalysisParameters.Builder builder, String dataSetName) throws Exception {
    // Set up mocks
    when(applicationManager.getCurrentNetwork()).thenReturn(emNetwork);
    CyNetworkView networkViewMock = mock(CyNetworkView.class);
    when(applicationManager.getCurrentNetworkView()).thenReturn(networkViewMock);
    when(networkViewManager.getNetworkViews(emNetwork)).thenReturn(Arrays.asList(networkViewMock));
    @SuppressWarnings("unchecked") View<CyNode> nodeViewMock = Mockito.mock(View.class);
    when(networkViewMock.getNodeView(Matchers.<CyNode>anyObject())).thenReturn(nodeViewMock);
    when(nodeViewMock.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).thenReturn(Double.valueOf(0.0));
    EnrichmentMap map = emManager.getEnrichmentMap(emNetwork.getSUID());
    assertNotNull(map);
    // Load the gene-sets from the file
    SerialTestTaskManager testTaskManager = new SerialTestTaskManager();
    File file = new File(builder.getSignatureGMTFileName());
    LoadSignatureSetsActionListener loader = loadSignatureSetsActionListenerFactory.create(file, new FilterMetric.None(), map);
    loader.setTaskManager(testTaskManager);
    loader.setGeneSetCallback(builder::setLoadedGMTGeneSets);
    loader.setFilteredSignatureSetsCallback(builder::addSelectedGeneSetNames);
    loader.actionPerformed(null);
    PostAnalysisParameters paParams = builder.build();
    // Run post-analysis
    EMDataSet dataSet = map.getDataSet(dataSetName);
    CreateDiseaseSignatureTaskParallel signatureTask = buildDiseaseSignatureTaskFactory.create(paParams, map, Arrays.asList(dataSet));
    testTaskManager = new SerialTestTaskManager();
    testTaskManager.execute(new TaskIterator(signatureTask));
}
Also used : SerialTestTaskManager(org.baderlab.csplugins.enrichmentmap.SerialTestTaskManager) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) FilterMetric(org.baderlab.csplugins.enrichmentmap.task.postanalysis.FilterMetric) CreateDiseaseSignatureTaskParallel(org.baderlab.csplugins.enrichmentmap.task.postanalysis.CreateDiseaseSignatureTaskParallel) PostAnalysisParameters(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisParameters) TaskIterator(org.cytoscape.work.TaskIterator) LoadSignatureSetsActionListener(org.baderlab.csplugins.enrichmentmap.actions.LoadSignatureSetsActionListener) CyNode(org.cytoscape.model.CyNode) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) CyNetworkView(org.cytoscape.view.model.CyNetworkView) File(java.io.File)

Example 2 with PostAnalysisParameters

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

the class PostAnalysisPanelMediator method buildPostAnalysisParameters.

/**
	 * Creates a PostAnalysisParameters object based on the user's input.
	 */
private Optional<PostAnalysisParameters> buildPostAnalysisParameters(PostAnalysisInputPanel inputPanel, EnrichmentMap map, JDialog parent) {
    PostAnalysisParameters.Builder builder = new PostAnalysisParameters.Builder();
    List<String> messages = inputPanel.validateInput();
    if (!messages.isEmpty()) {
        ErrorMessageDialog dialog = errorMessageDialogFactory.create(parent);
        dialog.addSection(MessageType.ERROR, "Post Analysis: Error", IconManager.ICON_FILE_O, messages);
        dialog.pack();
        dialog.setLocationRelativeTo(parent);
        dialog.setModal(true);
        dialog.setVisible(true);
        return Optional.empty();
    }
    boolean built = inputPanel.build(builder);
    if (!built) {
        return Optional.empty();
    }
    builder.setAttributePrefix(map.getParams().getAttributePrefix());
    return Optional.of(builder.build());
}
Also used : ErrorMessageDialog(org.baderlab.csplugins.enrichmentmap.view.creation.ErrorMessageDialog) PostAnalysisParameters(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisParameters)

Aggregations

PostAnalysisParameters (org.baderlab.csplugins.enrichmentmap.model.PostAnalysisParameters)2 File (java.io.File)1 SerialTestTaskManager (org.baderlab.csplugins.enrichmentmap.SerialTestTaskManager)1 LoadSignatureSetsActionListener (org.baderlab.csplugins.enrichmentmap.actions.LoadSignatureSetsActionListener)1 EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)1 EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)1 CreateDiseaseSignatureTaskParallel (org.baderlab.csplugins.enrichmentmap.task.postanalysis.CreateDiseaseSignatureTaskParallel)1 FilterMetric (org.baderlab.csplugins.enrichmentmap.task.postanalysis.FilterMetric)1 ErrorMessageDialog (org.baderlab.csplugins.enrichmentmap.view.creation.ErrorMessageDialog)1 CyNode (org.cytoscape.model.CyNode)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1 TaskIterator (org.cytoscape.work.TaskIterator)1