├── .gitignore ├── .project ├── EnrichmentMapIntegrationTest ├── .classpath ├── .gitignore ├── .project ├── .settings │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.m2e.core.prefs ├── pom.xml └── src │ └── test │ ├── java │ ├── README.md │ └── org │ │ └── baderlab │ │ └── csplugins │ │ └── enrichmentmap │ │ └── integration │ │ ├── BaseIntegrationTest.java │ │ ├── EdgeSimilarities.java │ │ ├── NullTaskMonitor.java │ │ ├── PaxExamConfiguration.java │ │ ├── SerialTestTaskManager.java │ │ ├── SessionFile.java │ │ ├── SimilarityKey.java │ │ ├── TestUtils.java │ │ └── task │ │ ├── CreateEnrichmentMapTaskTest.java │ │ ├── LegacySessionLoadTest.java │ │ └── Protocol1Test.java │ └── resources │ ├── EnrichmentMapTaskTest │ ├── FakeExpression.txt │ ├── FakeRank.rnk │ ├── PA_top8_middle8_bottom8.gmt │ ├── fakeEnrichments.txt │ └── gene_sets.gmt │ ├── LegacySessionLoadTest │ ├── em_session_2.2.cys │ ├── em_session_2.2_twodataset.cys │ └── em_session_2.2_twodataset_pa.cys │ └── Protocol1Test │ ├── gprofiler_results_mesenonly_ordered_computedinR.txt │ └── protocol_1_expected.xgmml ├── EnrichmentMapPlugin ├── .classpath ├── .gitignore ├── .project ├── build.xml ├── default.properties ├── doc │ ├── Doc on Cytoscape-Props relevant for EnrichmentMap.txt │ ├── EM_wiki_manual.txt │ ├── LGPL_2.1_Disclaimer_for_src_headers.txt │ ├── LGPL_2.1_LICENSE.txt │ └── README.TXT ├── pom.xml ├── resources │ ├── EM_EBC_TestData │ │ ├── EnrTable_12h_E2_v2.xls │ │ ├── EnrTable_12h_NT_v2.xls │ │ ├── EnrTable_24h_E2_v2.xls │ │ ├── EnrTable_24h_NT_v2.xls │ │ ├── GO_Hs_EG_f_hgu133p2_v2.gmt │ │ └── MCF7_ExprMx_v2.txt │ ├── Graphics_for_Manual │ │ ├── Hypergeometric_test.png │ │ ├── PostAnalysis_InputPanel_SignatureHubs_screenshot.ai │ │ ├── PostAnalysis_InputPanel_SignatureHubs_screenshot.png │ │ ├── PostAnalysis_InputPanel_SignatureHubs_screenshot_withLabels.png │ │ └── PostAnalysis_InputPanel_SignatureHubs_screenshot_withLabels_smaller.png │ └── scripts │ │ ├── collapse_ExpressionMatrix.py │ │ ├── disease_hub.py │ │ └── disease_hub_2.py └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── baderlab │ │ │ └── csplugins │ │ │ └── enrichmentmap │ │ │ ├── AfterInjection.java │ │ │ ├── AfterInjectionModule.java │ │ │ ├── ApplicationModule.java │ │ │ ├── CommandModule.java │ │ │ ├── CommandTaskFactory.java │ │ │ ├── CyActivator.java │ │ │ ├── CytoscapeServiceModule.java │ │ │ ├── EMBuildProps.java │ │ │ ├── Em21Handler.java │ │ │ ├── PropertyManager.java │ │ │ ├── PropsReader.java │ │ │ ├── actions │ │ │ ├── OpenEnrichmentMapAction.java │ │ │ ├── OpenEnrichmentMapPanelsAction.java │ │ │ ├── OpenPathwayCommonsTask.java │ │ │ ├── OpenPathwayCommonsTaskFactory.java │ │ │ └── ShowAboutDialogAction.java │ │ │ ├── commands │ │ │ ├── AssociateNetworkCommandTask.java │ │ │ ├── ChartCommandTask.java │ │ │ ├── DatasetColorCommandTask.java │ │ │ ├── DatasetShowCommandTask.java │ │ │ ├── EMBuildCommandTask.java │ │ │ ├── EMGseaCommandTask.java │ │ │ ├── ExportModelJsonCommandTask.java │ │ │ ├── ExportNetworkImageCommandTask.java │ │ │ ├── ExportPDFCommandTask.java │ │ │ ├── GetColorsCommandTask.java │ │ │ ├── GetDataSetNamesCommandTask.java │ │ │ ├── MastermapCommandTask.java │ │ │ ├── MastermapListCommandTask.java │ │ │ ├── PAKnownSignatureCommandTask.java │ │ │ ├── SignificanceListTask.java │ │ │ ├── TableCommandTask.java │ │ │ └── tunables │ │ │ │ ├── ChartTunables.java │ │ │ │ ├── DatasetColorTunable.java │ │ │ │ ├── DatasetListTunable.java │ │ │ │ ├── FilterTunables.java │ │ │ │ ├── FilterTunablesLegacy.java │ │ │ │ ├── MannWhitRanks.java │ │ │ │ ├── MannWhitRanksTunableHandler.java │ │ │ │ ├── MannWhitRanksTunableHandlerFactory.java │ │ │ │ ├── NetworkTunable.java │ │ │ │ ├── NodeListTunable.java │ │ │ │ └── TableTunables.java │ │ │ ├── model │ │ │ ├── AbstractDataSet.java │ │ │ ├── AssociatedApp.java │ │ │ ├── AssociatedAppColumns.java │ │ │ ├── Compress.java │ │ │ ├── CompressedClass.java │ │ │ ├── CompressedDataSet.java │ │ │ ├── DataSetFiles.java │ │ │ ├── DataSetParameters.java │ │ │ ├── EMCreationParameters.java │ │ │ ├── EMDataSet.java │ │ │ ├── EMSignatureDataSet.java │ │ │ ├── EnrichmentMap.java │ │ │ ├── EnrichmentMapManager.java │ │ │ ├── EnrichmentMapParameters.java │ │ │ ├── EnrichmentResult.java │ │ │ ├── EnrichmentResultFilterParams.java │ │ │ ├── ExpressionCache.java │ │ │ ├── ExpressionData.java │ │ │ ├── GSEAResult.java │ │ │ ├── GeneExpression.java │ │ │ ├── GeneExpressionMatrix.java │ │ │ ├── GeneSet.java │ │ │ ├── GenemaniaParameters.java │ │ │ ├── GenericResult.java │ │ │ ├── GenesetSimilarity.java │ │ │ ├── LegacySupport.java │ │ │ ├── PhenotypeHighlight.java │ │ │ ├── PostAnalysisFilterType.java │ │ │ ├── PostAnalysisParameters.java │ │ │ ├── Rank.java │ │ │ ├── Ranking.java │ │ │ ├── SetOfEnrichmentResults.java │ │ │ ├── SetOfGeneSets.java │ │ │ ├── SignatureGenesetSimilarity.java │ │ │ ├── SimilarityKey.java │ │ │ ├── TableExpressionParameters.java │ │ │ ├── TableParameters.java │ │ │ ├── Transform.java │ │ │ ├── Uncompressed.java │ │ │ ├── UniverseType.java │ │ │ ├── event │ │ │ │ ├── AssociatedEnrichmentMapsChangedEvent.java │ │ │ │ ├── AssociatedEnrichmentMapsChangedListener.java │ │ │ │ ├── EnrichmentMapAboutToBeRemovedEvent.java │ │ │ │ ├── EnrichmentMapAboutToBeRemovedListener.java │ │ │ │ ├── EnrichmentMapAddedEvent.java │ │ │ │ └── EnrichmentMapAddedListener.java │ │ │ └── io │ │ │ │ ├── LegacySessionLoader.java │ │ │ │ ├── ModelSerializer.java │ │ │ │ ├── SessionListener.java │ │ │ │ └── SessionModelIO.java │ │ │ ├── parsers │ │ │ ├── ClassFileReaderTask.java │ │ │ ├── ExpressionFileReaderTask.java │ │ │ ├── GMTFileReaderTask.java │ │ │ ├── GREATWhichPvalueQuestionTask.java │ │ │ ├── LineReader.java │ │ │ ├── LoadEnrichmentsFromGenemaniaTask.java │ │ │ ├── LoadEnrichmentsFromTableTask.java │ │ │ ├── LoadExpressionsFromTableTask.java │ │ │ ├── ParseBingoEnrichmentResults.java │ │ │ ├── ParseDavidEnrichmentResults.java │ │ │ ├── ParseEDBEnrichmentResults.java │ │ │ ├── ParseEnrichrEnrichmentResults.java │ │ │ ├── ParseGREATEnrichmentResults.java │ │ │ ├── ParseGSEAEnrichmentException.java │ │ │ ├── ParseGSEAEnrichmentResults.java │ │ │ ├── ParseGenericEnrichmentResults.java │ │ │ ├── ParseGenericEnrichmentsForDummy.java │ │ │ ├── RanksFileReaderTask.java │ │ │ ├── RanksGeneMismatchException.java │ │ │ └── RanksUnsortedException.java │ │ │ ├── resolver │ │ │ ├── CancelStatus.java │ │ │ ├── DataSetResolver.java │ │ │ ├── DataSetResolverTask.java │ │ │ └── GSEAResolver.java │ │ │ ├── rest │ │ │ ├── ExpressionsResource.java │ │ │ ├── ModelResource.java │ │ │ ├── ResourceUtil.java │ │ │ ├── UploadFileResource.java │ │ │ └── response │ │ │ │ ├── DataSetClassResponse.java │ │ │ │ ├── DataSetExpressionResponse.java │ │ │ │ ├── ExpressionDataResponse.java │ │ │ │ └── GeneExpressionResponse.java │ │ │ ├── style │ │ │ ├── AbstractColumnDescriptor.java │ │ │ ├── AssociatedStyleBuilder.java │ │ │ ├── AssociatedStyleOptions.java │ │ │ ├── ChartData.java │ │ │ ├── ChartFactoryManager.java │ │ │ ├── ChartOptions.java │ │ │ ├── ChartType.java │ │ │ ├── ColorScheme.java │ │ │ ├── ColumnDescriptor.java │ │ │ ├── ColumnListDescriptor.java │ │ │ ├── EMStyleBuilder.java │ │ │ ├── EMStyleOptions.java │ │ │ ├── NullCustomGraphics.java │ │ │ ├── WidthFunction.java │ │ │ └── charts │ │ │ │ ├── AbstractChart.java │ │ │ │ ├── AbstractChartLayer.java │ │ │ │ ├── CustomPieSectionLabelGenerator.java │ │ │ │ ├── LabelPosition.java │ │ │ │ ├── Orientation.java │ │ │ │ ├── Rotation.java │ │ │ │ ├── TexturePaintFactory.java │ │ │ │ ├── json │ │ │ │ ├── ColorJsonDeserializer.java │ │ │ │ ├── ColorJsonSerializer.java │ │ │ │ ├── CyColumnIdentifierJsonDeserializer.java │ │ │ │ ├── CyColumnIdentifierJsonSerializer.java │ │ │ │ ├── Point2DJsonDeserializer.java │ │ │ │ ├── Point2DJsonSerializer.java │ │ │ │ ├── PropertiesJsonDeserializer.java │ │ │ │ ├── PropertiesJsonSerializer.java │ │ │ │ ├── Rectangle2DJsonDeserializer.java │ │ │ │ └── Rectangle2DJsonSerializer.java │ │ │ │ └── radialheatmap │ │ │ │ ├── RadialHeatMapChart.java │ │ │ │ ├── RadialHeatMapChartFactory.java │ │ │ │ └── RadialHeatMapLayer.java │ │ │ ├── task │ │ │ ├── ApplyEMStyleTask.java │ │ │ ├── AutoAnnotateInitTask.java │ │ │ ├── AutoAnnotateOpenTask.java │ │ │ ├── AutoAnnotateRedrawTask.java │ │ │ ├── CancellableParallelTask.java │ │ │ ├── ComputeSimilarityTaskParallel.java │ │ │ ├── CreateDummyExpressionTask.java │ │ │ ├── CreateEMNetworkTask.java │ │ │ ├── CreateEMViewTask.java │ │ │ ├── CreateEnrichmentMapTaskFactory.java │ │ │ ├── CreateGMTEnrichmentMapTask.java │ │ │ ├── FilterGenesetsByDatasetGenes.java │ │ │ ├── FilterNodesEdgesTask.java │ │ │ ├── InitializeGenesetsOfInterestTask.java │ │ │ ├── MissingGenesetsException.java │ │ │ ├── ModelCleanupTask.java │ │ │ ├── SelectNodesEdgesTask.java │ │ │ ├── TaskErrorStrategies.java │ │ │ ├── TitleTask.java │ │ │ ├── UpdateAssociatedStyleTask.java │ │ │ ├── cluster │ │ │ │ ├── CosineDistance.java │ │ │ │ ├── EuclideanDistance.java │ │ │ │ ├── HierarchicalClusterTask.java │ │ │ │ └── PearsonCorrelation.java │ │ │ ├── genemania │ │ │ │ ├── GMGene.java │ │ │ │ ├── GMOrganism.java │ │ │ │ ├── GMOrganismsResult.java │ │ │ │ ├── GMSearchResult.java │ │ │ │ ├── GMWeightingMethod.java │ │ │ │ ├── GeneManiaTaskFactory.java │ │ │ │ ├── QueryGeneManiaNodeViewTaskFactory.java │ │ │ │ └── QueryGeneManiaTask.java │ │ │ ├── postanalysis │ │ │ │ ├── CreatePANetworkTask.java │ │ │ │ ├── CreatePANetworkTaskResult.java │ │ │ │ ├── FilterMetric.java │ │ │ │ ├── FilterMetricSet.java │ │ │ │ ├── Hypergeometric.java │ │ │ │ ├── PAMostSimilarTaskParallel.java │ │ │ │ ├── PASimilarityTaskParallel.java │ │ │ │ ├── PATaskFactory.java │ │ │ │ └── RemoveSignatureDataSetsTask.java │ │ │ ├── string │ │ │ │ ├── QueryStringNodeViewTaskFactory.java │ │ │ │ ├── QueryStringTask.java │ │ │ │ ├── STRSpecies.java │ │ │ │ └── StringAppTaskFactory.java │ │ │ └── tunables │ │ │ │ ├── GeneListGUITunableHandler.java │ │ │ │ ├── GeneListPanel.java │ │ │ │ └── GeneListTunable.java │ │ │ ├── util │ │ │ ├── Baton.java │ │ │ ├── CoalesceTimer.java │ │ │ ├── DelegatingTaskMonitor.java │ │ │ ├── DiscreteTaskMonitor.java │ │ │ ├── LinearNumberInterpolator.java │ │ │ ├── MathUtil.java │ │ │ ├── NamingUtil.java │ │ │ ├── NetworkUtil.java │ │ │ ├── NullTaskMonitor.java │ │ │ ├── PathUtil.java │ │ │ ├── SimpleSyncTaskManager.java │ │ │ └── TaskUtil.java │ │ │ └── view │ │ │ ├── AboutDialog.java │ │ │ ├── EMColumnPresentation.java │ │ │ ├── EnablementComboBoxRenderer.java │ │ │ ├── control │ │ │ ├── ControlPanel.java │ │ │ ├── ControlPanelMediator.java │ │ │ ├── DataSetColorSelectorDialog.java │ │ │ ├── DataSetSelector.java │ │ │ ├── FilterUtil.java │ │ │ ├── SortedListModel.java │ │ │ └── io │ │ │ │ ├── SessionViewIO.java │ │ │ │ ├── ViewParams.java │ │ │ │ └── ViewSerializer.java │ │ │ ├── creation │ │ │ ├── CombinedConstantSlider.java │ │ │ ├── CommandDisplayMediator.java │ │ │ ├── CreationDialogParameters.java │ │ │ ├── CreationDialogShowAction.java │ │ │ ├── CutoffPropertiesPanel.java │ │ │ ├── DependencyChecker.java │ │ │ ├── DetailCommonPanel.java │ │ │ ├── DetailDataSetPanel.java │ │ │ ├── DetailGettingStartedPanel.java │ │ │ ├── DetailPanel.java │ │ │ ├── EMDialogTaskRunner.java │ │ │ ├── MasterDetailDialogPage.java │ │ │ ├── NameAndLayoutPanel.java │ │ │ ├── NamePanel.java │ │ │ ├── PathTextField.java │ │ │ ├── ResolverTaskTransferHandler.java │ │ │ ├── SimilaritySlider.java │ │ │ └── genemania │ │ │ │ ├── GenemaniaAnnotation.java │ │ │ │ ├── GenemaniaDialogPage.java │ │ │ │ ├── GenemaniaDialogParameters.java │ │ │ │ ├── GenemaniaDialogShowAction.java │ │ │ │ ├── NetworkLoadDialogPage.java │ │ │ │ ├── StringDialogPage.java │ │ │ │ ├── StringDialogParameters.java │ │ │ │ └── StringDialogShowAction.java │ │ │ ├── heatmap │ │ │ ├── AddRanksDialog.java │ │ │ ├── BasicRankingOption.java │ │ │ ├── ClusterRankingOption.java │ │ │ ├── ExportPDFAction.java │ │ │ ├── ExportPDFTask.java │ │ │ ├── ExportTXTAction.java │ │ │ ├── ExportTXTTask.java │ │ │ ├── GSEALeadingEdgeRankingOption.java │ │ │ ├── HeatMapContentPanel.java │ │ │ ├── HeatMapMediator.java │ │ │ ├── HeatMapPanel.java │ │ │ ├── HeatMapParams.java │ │ │ ├── OptionsPopup.java │ │ │ ├── RankingOption.java │ │ │ ├── RankingOptionFactory.java │ │ │ ├── RankingResult.java │ │ │ └── table │ │ │ │ ├── ColumnHeaderRankOptionRenderer.java │ │ │ │ ├── ColumnHeaderVerticalRenderer.java │ │ │ │ ├── DataSetColorRange.java │ │ │ │ ├── GradientLegendPanel.java │ │ │ │ ├── GradientLegendPopup.java │ │ │ │ ├── GradientLegendToolTip.java │ │ │ │ ├── GradientLegendToolbarPanel.java │ │ │ │ ├── HeatMapCellRenderer.java │ │ │ │ ├── HeatMapRowSorter.java │ │ │ │ ├── HeatMapTableModel.java │ │ │ │ ├── RankOptionErrorHeader.java │ │ │ │ ├── RankValue.java │ │ │ │ ├── RankValueRenderer.java │ │ │ │ └── VerticalTextIcon.java │ │ │ ├── legend │ │ │ ├── ColorLegendPanel.java │ │ │ ├── CreationParametersPanel.java │ │ │ ├── ExportLegendPDFTask.java │ │ │ ├── LegendContent.java │ │ │ ├── LegendPanel.java │ │ │ └── LegendPanelMediator.java │ │ │ ├── postanalysis │ │ │ ├── EdgeWidthDialog.java │ │ │ ├── PADialogMediator.java │ │ │ ├── PADialogPage.java │ │ │ ├── PADialogParameters.java │ │ │ ├── PAFilterDialog.java │ │ │ ├── PAWeightPanel.java │ │ │ ├── SigGeneSetCellRenderer.java │ │ │ ├── SigGeneSetDescriptor.java │ │ │ ├── SigGeneSetTableModel.java │ │ │ └── web │ │ │ │ ├── BaderlabDialogPage.java │ │ │ │ ├── BaderlabRequests.java │ │ │ │ ├── DateDir.java │ │ │ │ ├── DialogParameters.java │ │ │ │ ├── DownloadGMTFileTask.java │ │ │ │ ├── FileChooserPanel.java │ │ │ │ ├── FileSizeRenderer.java │ │ │ │ ├── GmtFile.java │ │ │ │ ├── ListFileChooserPanel.java │ │ │ │ └── TreeFileChooserPanel.java │ │ │ └── util │ │ │ ├── ChartUtil.java │ │ │ ├── CheckboxData.java │ │ │ ├── CheckboxList.java │ │ │ ├── CheckboxListModel.java │ │ │ ├── ColorKeyword.java │ │ │ ├── ColorUtil.java │ │ │ ├── ComboItem.java │ │ │ ├── FileBrowser.java │ │ │ ├── GBCFactory.java │ │ │ ├── HSLColor.java │ │ │ ├── IconUtil.java │ │ │ ├── IterableListModel.java │ │ │ ├── Labels.java │ │ │ ├── OpenBrowser.java │ │ │ ├── OpenPDFViewerTask.java │ │ │ ├── Range.java │ │ │ ├── SliderBarPanel.java │ │ │ ├── SwingUtil.java │ │ │ └── dialog │ │ │ ├── CardDialog.java │ │ │ ├── CardDialogCallback.java │ │ │ ├── CardDialogPage.java │ │ │ ├── CardDialogParameters.java │ │ │ ├── CardDialogShowAction.java │ │ │ ├── ErrorMessageDialog.java │ │ │ └── Message.java │ └── resources │ │ ├── fonts │ │ └── enrichmentmap.ttf │ │ ├── images │ │ ├── enrichmentmap_logo.png │ │ ├── enrichmentmap_logo.svg │ │ ├── enrichmentmap_logo_16.png │ │ ├── folder_button.png │ │ ├── radialheatmap-chart.png │ │ ├── spinner_16.gif │ │ └── spinner_24.gif │ │ └── org │ │ └── baderlab │ │ └── csplugins │ │ └── enrichmentmap │ │ ├── app.props │ │ └── revision.props │ ├── support │ └── java │ │ └── org │ │ └── baderlab │ │ └── csplugins │ │ ├── brainlib │ │ ├── AvgLinkHierarchicalClustering.java │ │ ├── DistanceMatrix.java │ │ ├── DistanceMetric.java │ │ └── HierarchicalClusteringResultTree.java │ │ ├── mannwhit │ │ ├── MannWhitneyMemoized.java │ │ ├── MannWhitneyTestResult.java │ │ └── MannWhitneyUTestSided.java │ │ ├── org │ │ └── mskcc │ │ │ └── colorgradient │ │ │ ├── ColorGradientRange.java │ │ │ ├── ColorGradientTheme.java │ │ │ └── ColorGradientWidget.java │ │ └── prefuse │ │ ├── data │ │ └── query │ │ │ └── NumberRangeModel.java │ │ └── util │ │ ├── TypeLib.java │ │ └── ui │ │ ├── JRangeSlider.java │ │ ├── JRangeSliderExtended.java │ │ └── ValuedRangeModel.java │ └── test │ ├── java │ └── org │ │ └── baderlab │ │ └── csplugins │ │ └── enrichmentmap │ │ ├── EdgeSimilarities.java │ │ ├── HypergeometricTest.java │ │ ├── LogSilenceRule.java │ │ ├── MannWhitneyRankSumTest.java │ │ ├── SerialTestTaskManager.java │ │ ├── StreamUtil.java │ │ ├── TestUtils.java │ │ ├── actions │ │ └── OpenPathwayCommonsTaskTest.java │ │ ├── heatmap │ │ └── HeatMapRanksTest.java │ │ ├── model │ │ ├── EnrichmentMapTest.java │ │ ├── EnrichmentResultTest.java │ │ ├── ExpressionOpsTest.java │ │ ├── GeneSetSimilarityTest.java │ │ ├── GeneSetTest.java │ │ ├── ModelSerializerTest.java │ │ ├── ModelSharingTest.java │ │ ├── SetOfGenesetsTest.java │ │ └── SimilarityKeyTest.java │ │ ├── parsers │ │ └── FileReaderTest.java │ │ ├── rest │ │ └── ExpressionResourceTest.java │ │ ├── style │ │ └── ApplyStyleTest.java │ │ ├── task │ │ ├── BaseNetworkTest.java │ │ ├── GprofilerDummyExpressionTest.java │ │ ├── LoadBingoResultsTest.java │ │ ├── LoadDatasetTaskTest.java │ │ ├── LoadDavidResultTest.java │ │ ├── LoadEdbDatasetTest.java │ │ ├── LoadGMTFileOnlyTest.java │ │ ├── PostAnalysisCutoffTest.java │ │ ├── PostAnalysisTaskTest.java │ │ └── TableLoadNetworkTest.java │ │ └── util │ │ ├── LinearNumberInterpolatorTest.java │ │ ├── NamingUtilTest.java │ │ └── PathUtilTest.java │ └── resources │ └── org │ └── baderlab │ └── csplugins │ └── enrichmentmap │ ├── BingoResults.bgo │ ├── DavidResults.txt │ ├── ExpressionTestFile.rnk │ ├── ExpressionTestFile_edbrnk.rnk │ ├── Expressiontestfile.gct │ ├── Expressiontestfile_comments.gct │ ├── Expressiontestfile_gseagct.gct │ ├── GSEA_enrichments1.xls │ ├── GSEA_enrichments2.xls │ ├── Genesetstestfile.gmt │ ├── Human_GO_AllPathways_with_GO_iea_symbol.gmt │ ├── HypergeometricTest_pvalues.csv │ ├── MannWhitneyTest_pvalues.csv │ ├── Mouse_GO_AllPathways_with_GO_iea_symbol.gmt │ ├── generic_enr_5col.txt │ ├── model │ └── Genesetstestfile.gmt │ └── task │ ├── EMandPA │ ├── FakeExpression.txt │ ├── FakeRank.rnk │ ├── FakeRank2.rnk │ ├── PA_top8_middle8_bottom8.gmt │ ├── fakeEnrichments.txt │ └── gene_sets.gmt │ ├── Extrogen_Expression_file.txt │ ├── LoadDataset │ ├── 8w_r9c_vs_wt_SN.cls │ ├── Expressiontestfile.gct │ ├── GSEA_enrichments1.xls │ ├── GSEA_enrichments2.xls │ ├── GSEA_example_results │ │ └── edb │ │ │ ├── 8w_r9c_vs_wt_SN.cls │ │ │ ├── Expressiontestfile.rnk │ │ │ ├── gene_sets.gmt │ │ │ └── results.edb │ └── gs_apop_mouse.gmt │ ├── bingo_output │ ├── 12Hr_topgenes.bgo │ ├── 24Hr_topgenes.bgo │ └── test_cluster.bgo │ ├── david_output │ ├── 12hr_David_Output.txt │ └── 24hr_David_Output.txt │ ├── genesets_subset.gmt │ ├── gprofiler │ ├── Supplementary_Table4_gprofiler_results.txt │ └── Supplementary_Table5_hsapiens.pathways.NAME.gmt │ └── tutorial │ ├── ES_NT.cls │ ├── Human_GO_AllPathways_no_GO_iea_April_15_2013_symbol.gmt │ ├── MCF7_ExprMx_v2_names.gct │ ├── gene_order_leading_edge.txt │ ├── gsea_report_for_ES12_1473194913081.xls │ ├── gsea_report_for_NT12_1473194913081.xls │ └── ranked_gene_list_ES12_versus_NT12_1473194913081.xls ├── LICENSE.md ├── README.md └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | .DS_Store 3 | 4 | # Package Files # 5 | *.jar 6 | *.war 7 | *.ear 8 | .settings 9 | 10 | #ignore anything in the compiled directory 11 | target/**/* 12 | DataForVictor/ 13 | Mockupinterfaces/ 14 | /target 15 | _build 16 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | enrichmentmap-parent 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /bin/ 3 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | EnrichmentMapIntegrationTest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 3 | org.eclipse.jdt.core.compiler.compliance=11 4 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 7 | org.eclipse.jdt.core.compiler.release=disabled 8 | org.eclipse.jdt.core.compiler.source=11 9 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/java/README.md: -------------------------------------------------------------------------------- 1 | Some Notes 2 | 3 | Protocol tests are based on the Enrichment Map Protocols from the EM-tutorial-docker repository. 4 | 5 | Pax Exam 6 | 7 | - Can't figure out how to reuse utility classes from enrichmentmap-app in the integration tests so they had to be copied. 8 | - For some reason using the same package names was causing NoClassDefFoundErrors, so I added 'integration' to the package names. 9 | - Note: These are not unit tests, so the trick of using the same package names is not necessary. -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/java/org/baderlab/csplugins/enrichmentmap/integration/NullTaskMonitor.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.integration; 2 | 3 | import org.cytoscape.work.TaskMonitor; 4 | 5 | public class NullTaskMonitor implements TaskMonitor { 6 | 7 | @Override 8 | public void setTitle(String title) { 9 | } 10 | 11 | @Override 12 | public void setProgress(double progress) { 13 | } 14 | 15 | @Override 16 | public void setStatusMessage(String statusMessage) { 17 | } 18 | 19 | @Override 20 | public void showMessage(Level level, String message) { 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/java/org/baderlab/csplugins/enrichmentmap/integration/SessionFile.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.integration; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) //can use in method only. 10 | public @interface SessionFile { 11 | String value(); 12 | } 13 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/java/org/baderlab/csplugins/enrichmentmap/integration/SimilarityKey.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.integration; 2 | 3 | import java.util.Objects; 4 | 5 | public class SimilarityKey { 6 | 7 | private final String geneSet1; 8 | private final String interaction; 9 | private final String geneSet2; 10 | 11 | public SimilarityKey(String geneSet1, String interaction, String geneSet2) { 12 | Objects.requireNonNull(geneSet1); 13 | Objects.requireNonNull(interaction); 14 | Objects.requireNonNull(geneSet2); 15 | this.geneSet1 = geneSet1; 16 | this.interaction = interaction; 17 | this.geneSet2 = geneSet2; 18 | } 19 | 20 | public static SimilarityKey parse(String name) { 21 | int open = name.indexOf("("); 22 | int close = name.indexOf(")", open); 23 | String name1 = name.substring(0, open).trim(); 24 | String name2 = name.substring(close+1, name.length()).trim(); 25 | String interaction = name.substring(open+1, close); 26 | return new SimilarityKey(name1, interaction, name2); 27 | } 28 | 29 | public String getGeneSet1() { 30 | return geneSet1; 31 | } 32 | 33 | public String getGeneSet2() { 34 | return geneSet2; 35 | } 36 | 37 | public String getInteraction() { 38 | return interaction; 39 | } 40 | 41 | public SimilarityKey swap() { 42 | return new SimilarityKey(geneSet2, interaction, geneSet1); 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return geneSet1.hashCode() + interaction.hashCode() + geneSet2.hashCode(); 48 | } 49 | 50 | @Override 51 | public boolean equals(Object o) { 52 | if(!(o instanceof SimilarityKey)) 53 | return false; 54 | SimilarityKey other = (SimilarityKey)o; 55 | 56 | if(!interaction.equals(other.interaction)) 57 | return false; 58 | 59 | return 60 | (geneSet1.equals(other.geneSet1) && geneSet2.equals(other.geneSet2)) 61 | || (geneSet1.equals(other.geneSet2) && geneSet2.equals(other.geneSet1)); 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return geneSet1 + " (" + interaction + ") " + geneSet2; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/java/org/baderlab/csplugins/enrichmentmap/integration/TestUtils.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.integration; 2 | 3 | import static org.junit.Assert.assertNotNull; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.nio.file.Files; 9 | import java.nio.file.StandardCopyOption; 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | import org.cytoscape.model.CyEdge; 14 | import org.cytoscape.model.CyNetwork; 15 | import org.cytoscape.model.CyNode; 16 | 17 | public class TestUtils { 18 | 19 | public static Map getNodes(CyNetwork network) { 20 | Map nodes = new HashMap<>(); 21 | for(CyNode node : network.getNodeList()) { 22 | nodes.put(network.getRow(node).get("name", String.class), node); 23 | } 24 | return nodes; 25 | } 26 | 27 | public static Map getEdges(CyNetwork network) { 28 | Map edges = new HashMap<>(); 29 | for(CyEdge edge : network.getEdgeList()) { 30 | edges.put(network.getRow(edge).get("name", String.class), edge); 31 | } 32 | return edges; 33 | } 34 | 35 | public static EdgeSimilarities getEdgeSimilarities(CyNetwork network) { 36 | EdgeSimilarities edges = new EdgeSimilarities(); 37 | for(CyEdge edge : network.getEdgeList()) { 38 | edges.addEdge(network.getRow(edge).get("name", String.class), edge); 39 | } 40 | return edges; 41 | } 42 | 43 | public static File createTempFile(String path, String fileName) throws IOException { 44 | int dot = fileName.indexOf('.'); 45 | String prefix = fileName.substring(0, dot); 46 | String suffix = fileName.substring(dot+1); 47 | File tempFile = File.createTempFile(prefix, suffix); 48 | InputStream in = TestUtils.class.getResourceAsStream(path + prefix + "." + suffix); 49 | assertNotNull(in); 50 | Files.copy(in, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); 51 | return tempFile; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/resources/EnrichmentMapTaskTest/PA_top8_middle8_bottom8.gmt: -------------------------------------------------------------------------------- 1 | PA_top8_middle8_bottom8 PA_top8_middle8_bottom8 ST3GAL2 ST6GALNAC2 ST3GAL1 ST6GALNAC4 B3GNT5 MUC2 ST6GAL1 GALNT16 GALNT11 GALNT14 GALNT1 MUC21 GALNT2 MUC3A GALNT3 GCNT1 MUCL1 ST3GAL4 GALNT9 B3GNT8 B4GALT5 GCNT3 GALNT6 GCNT4 2 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/resources/EnrichmentMapTaskTest/fakeEnrichments.txt: -------------------------------------------------------------------------------- 1 | Name Description pvalue fdr 2 | Top8_plus100 Top8_plus100 0.005 0.1 3 | Bottom8_plus100 Bottom8_plus100 0.005 0.1 4 | Middle8_plus100 Middle8_plus100 0.005 0.1 5 | top1_plus100 top1_plus100 0.005 0.1 6 | -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/resources/EnrichmentMapTaskTest/gene_sets.gmt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapIntegrationTest/src/test/resources/EnrichmentMapTaskTest/gene_sets.gmt -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/resources/LegacySessionLoadTest/em_session_2.2.cys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapIntegrationTest/src/test/resources/LegacySessionLoadTest/em_session_2.2.cys -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/resources/LegacySessionLoadTest/em_session_2.2_twodataset.cys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapIntegrationTest/src/test/resources/LegacySessionLoadTest/em_session_2.2_twodataset.cys -------------------------------------------------------------------------------- /EnrichmentMapIntegrationTest/src/test/resources/LegacySessionLoadTest/em_session_2.2_twodataset_pa.cys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapIntegrationTest/src/test/resources/LegacySessionLoadTest/em_session_2.2_twodataset_pa.cys -------------------------------------------------------------------------------- /EnrichmentMapPlugin/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | .DS_Store 3 | 4 | # Package Files # 5 | *.jar 6 | *.war 7 | *.ear 8 | *.ai 9 | *.zip 10 | *.cys 11 | 12 | #ignore anything in the compiled directory 13 | target/**/* 14 | resources/EM_EBC_TestData/ 15 | resources/Graphics_for_Manual/ 16 | resources/Graphics_for_wiki/ 17 | resources/scripts/ 18 | *.Gsea.*/ 19 | *.GseaPreRanked.*/ 20 | temp_resources/ 21 | .settings/ 22 | 23 | /target 24 | /bin 25 | /.apt_generated/ 26 | 27 | local.properties 28 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | enrichmentmap 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.m2e.core.maven2Builder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.m2e.core.maven2Nature 26 | org.eclipse.pde.PluginNature 27 | org.eclipse.wst.common.project.facet.core.nature 28 | org.eclipse.jdt.core.javanature 29 | 30 | 31 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ******************************************************************* 27 | * This script installs the Enrichment Map Cytoscape app * 28 | ******************************************************************* 29 | 30 | 31 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/default.properties: -------------------------------------------------------------------------------- 1 | # Overwrite it in your local.properties file 2 | cytoscape.home=${user.home}/CytoscapeConfiguration -------------------------------------------------------------------------------- /EnrichmentMapPlugin/doc/EM_wiki_manual.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/doc/EM_wiki_manual.txt -------------------------------------------------------------------------------- /EnrichmentMapPlugin/doc/LGPL_2.1_Disclaimer_for_src_headers.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * EnrichmentMap Cytoscape Plugin 3 | * 4 | * Copyright (c) 2008-2009 Bader Lab, Donnelly Centre for Cellular and Biomolecular 5 | * Research, University of Toronto 6 | * 7 | * Contact: http://www.baderlab.org 8 | * 9 | * Code written by: Ruth Isserlin 10 | * Authors: Daniele Merico, Ruth Isserlin, Oliver Stueker, Gary D. Bader 11 | * 12 | * This library is free software; you can redistribute it and/or modify it 13 | * under the terms of the GNU Lesser General Public License as published 14 | * by the Free Software Foundation; either version 2.1 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This library is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF 19 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and 20 | * documentation provided hereunder is on an "as is" basis, and 21 | * University of Toronto 22 | * has no obligations to provide maintenance, support, updates, 23 | * enhancements or modifications. In no event shall the 24 | * University of Toronto 25 | * be liable to any party for direct, indirect, special, 26 | * incidental or consequential damages, including lost profits, arising 27 | * out of the use of this software and its documentation, even if 28 | * University of Toronto 29 | * has been advised of the possibility of such damage. 30 | * See the GNU Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public License 33 | * along with this library; if not, write to the Free Software Foundation, 34 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 35 | * 36 | */ 37 | 38 | // $ID$ 39 | // $LastChangedDate$ 40 | // $LasrChangedRevision$ 41 | // $LastChangedBy$ 42 | // $HeadURL$ -------------------------------------------------------------------------------- /EnrichmentMapPlugin/resources/Graphics_for_Manual/Hypergeometric_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/resources/Graphics_for_Manual/Hypergeometric_test.png -------------------------------------------------------------------------------- /EnrichmentMapPlugin/resources/Graphics_for_Manual/PostAnalysis_InputPanel_SignatureHubs_screenshot.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/resources/Graphics_for_Manual/PostAnalysis_InputPanel_SignatureHubs_screenshot.ai -------------------------------------------------------------------------------- /EnrichmentMapPlugin/resources/Graphics_for_Manual/PostAnalysis_InputPanel_SignatureHubs_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/resources/Graphics_for_Manual/PostAnalysis_InputPanel_SignatureHubs_screenshot.png -------------------------------------------------------------------------------- /EnrichmentMapPlugin/resources/Graphics_for_Manual/PostAnalysis_InputPanel_SignatureHubs_screenshot_withLabels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/resources/Graphics_for_Manual/PostAnalysis_InputPanel_SignatureHubs_screenshot_withLabels.png -------------------------------------------------------------------------------- /EnrichmentMapPlugin/resources/Graphics_for_Manual/PostAnalysis_InputPanel_SignatureHubs_screenshot_withLabels_smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/resources/Graphics_for_Manual/PostAnalysis_InputPanel_SignatureHubs_screenshot_withLabels_smaller.png -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/AfterInjection.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface AfterInjection { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/CommandTaskFactory.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap; 2 | 3 | import org.cytoscape.work.ObservableTask; 4 | import org.cytoscape.work.Task; 5 | import org.cytoscape.work.TaskFactory; 6 | import org.cytoscape.work.TaskIterator; 7 | import org.cytoscape.work.json.JSONResult; 8 | 9 | import com.google.inject.Provider; 10 | 11 | public interface CommandTaskFactory extends TaskFactory { 12 | 13 | 14 | public String getName(); 15 | 16 | public String getDescription(); 17 | 18 | public String getLongDescription(); 19 | 20 | public boolean supportsJson(); 21 | 22 | 23 | public static CommandTaskFactory create(String name, String desc, String longDesc, Provider taskProvider, Task... moreTasks) { 24 | Task task = taskProvider.get(); 25 | boolean supportsJson = supportsJson(task); 26 | 27 | return new CommandTaskFactory() { 28 | @Override 29 | public TaskIterator createTaskIterator() { 30 | var ti = new TaskIterator(taskProvider.get()); 31 | for(Task task : moreTasks) { 32 | ti.append(task); 33 | } 34 | return ti; 35 | } 36 | 37 | @Override public boolean isReady() { return true; } 38 | @Override public String getName() { return name; } 39 | @Override public String getDescription() { return desc; } 40 | @Override public String getLongDescription() { return longDesc == null ? null : desc + " " + longDesc; } 41 | @Override public boolean supportsJson() { return supportsJson; } 42 | }; 43 | } 44 | 45 | private static boolean supportsJson(Task task) { 46 | if(task instanceof ObservableTask) { 47 | return ((ObservableTask)task).getResultClasses().contains(JSONResult.class); 48 | } 49 | return false; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/PropsReader.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap; 2 | 3 | import java.util.Properties; 4 | 5 | import org.cytoscape.property.AbstractConfigDirPropsReader; 6 | import org.cytoscape.property.CyProperty; 7 | 8 | public class PropsReader extends AbstractConfigDirPropsReader { 9 | 10 | public static final String PROPS_FILE_NAME = "enrichmentmap.props"; 11 | public static final String NAME = "org.baderlab.enrichmentmap"; 12 | 13 | public PropsReader() { 14 | super(NAME, PROPS_FILE_NAME, CyProperty.SavePolicy.CONFIG_DIR); 15 | } 16 | 17 | public static Properties getServiceProps() { 18 | Properties props = new Properties(); 19 | props.setProperty("cyPropertyName", PROPS_FILE_NAME); 20 | return props; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/actions/OpenEnrichmentMapAction.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.view.control.ControlPanelMediator; 6 | import org.baderlab.csplugins.enrichmentmap.view.creation.CreationDialogShowAction; 7 | import org.baderlab.csplugins.enrichmentmap.view.heatmap.HeatMapMediator; 8 | import org.cytoscape.application.swing.AbstractCyAction; 9 | import org.cytoscape.work.Task; 10 | import org.cytoscape.work.TaskMonitor; 11 | 12 | import com.google.inject.Inject; 13 | import com.google.inject.Provider; 14 | import com.google.inject.Singleton; 15 | 16 | @SuppressWarnings("serial") 17 | @Singleton 18 | public class OpenEnrichmentMapAction extends AbstractCyAction implements Task { 19 | 20 | public static final String NAME = "EnrichmentMap"; 21 | 22 | @Inject private Provider controlPanelMediatorProvider; 23 | @Inject private Provider heatMapMediatorProvider; 24 | @Inject private CreationDialogShowAction masterMapDialogAction; 25 | 26 | public OpenEnrichmentMapAction() { 27 | super(NAME); 28 | setPreferredMenu("Apps"); 29 | setMenuGravity(3.1f); 30 | } 31 | 32 | public synchronized void showPanels() { 33 | controlPanelMediatorProvider.get().showControlPanel(); 34 | heatMapMediatorProvider.get().showHeatMapPanel(); 35 | masterMapDialogAction.showDialog(); 36 | } 37 | 38 | @Override 39 | public void actionPerformed(ActionEvent e) { 40 | showPanels(); 41 | } 42 | 43 | @Override 44 | public void run(TaskMonitor taskMonitor) { 45 | showPanels(); 46 | } 47 | 48 | @Override 49 | public void cancel() { 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/actions/OpenEnrichmentMapPanelsAction.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.actions; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.view.control.ControlPanelMediator; 6 | import org.baderlab.csplugins.enrichmentmap.view.heatmap.HeatMapMediator; 7 | import org.cytoscape.application.swing.AbstractCyAction; 8 | import org.cytoscape.work.Task; 9 | import org.cytoscape.work.TaskMonitor; 10 | 11 | import com.google.inject.Inject; 12 | import com.google.inject.Provider; 13 | import com.google.inject.Singleton; 14 | 15 | @SuppressWarnings("serial") 16 | @Singleton 17 | public class OpenEnrichmentMapPanelsAction extends AbstractCyAction implements Task { 18 | 19 | public static final String NAME = "EnrichmentMap"; 20 | 21 | @Inject private Provider controlPanelMediatorProvider; 22 | @Inject private Provider heatMapMediatorProvider; 23 | 24 | public OpenEnrichmentMapPanelsAction() { 25 | super(NAME); 26 | setPreferredMenu("Apps"); 27 | } 28 | 29 | public synchronized void showPanels() { 30 | controlPanelMediatorProvider.get().showControlPanel(); 31 | heatMapMediatorProvider.get().showHeatMapPanel(); 32 | } 33 | 34 | @Override 35 | public void actionPerformed(ActionEvent e) { 36 | showPanels(); 37 | } 38 | 39 | @Override 40 | public void run(TaskMonitor taskMonitor) { 41 | showPanels(); 42 | } 43 | 44 | @Override 45 | public void cancel() { 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/actions/OpenPathwayCommonsTaskFactory.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.actions; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.model.DataSetFiles; 4 | import org.baderlab.csplugins.enrichmentmap.model.EMDataSet; 5 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 6 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager; 7 | import org.cytoscape.model.CyNode; 8 | import org.cytoscape.task.NodeViewTaskFactory; 9 | import org.cytoscape.view.model.CyNetworkView; 10 | import org.cytoscape.view.model.View; 11 | import org.cytoscape.work.TaskIterator; 12 | 13 | import com.google.common.base.Strings; 14 | import com.google.inject.Inject; 15 | 16 | public class OpenPathwayCommonsTaskFactory implements NodeViewTaskFactory { 17 | 18 | @Inject private OpenPathwayCommonsTask.Factory taskFactory; 19 | @Inject private EnrichmentMapManager emManager; 20 | 21 | @Override 22 | public TaskIterator createTaskIterator(View nodeView, CyNetworkView networkView) { 23 | return new TaskIterator(taskFactory.create(networkView.getModel(), nodeView.getModel())); 24 | } 25 | 26 | /** 27 | * There has to be class and expression data available for at least one dataset. 28 | */ 29 | @Override 30 | public boolean isReady(View nodeView, CyNetworkView networkView) { 31 | // have to call isEnrichmentMap() because getEnrichmentMap() returns a value for associated networks such as genemania networks 32 | if(!emManager.isEnrichmentMap(networkView)) 33 | return false; 34 | EnrichmentMap em = emManager.getEnrichmentMap(networkView.getModel().getSUID()); 35 | if(em == null) 36 | return false; 37 | 38 | for(EMDataSet dataset : em.getDataSetList()) { 39 | DataSetFiles files = dataset.getDataSetFiles(); 40 | if(!Strings.isNullOrEmpty(files.getExpressionFileName()) && !Strings.isNullOrEmpty(files.getClassFile())) { 41 | return true; 42 | } 43 | } 44 | return false; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/ExportModelJsonCommandTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands; 2 | 3 | import java.io.File; 4 | import java.io.FileWriter; 5 | 6 | import org.baderlab.csplugins.enrichmentmap.commands.tunables.NetworkTunable; 7 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 8 | import org.baderlab.csplugins.enrichmentmap.model.io.ModelSerializer; 9 | import org.cytoscape.work.AbstractTask; 10 | import org.cytoscape.work.ContainsTunables; 11 | import org.cytoscape.work.TaskMonitor; 12 | import org.cytoscape.work.Tunable; 13 | 14 | import com.google.inject.Inject; 15 | 16 | public class ExportModelJsonCommandTask extends AbstractTask { 17 | 18 | @Tunable(required=true, description="File used as destination for model JSON. Will be overwritten if it already exists.") 19 | public File file; 20 | 21 | @Inject @ContainsTunables 22 | public NetworkTunable networkTunable; 23 | 24 | 25 | @Override 26 | public void run(TaskMonitor taskMonitor) throws Exception { 27 | if(file == null) 28 | throw new IllegalArgumentException("'file' argument is null"); 29 | 30 | file.createNewFile(); 31 | if(!file.canWrite()) 32 | throw new IllegalArgumentException("Cannot write to file"); 33 | 34 | EnrichmentMap map = networkTunable.getEnrichmentMap(); 35 | if(map == null) 36 | throw new IllegalArgumentException("Network is not an Enrichment Map."); 37 | 38 | String json = ModelSerializer.serialize(map, true); 39 | 40 | try(FileWriter out = new FileWriter(file)) { 41 | out.write(json); 42 | } 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/ExportNetworkImageCommandTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands; 2 | 3 | import java.nio.file.Paths; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import java.util.UUID; 7 | 8 | import org.cytoscape.command.CommandExecutorTaskFactory; 9 | import org.cytoscape.work.AbstractTask; 10 | import org.cytoscape.work.TaskIterator; 11 | import org.cytoscape.work.TaskMonitor; 12 | 13 | import com.google.inject.Inject; 14 | 15 | /** 16 | * There is already a command in Cytoscape to export a network image. This command 17 | * is different in that it always exports to the user's home directory, and it 18 | * never prompts for overwrite permission. 19 | */ 20 | public class ExportNetworkImageCommandTask extends AbstractTask { 21 | 22 | @Inject private CommandExecutorTaskFactory commandTaskFactory; 23 | 24 | @Override 25 | public void run(TaskMonitor taskMonitor) { 26 | String fileName = "em_network_" + UUID.randomUUID() + ".png"; 27 | String homeDir = System.getProperty("user.home"); 28 | String filePath = Paths.get(homeDir, fileName).toString(); 29 | 30 | Map args = new HashMap<>(); 31 | args.put("options", "PNG (*.png)"); 32 | args.put("outputFile", filePath); 33 | args.put("view", "CURRENT"); // required 34 | 35 | TaskIterator commandTasks = commandTaskFactory.createTaskIterator("view", "export", args, null); 36 | insertTasksAfterCurrentTask(commandTasks); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/GetDataSetNamesCommandTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import org.baderlab.csplugins.enrichmentmap.commands.tunables.NetworkTunable; 7 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 8 | import org.cytoscape.work.AbstractTask; 9 | import org.cytoscape.work.ContainsTunables; 10 | import org.cytoscape.work.ObservableTask; 11 | import org.cytoscape.work.TaskMonitor; 12 | 13 | import com.google.inject.Inject; 14 | 15 | public class GetDataSetNamesCommandTask extends AbstractTask implements ObservableTask { 16 | 17 | @ContainsTunables @Inject 18 | public NetworkTunable networkTunable; 19 | 20 | private List results; 21 | 22 | 23 | @Override 24 | public void run(TaskMonitor tm) { 25 | EnrichmentMap map = networkTunable.getEnrichmentMap(); 26 | if(map == null) 27 | throw new IllegalArgumentException("Network is not an Enrichment Map."); 28 | 29 | results = map.getDataSetNames(); 30 | } 31 | 32 | 33 | @Override 34 | public List> getResultClasses() { 35 | return Arrays.asList(String.class, List.class); 36 | } 37 | 38 | @Override 39 | public R getResults(Class type) { 40 | if(String.class.equals(type)) { 41 | return type.cast(String.join(",", results)); 42 | } else if(List.class.equals(type)) { 43 | return type.cast(results); 44 | } 45 | return null; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/tunables/ChartTunables.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands.tunables; 2 | 3 | import static org.baderlab.csplugins.enrichmentmap.style.ChartData.DATA_SET; 4 | import static org.baderlab.csplugins.enrichmentmap.style.ChartType.DATASET_PIE; 5 | import static org.baderlab.csplugins.enrichmentmap.style.ChartType.HEAT_MAP; 6 | import static org.baderlab.csplugins.enrichmentmap.style.ChartType.HEAT_STRIPS; 7 | import static org.baderlab.csplugins.enrichmentmap.style.ChartType.RADIAL_HEAT_MAP; 8 | 9 | import org.baderlab.csplugins.enrichmentmap.style.ChartData; 10 | import org.baderlab.csplugins.enrichmentmap.style.ChartType; 11 | import org.baderlab.csplugins.enrichmentmap.style.ColorScheme; 12 | import org.baderlab.csplugins.enrichmentmap.util.TaskUtil; 13 | import org.cytoscape.work.Tunable; 14 | import org.cytoscape.work.util.ListSingleSelection; 15 | 16 | public class ChartTunables { 17 | 18 | @Tunable(description = "Sets the chart data to show.") 19 | public ListSingleSelection data; 20 | 21 | @Tunable(description = "Sets the chart type.") 22 | public ListSingleSelection type; 23 | 24 | @Tunable(description = "Sets the chart colors.") 25 | public ListSingleSelection colors; 26 | 27 | @Tunable 28 | public boolean showChartLabels = true; 29 | 30 | 31 | public ChartTunables() { 32 | data = TaskUtil.lssFromEnumWithDefault(ChartData.values(), ChartData.NES_VALUE); 33 | type = TaskUtil.lssFromEnum(RADIAL_HEAT_MAP, HEAT_STRIPS, HEAT_MAP); // don't include DATASET_PIE 34 | colors = TaskUtil.lssFromEnum(ColorScheme.values()); 35 | } 36 | 37 | 38 | public ChartData getChartData() { 39 | return ChartData.valueOf(data.getSelectedValue()); 40 | } 41 | 42 | public ChartType getChartType() { 43 | return getChartData() == DATA_SET ? DATASET_PIE : ChartType.valueOf(type.getSelectedValue()); 44 | } 45 | 46 | public ColorScheme getColorScheme() { 47 | return ColorScheme.valueOf(colors.getSelectedValue()); 48 | } 49 | 50 | public boolean showChartLabels() { 51 | return showChartLabels; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/tunables/DatasetColorTunable.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands.tunables; 2 | 3 | import java.awt.Color; 4 | import java.util.Collections; 5 | import java.util.Map; 6 | import java.util.Map.Entry; 7 | import java.util.stream.Collectors; 8 | 9 | import org.cytoscape.work.Tunable; 10 | 11 | import com.google.common.base.Splitter; 12 | import com.google.common.base.Strings; 13 | 14 | public class DatasetColorTunable { 15 | 16 | @Tunable(description="Comma separated list of key=value pairs where the key is the " 17 | + "name or index of a data set, and the value is an HTML hex color code. " 18 | + "Example: \"DataSet1=#224433,DataSet2=#887766\"") 19 | public String colors = null; 20 | 21 | @Tunable(description="Color to use for compound edges, the value is an HTML hex color code. " 22 | + "Note: This parameter has no effect if the EnrichmentMap network uses distinct edges (i.e. separate edges for each data set). " 23 | + "Example: \"#224433\"") 24 | public String compoundEdgeColor = null; 25 | 26 | 27 | public Map getColors() { 28 | if(Strings.isNullOrEmpty(colors)) 29 | return Collections.emptyMap(); 30 | 31 | return 32 | Splitter.on(',') 33 | .omitEmptyStrings() 34 | .withKeyValueSeparator( 35 | Splitter.on('=') 36 | .limit(2) 37 | .trimResults() 38 | ) 39 | .split(colors) 40 | .entrySet() 41 | .stream() 42 | .collect( 43 | Collectors.toMap( 44 | Entry::getKey, 45 | v -> Color.decode(v.getValue()) 46 | ) 47 | ); 48 | } 49 | 50 | public Color getCompoundEdgeColor() { 51 | return compoundEdgeColor == null ? null : Color.decode(compoundEdgeColor); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/tunables/DatasetListTunable.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands.tunables; 2 | 3 | import java.util.Collection; 4 | import java.util.Collections; 5 | import java.util.HashSet; 6 | import java.util.List; 7 | import java.util.Set; 8 | import java.util.stream.Collectors; 9 | 10 | import org.baderlab.csplugins.enrichmentmap.model.EMDataSet; 11 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 12 | import org.cytoscape.work.Tunable; 13 | 14 | public class DatasetListTunable { 15 | 16 | @Tunable(description="Comma separated list of dataset names or indexes, or 'ALL' to indicate all datasets.", 17 | longDescription="Comma separated list of dataset names or indexes, for example 'dataset1,dataset2,3'. " + 18 | "The list may also contain positive integers that indicate the index of the dataset in the enrichment map. " + 19 | "Alternately use 'ALL' to indicate all data sets.") 20 | public String datasets = "ALL"; 21 | 22 | 23 | public Collection getDataSets(EnrichmentMap map) { 24 | if(datasets == null) { 25 | return Collections.emptyList(); 26 | } 27 | if(datasets.trim().equalsIgnoreCase("ALL")) { 28 | return map.getDataSetList(); 29 | } 30 | 31 | Set result = new HashSet<>(); 32 | List datasetList = map.getDataSetList(); 33 | 34 | String[] names = datasets.split(","); 35 | for(String name : names) { 36 | int index = getIndex(name); 37 | if(index >= 0 && index < datasetList.size()) { 38 | result.add(datasetList.get(index)); 39 | } else { 40 | EMDataSet ds = map.getDataSet(name); 41 | if(ds != null) { 42 | result.add(ds); 43 | } 44 | } 45 | } 46 | 47 | return result; 48 | } 49 | 50 | public Set getDataSetNames(EnrichmentMap map) { 51 | return getDataSets(map).stream().map(EMDataSet::getName).collect(Collectors.toSet()); 52 | } 53 | 54 | 55 | private static int getIndex(String s) { 56 | try { 57 | return Integer.parseInt(s); 58 | } catch(NumberFormatException e) { 59 | return -1; 60 | } 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/tunables/FilterTunablesLegacy.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands.tunables; 2 | 3 | import static org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric.COMBINED; 4 | import static org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric.JACCARD; 5 | import static org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric.OVERLAP; 6 | 7 | import org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric; 8 | import org.cytoscape.work.Tunable; 9 | import org.cytoscape.work.util.ListSingleSelection; 10 | 11 | 12 | /** 13 | * This is just for the build command for backwards compatibility with the misspelled 'coeffecients' parameter. 14 | * Use with @ContainsTunables. 15 | */ 16 | public class FilterTunablesLegacy extends FilterTunables { 17 | 18 | @Deprecated 19 | @Tunable(description = "Deprecated, use 'coefficients' instead.") 20 | public ListSingleSelection coeffecients; // misspelled, but must keep for backwards compatibility 21 | 22 | 23 | public FilterTunablesLegacy() { 24 | coeffecients = new ListSingleSelection("null", OVERLAP.name(), JACCARD.name(), COMBINED.name()); 25 | } 26 | 27 | @Override 28 | public SimilarityMetric getSimilarityMetric() { 29 | String value; 30 | if(!"null".equals(coeffecients.getSelectedValue())) { 31 | // the old field overrides the new field 32 | value = coeffecients.getSelectedValue(); 33 | } else { 34 | value = coefficients.getSelectedValue(); 35 | } 36 | 37 | return SimilarityMetric.valueOf(value); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/tunables/MannWhitRanks.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands.tunables; 2 | 3 | import java.util.Collections; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import com.google.common.collect.ImmutableMap; 8 | 9 | public class MannWhitRanks { 10 | 11 | public static final String DESCRIPTION = "When using Mann-Whitney allows to specify which rank file to use with each dataset." 12 | + " Example usage \"DataSetName1:RankFile1,DataSetName2:RankFile2\""; 13 | 14 | 15 | private Map dataSetToRankFile = new HashMap<>(); 16 | 17 | public MannWhitRanks(Map dataSetToRankFile) { 18 | this.dataSetToRankFile = ImmutableMap.copyOf(dataSetToRankFile); 19 | } 20 | 21 | public MannWhitRanks() { 22 | this.dataSetToRankFile = Collections.emptyMap(); 23 | } 24 | 25 | public Map getDataSetToRankFile() { 26 | return dataSetToRankFile; 27 | } 28 | 29 | public String getRankFile(String dataSet) { 30 | return dataSetToRankFile.get(dataSet); 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "MannWhitRanking [dataSetToRankFile=" + dataSetToRankFile + "]"; 36 | } 37 | 38 | public boolean isEmpty() { 39 | return dataSetToRankFile.isEmpty(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/tunables/MannWhitRanksTunableHandler.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands.tunables; 2 | 3 | import java.lang.reflect.Field; 4 | import java.lang.reflect.Method; 5 | import java.util.Arrays; 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | import org.cytoscape.command.AbstractStringTunableHandler; 10 | import org.cytoscape.work.Tunable; 11 | 12 | public class MannWhitRanksTunableHandler extends AbstractStringTunableHandler { 13 | 14 | public MannWhitRanksTunableHandler(Field f, Object o, Tunable t) { 15 | super(f, o, t); 16 | } 17 | 18 | public MannWhitRanksTunableHandler(Method get, Method set, Object o, Tunable t) { 19 | super(get, set, o, t); 20 | } 21 | 22 | @Override 23 | public MannWhitRanks processArg(String arg) { 24 | return new MannWhitRanks(parseArg(arg)); 25 | } 26 | 27 | 28 | private static Map parseArg(String arg) { 29 | Map dataSetToRank = new HashMap<>(); 30 | 31 | String[] split = arg.split("(?= 2) { 36 | String attribute = t[0]; 37 | String[] slice = Arrays.copyOfRange(t, 1, t.length); 38 | String value = String.join(":", slice); 39 | attribute = attribute.replaceAll("\\\\:", ":"); 40 | value = value.replaceAll("\\\\:", ":"); 41 | 42 | dataSetToRank.put(attribute, value); 43 | } 44 | } 45 | return dataSetToRank; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/tunables/MannWhitRanksTunableHandlerFactory.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands.tunables; 2 | 3 | import org.cytoscape.command.StringTunableHandlerFactory; 4 | import org.cytoscape.work.BasicTunableHandlerFactory; 5 | 6 | public class MannWhitRanksTunableHandlerFactory 7 | extends BasicTunableHandlerFactory 8 | implements StringTunableHandlerFactory { 9 | 10 | public MannWhitRanksTunableHandlerFactory() { 11 | super(MannWhitRanksTunableHandler.class, MannWhitRanks.class); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/tunables/NetworkTunable.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands.tunables; 2 | 3 | import java.util.Collection; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 6 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager; 7 | import org.cytoscape.application.CyApplicationManager; 8 | import org.cytoscape.model.CyNetwork; 9 | import org.cytoscape.view.model.CyNetworkView; 10 | import org.cytoscape.view.model.CyNetworkViewManager; 11 | import org.cytoscape.work.Tunable; 12 | 13 | import com.google.inject.Inject; 14 | 15 | public class NetworkTunable { 16 | 17 | @Inject private CyApplicationManager applicationManager; 18 | @Inject private CyNetworkViewManager networkViewManager; 19 | @Inject private EnrichmentMapManager emManager; 20 | 21 | @Tunable 22 | public CyNetwork network; 23 | 24 | 25 | public CyNetwork getNetwork() { 26 | if(network == null) 27 | return applicationManager.getCurrentNetwork(); 28 | return network; 29 | } 30 | 31 | public CyNetworkView getNetworkView() { 32 | CyNetwork network = getNetwork(); 33 | if(network == null) { 34 | return null; 35 | } 36 | 37 | Collection networkViews = networkViewManager.getNetworkViews(network); 38 | if(networkViews == null || networkViews.isEmpty()) 39 | return null; 40 | return networkViews.iterator().next(); 41 | } 42 | 43 | public EnrichmentMap getEnrichmentMap() { 44 | CyNetwork network = getNetwork(); 45 | if(network == null) 46 | return null; 47 | return emManager.getEnrichmentMap(getNetwork().getSUID()); 48 | } 49 | 50 | public boolean isEnrichmentMap() { 51 | return getEnrichmentMap() != null; 52 | } 53 | 54 | public boolean isAssociatedEnrichmenMap() { 55 | CyNetwork network = getNetwork(); 56 | if(network == null) 57 | return false; 58 | return emManager.isAssociatedEnrichmentMap(network.getSUID()); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/commands/tunables/NodeListTunable.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.commands.tunables; 2 | 3 | import java.util.List; 4 | import java.util.stream.Collectors; 5 | 6 | import org.cytoscape.work.Tunable; 7 | 8 | import com.google.common.base.Splitter; 9 | 10 | public class NodeListTunable { 11 | 12 | @Tunable(description = "Comma separated list of node SUIDs") 13 | public String nodes; 14 | 15 | public List getNodeSuids() throws NumberFormatException { 16 | return Splitter.on(',') 17 | .trimResults() 18 | .omitEmptyStrings() 19 | .splitToStream(nodes) 20 | .map(Long::parseLong) 21 | .collect(Collectors.toList()); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/AssociatedApp.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.style.ColumnDescriptor; 4 | import org.baderlab.csplugins.enrichmentmap.style.ColumnListDescriptor; 5 | import org.baderlab.csplugins.enrichmentmap.style.EMStyleBuilder; 6 | 7 | public enum AssociatedApp { 8 | 9 | GENEMANIA("GeneMANIA", AssociatedAppColumns.GM_GENE_NAME, AssociatedAppColumns.GM_QUERY_TERM), 10 | STRING("STRING", AssociatedAppColumns.STR_GENE_NAME, AssociatedAppColumns.STR_QUERY_TERM), 11 | AUTOANNOTATE("AUTOANNOTATE", EMStyleBuilder.Columns.NODE_GENES); 12 | 13 | 14 | private final String name; 15 | private final ColumnDescriptor geneNameColumn; 16 | private final ColumnListDescriptor geneNameListColumn; 17 | private final ColumnDescriptor queryTermColumn; 18 | 19 | 20 | private AssociatedApp(String name, ColumnDescriptor geneNameColumn, ColumnDescriptor queryTermColumn) { 21 | this.name = name; 22 | this.geneNameColumn = geneNameColumn; 23 | this.geneNameListColumn = null; 24 | this.queryTermColumn = queryTermColumn; 25 | } 26 | 27 | private AssociatedApp(String name, ColumnListDescriptor geneNameListColumn) { 28 | this.name = name; 29 | this.geneNameColumn = null; 30 | this.geneNameListColumn = geneNameListColumn; 31 | this.queryTermColumn = null; 32 | } 33 | 34 | 35 | public ColumnDescriptor getGeneNameColumn() { 36 | return geneNameColumn; 37 | } 38 | 39 | public ColumnDescriptor getQueryTermColumn() { 40 | return queryTermColumn; 41 | } 42 | 43 | public ColumnListDescriptor getGeneNameListColumn() { 44 | return geneNameListColumn; 45 | } 46 | 47 | 48 | @Override 49 | public String toString() { 50 | return name; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/AssociatedAppColumns.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.style.ColumnDescriptor; 4 | import org.baderlab.csplugins.enrichmentmap.style.EMStyleBuilder; 5 | 6 | public interface AssociatedAppColumns { 7 | 8 | // GeneMANIA Attributes 9 | // NODE 10 | ColumnDescriptor GM_GENE_NAME = new ColumnDescriptor<>("gene name", String.class); 11 | ColumnDescriptor GM_QUERY_TERM = new ColumnDescriptor<>("query term", String.class); 12 | 13 | // STRING Attributes 14 | // NODE 15 | ColumnDescriptor STR_GENE_NAME = new ColumnDescriptor<>("display name", String.class); 16 | ColumnDescriptor STR_QUERY_TERM = new ColumnDescriptor<>("query term", String.class); 17 | 18 | // Hidden network attributes in associated networks 19 | // Hard code the namespace prefix because when we go from the associated network back to the EM network we don't know the EM network's prefix yet 20 | ColumnDescriptor EM_ASSOCIATED_APP = new ColumnDescriptor<>(EMStyleBuilder.Columns.NAMESPACE_PREFIX + "Associated_App", String.class); 21 | ColumnDescriptor EM_NETWORK_SUID = new ColumnDescriptor<>(EMStyleBuilder.Columns.NAMESPACE_PREFIX + "Network.SUID", Long.class); 22 | } -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/Compress.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | public enum Compress { 4 | NONE, 5 | CLASS_MEDIAN, 6 | CLASS_MIN, 7 | CLASS_MAX, 8 | DATASET_MEDIAN, 9 | DATASET_MIN, 10 | DATASET_MAX; 11 | 12 | public boolean isNone() { 13 | return this == NONE; 14 | } 15 | 16 | public boolean isClass() { 17 | return this == CLASS_MEDIAN || this == CLASS_MIN || this == CLASS_MAX; 18 | } 19 | 20 | public boolean isDataSet() { 21 | return this == DATASET_MEDIAN || this == DATASET_MIN || this == DATASET_MAX; 22 | } 23 | 24 | public boolean sameStructure(Compress other) { 25 | return (this.isNone() && other.isNone()) || (this.isClass() && other.isClass()) 26 | || (this.isDataSet() && other.isDataSet()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/CompressedDataSet.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import org.baderlab.csplugins.enrichmentmap.model.PhenotypeHighlight.Highlight; 7 | 8 | public class CompressedDataSet implements ExpressionData { 9 | 10 | private final ExpressionCache expressionCache; 11 | private final List datasets; 12 | private final boolean isDistinctExpressionSets; 13 | 14 | public CompressedDataSet(EnrichmentMap map, List datasets, ExpressionCache expressionCache) { 15 | this.datasets = datasets; 16 | this.expressionCache = expressionCache; 17 | this.isDistinctExpressionSets = map != null && map.isDistinctExpressionSets(); 18 | } 19 | 20 | @Override 21 | public EMDataSet getDataSet(int idx) { 22 | return datasets.get(idx); 23 | } 24 | 25 | @Override 26 | public double getValue(int geneID, int idx, Compress compress, Transform transform) { 27 | EMDataSet dataset = getDataSet(idx); 28 | Optional expression = expressionCache.getExpressions(geneID, dataset, transform); 29 | 30 | if (compress == null || !expression.isPresent()) 31 | return Float.NaN; 32 | 33 | switch (compress) { 34 | case DATASET_MEDIAN: return GeneExpression.median(expression.get()); 35 | case DATASET_MAX: return GeneExpression.max(expression.get()); 36 | case DATASET_MIN: return GeneExpression.min(expression.get()); 37 | default: return Float.NaN; 38 | } 39 | } 40 | 41 | @Override 42 | public String getName(int idx) { 43 | EMDataSet dataset = getDataSet(idx); 44 | return isDistinctExpressionSets ? dataset.getName() : "Expressions"; 45 | } 46 | 47 | @Override 48 | public int getSize() { 49 | return datasets.size(); 50 | } 51 | 52 | @Override 53 | public PhenotypeHighlight getHighlight(int col) { 54 | var dataSet = getDataSet(col); 55 | var name = getName(col); 56 | return new PhenotypeHighlight(dataSet, name, Highlight.NONE); 57 | } 58 | 59 | @Override 60 | public boolean commonButDiffPheno() { 61 | return false; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/EnrichmentResultFilterParams.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | import java.util.Optional; 4 | 5 | public interface EnrichmentResultFilterParams { 6 | 7 | public static enum NESFilter { 8 | ALL, 9 | POSITIVE, 10 | NEGATIVE 11 | } 12 | 13 | double getPvalue(); 14 | 15 | double getQvalue(); 16 | 17 | NESFilter getNESFilter(); 18 | 19 | Optional getMinExperiments(); 20 | 21 | boolean isFDR(); 22 | } 23 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/ExpressionCache.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | import java.util.Map; 4 | import java.util.Optional; 5 | import java.util.concurrent.ExecutionException; 6 | 7 | import javax.annotation.Nullable; 8 | 9 | import org.apache.commons.lang3.tuple.Triple; 10 | 11 | import com.google.common.cache.Cache; 12 | import com.google.common.cache.CacheBuilder; 13 | 14 | public class ExpressionCache { 15 | 16 | private final Cache, Optional> cache; 17 | 18 | public ExpressionCache() { 19 | this.cache = CacheBuilder.newBuilder().maximumSize(20).build(); 20 | } 21 | 22 | public Optional getExpressions(int geneID, EMDataSet dataset, Transform transform) { 23 | try { 24 | return cache.get(Triple.of(geneID, dataset, transform), 25 | () -> Optional.ofNullable(getExpression(geneID, dataset, transform)) 26 | ); 27 | } catch (ExecutionException e) { 28 | return Optional.empty(); 29 | } 30 | } 31 | 32 | public float getExpression(int geneID, EMDataSet dataset, Transform transform, int expressionIndex) { 33 | Optional vals = getExpressions(geneID, dataset, transform); 34 | 35 | return vals.isPresent() ? vals.get()[expressionIndex] : Float.NaN; 36 | } 37 | 38 | public static GeneExpression getGeneExpression(int geneID, EMDataSet dataset) { 39 | GeneExpressionMatrix matrix = dataset.getExpressionSets(); 40 | Map expressions = matrix.getExpressionMatrix(); 41 | GeneExpression row = expressions.get(geneID); 42 | 43 | return row; 44 | } 45 | 46 | private static @Nullable float[] getExpression(int geneID, EMDataSet dataset, Transform transform) { 47 | GeneExpression expression = getGeneExpression(geneID, dataset); 48 | 49 | if (expression != null) { 50 | switch (transform) { 51 | case ROW_NORMALIZE: return expression.rowNormalize(); 52 | case LOG_TRANSFORM: return expression.rowLogTransform(); 53 | case AS_IS: return expression.getExpression(); 54 | } 55 | } 56 | 57 | return null; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/GenemaniaParameters.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | import org.cytoscape.model.CyNetwork; 4 | 5 | public class GenemaniaParameters { 6 | 7 | // the SUID of the genemania network 8 | private final CyNetwork network; 9 | 10 | public GenemaniaParameters(CyNetwork network) { 11 | this.network = network; 12 | } 13 | 14 | public CyNetwork getNetwork() { 15 | return network; 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/TableExpressionParameters.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | import java.util.Objects; 4 | 5 | import org.cytoscape.model.CyTable; 6 | 7 | public class TableExpressionParameters { 8 | 9 | // expression table 10 | private final CyTable exprTable; 11 | private final String exprGeneNameColumn; 12 | private final String exprDescriptionColumn; 13 | private final String[] exprValueColumns; 14 | 15 | 16 | public TableExpressionParameters(CyTable exprTable, String exprGeneNameColumn, String exprDescriptionColumn, String[] exprValueColumns) { 17 | this.exprTable = Objects.requireNonNull(exprTable); 18 | this.exprGeneNameColumn = exprGeneNameColumn; 19 | this.exprDescriptionColumn = exprDescriptionColumn; 20 | this.exprValueColumns = exprValueColumns; 21 | } 22 | 23 | public CyTable getExprTable() { 24 | return exprTable; 25 | } 26 | 27 | public String getExprGeneNameColumn() { 28 | return exprGeneNameColumn; 29 | } 30 | 31 | public String getExprDescriptionColumn() { 32 | return exprDescriptionColumn; 33 | } 34 | 35 | public String[] getExprValueColumns() { 36 | return exprValueColumns; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/TableParameters.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | import java.util.Objects; 4 | import java.util.function.Predicate; 5 | 6 | import javax.annotation.Nullable; 7 | 8 | import org.cytoscape.model.CyRow; 9 | import org.cytoscape.model.CyTable; 10 | 11 | public class TableParameters { 12 | 13 | private final CyTable table; 14 | private final String nameColumn; 15 | private final String genesColumn; 16 | private final String pvalueColumn; 17 | private final String qvalueColumn; 18 | private final String nesColumn; 19 | private final String descriptionColumn; 20 | 21 | private final @Nullable Predicate filter; 22 | 23 | 24 | public TableParameters( 25 | CyTable table, 26 | String nameColumn, 27 | String genesColumn, 28 | String pvalueColumn, 29 | String qvalueColumn, 30 | String nesColumn, 31 | String descriptionColumn, 32 | Predicate filter 33 | ) { 34 | this.table = Objects.requireNonNull(table); 35 | this.nameColumn = Objects.requireNonNull(nameColumn); 36 | this.genesColumn = Objects.requireNonNull(genesColumn); 37 | this.pvalueColumn = pvalueColumn; 38 | this.qvalueColumn = qvalueColumn; 39 | this.nesColumn = nesColumn; 40 | this.descriptionColumn = descriptionColumn; 41 | this.filter = filter; 42 | } 43 | 44 | public CyTable getTable() { 45 | return table; 46 | } 47 | 48 | public String getNameColumn() { 49 | return nameColumn; 50 | } 51 | 52 | public String getGenesColumn() { 53 | return genesColumn; 54 | } 55 | 56 | public String getPvalueColumn() { 57 | return pvalueColumn; 58 | } 59 | 60 | public String getQvalueColumn() { 61 | return qvalueColumn; 62 | } 63 | 64 | public String getNesColumn() { 65 | return nesColumn; 66 | } 67 | 68 | public String getDescriptionColumn() { 69 | return descriptionColumn; 70 | } 71 | 72 | public Predicate getFilter() { 73 | return filter; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/Transform.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | public enum Transform { 4 | AS_IS, 5 | ROW_NORMALIZE, 6 | LOG_TRANSFORM; 7 | } 8 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/UniverseType.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | /** 4 | * The "gene universe", typically used as a parameter to 5 | * the Hypergeometric test when running post-analysis. 6 | */ 7 | public enum UniverseType { 8 | 9 | GMT, 10 | EXPRESSION_SET, 11 | INTERSECTION, 12 | USER_DEFINED; 13 | 14 | 15 | public int getGeneUniverse(EnrichmentMap map, String datasetName, int userDefinedUniverseSize) { 16 | EMDataSet dataset = map.getDataSet(datasetName); 17 | switch(this) { 18 | default: 19 | case GMT: 20 | return dataset.getGeneSetGenes().size(); // number of un-filtered genes from the original GMT file (GMT) 21 | case EXPRESSION_SET: 22 | return dataset.getExpressionSets().getExpressionUniverse(); 23 | case INTERSECTION: 24 | return dataset.getExpressionSets().getExpressionMatrix().size(); 25 | case USER_DEFINED: 26 | return userDefinedUniverseSize; 27 | } 28 | } 29 | 30 | public int getGeneUniverse(EnrichmentMap map, String dataset) { 31 | if(this == UniverseType.USER_DEFINED) 32 | throw new IllegalArgumentException(); 33 | return getGeneUniverse(map, dataset, 0); 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/event/AssociatedEnrichmentMapsChangedEvent.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model.event; 2 | 3 | import java.util.Map; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 6 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager; 7 | import org.cytoscape.event.AbstractCyEvent; 8 | 9 | public class AssociatedEnrichmentMapsChangedEvent extends AbstractCyEvent { 10 | 11 | private final EnrichmentMap map; 12 | private final Map associatedMaps; 13 | 14 | public AssociatedEnrichmentMapsChangedEvent(EnrichmentMapManager source, EnrichmentMap map, Map associatedMaps) { 15 | super(source, AssociatedEnrichmentMapsChangedListener.class); 16 | this.map = map; 17 | this.associatedMaps = associatedMaps; 18 | } 19 | 20 | public EnrichmentMap getEnrichmentMap() { 21 | return map; 22 | } 23 | 24 | public Map getAssociatedMaps() { 25 | return associatedMaps; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/event/AssociatedEnrichmentMapsChangedListener.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model.event; 2 | 3 | import org.cytoscape.event.CyListener; 4 | 5 | public interface AssociatedEnrichmentMapsChangedListener extends CyListener { 6 | 7 | public void handleEvent(AssociatedEnrichmentMapsChangedEvent e); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/event/EnrichmentMapAboutToBeRemovedEvent.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model.event; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 4 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager; 5 | import org.cytoscape.event.AbstractCyEvent; 6 | import org.cytoscape.view.model.CyNetworkView; 7 | 8 | public class EnrichmentMapAboutToBeRemovedEvent extends AbstractCyEvent { 9 | 10 | private final EnrichmentMap map; 11 | private final CyNetworkView networkView; 12 | 13 | public EnrichmentMapAboutToBeRemovedEvent(EnrichmentMapManager source, EnrichmentMap map, CyNetworkView networkView) { 14 | super(source, EnrichmentMapAboutToBeRemovedListener.class); 15 | this.map = map; 16 | this.networkView = networkView; 17 | } 18 | 19 | public EnrichmentMap getEnrichmentMap() { 20 | return map; 21 | } 22 | 23 | public CyNetworkView getNetworkView() { 24 | return networkView; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/event/EnrichmentMapAboutToBeRemovedListener.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model.event; 2 | 3 | import org.cytoscape.event.CyListener; 4 | 5 | public interface EnrichmentMapAboutToBeRemovedListener extends CyListener { 6 | 7 | public void handleEvent(EnrichmentMapAboutToBeRemovedEvent e); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/event/EnrichmentMapAddedEvent.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model.event; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 4 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager; 5 | import org.cytoscape.event.AbstractCyEvent; 6 | 7 | 8 | public class EnrichmentMapAddedEvent extends AbstractCyEvent { 9 | 10 | private final EnrichmentMap map; 11 | 12 | public EnrichmentMapAddedEvent(EnrichmentMapManager source, EnrichmentMap map) { 13 | super(source, EnrichmentMapAddedListener.class); 14 | this.map = map; 15 | } 16 | 17 | public EnrichmentMap getEnrichmentMap() { 18 | return map; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/model/event/EnrichmentMapAddedListener.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model.event; 2 | 3 | import org.cytoscape.event.CyListener; 4 | 5 | public interface EnrichmentMapAddedListener extends CyListener { 6 | 7 | public void handleEvent(EnrichmentMapAddedEvent e); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/ClassFileReaderTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.parsers; 2 | 3 | import static com.google.common.base.Strings.isNullOrEmpty; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.util.List; 8 | 9 | import org.baderlab.csplugins.enrichmentmap.model.EMDataSet; 10 | import org.cytoscape.work.AbstractTask; 11 | import org.cytoscape.work.TaskMonitor; 12 | 13 | public class ClassFileReaderTask extends AbstractTask { 14 | 15 | private final EMDataSet dataset; 16 | 17 | public ClassFileReaderTask(EMDataSet dataset) { 18 | this.dataset = dataset; 19 | } 20 | 21 | @Override 22 | public void run(TaskMonitor taskMonitor) throws Exception { 23 | taskMonitor.setTitle("Parsing class file"); 24 | String classFile = dataset.getDataSetFiles().getClassFile(); 25 | String[] classes = parseClasses(classFile); 26 | dataset.getEnrichments().setPhenotypes(classes); 27 | } 28 | 29 | 30 | public static String[] parseClasses(String classFile) { 31 | if (isNullOrEmpty(classFile)) 32 | return new String[] {"NA_pos", "NA_neg"}; 33 | 34 | File f = new File(classFile); 35 | if(!f.exists()) 36 | return null; 37 | 38 | try { 39 | List lines = LineReader.readLines(classFile, 4); 40 | 41 | /* 42 | * GSEA class files will have 3 lines in the following format: 6 2 1 43 | * # R9C_8W WT_8W R9C_8W R9C_8W R9C_8W WT_8W WT_8W WT_8W 44 | * 45 | * If the file has 3 lines assume it is a GSEA and get the 46 | * phenotypes from the third line. If the file only has 1 line 47 | * assume that it is a generic class file and get the phenotypes 48 | * from the single line 49 | * the class file can be split by a space or a tab 50 | */ 51 | if(lines.size() >= 3) 52 | return lines.get(2).split("\\s"); 53 | else if(lines.size() == 1) 54 | return lines.get(0).split("\\s"); 55 | else 56 | return null; 57 | 58 | } catch (IOException ie) { 59 | System.err.println("unable to open class file: " + classFile); 60 | return null; 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/GREATWhichPvalueQuestionTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.parsers; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters; 4 | import org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.GreatFilter; 5 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 6 | import org.cytoscape.work.AbstractTask; 7 | import org.cytoscape.work.ObservableTask; 8 | import org.cytoscape.work.TaskMonitor; 9 | import org.cytoscape.work.Tunable; 10 | import org.cytoscape.work.util.ListSingleSelection; 11 | 12 | public class GREATWhichPvalueQuestionTask extends AbstractTask implements ObservableTask{ 13 | //tunable representing the question 14 | @Tunable(description="GREAT results can be filtered by Hypergeometric, <
>Binomial, both[AND] or either[OR] tests.
Which would you like to filter by?") 15 | public ListSingleSelection filterResponse; 16 | 17 | private static final String hyper = "Hypergeometric p-value"; 18 | private static final String binom = "Binomial p-value"; 19 | private static final String both = "Both"; 20 | private static final String either = "Either"; 21 | 22 | private final EMCreationParameters params; 23 | 24 | public GREATWhichPvalueQuestionTask(EnrichmentMap map) { 25 | filterResponse = new ListSingleSelection<>(hyper, binom, both, either); 26 | params = map.getParams(); 27 | } 28 | 29 | @Override 30 | public void run(TaskMonitor tm) { 31 | var filter = getFilter(filterResponse.getSelectedValue()); 32 | params.setGreatFilter(filter); 33 | } 34 | 35 | private static GreatFilter getFilter(String value) { 36 | switch(value) { 37 | case hyper: return GreatFilter.HYPER; 38 | case binom: return GreatFilter.BINOM; 39 | case both: return GreatFilter.BOTH; 40 | case either: return GreatFilter.EITHER; 41 | } 42 | return null; 43 | } 44 | 45 | public R getResults(Class arg) { 46 | return null; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/ParseGSEAEnrichmentException.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.parsers; 2 | 3 | @SuppressWarnings("serial") 4 | public class ParseGSEAEnrichmentException extends RuntimeException { 5 | 6 | private final String nonParsableToken; 7 | 8 | public ParseGSEAEnrichmentException(Throwable cause, String nonParsableToken) { 9 | super(cause); 10 | this.nonParsableToken = nonParsableToken; 11 | } 12 | 13 | public String getNonParseableToken() { 14 | return nonParsableToken; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/RanksGeneMismatchException.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.parsers; 2 | 3 | @SuppressWarnings("serial") 4 | public class RanksGeneMismatchException extends RuntimeException { 5 | 6 | private final String ranksFileName; 7 | 8 | public RanksGeneMismatchException(String ranksFileName, String message) { 9 | super(message); 10 | this.ranksFileName = ranksFileName; 11 | } 12 | 13 | public String getRanksFileName() { 14 | return ranksFileName; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/parsers/RanksUnsortedException.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.parsers; 2 | 3 | @SuppressWarnings("serial") 4 | public class RanksUnsortedException extends RuntimeException { 5 | 6 | private final String ranksFileName; 7 | 8 | public RanksUnsortedException(String ranksFileName, String message) { 9 | super(message); 10 | this.ranksFileName = ranksFileName; 11 | } 12 | 13 | public String getRanksFileName() { 14 | return ranksFileName; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/resolver/CancelStatus.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.resolver; 2 | 3 | @FunctionalInterface 4 | public interface CancelStatus { 5 | 6 | public boolean isCancelled(); 7 | 8 | public static CancelStatus notCancelable() { 9 | return new CancelStatus() { 10 | @Override public boolean isCancelled() { return false; } 11 | }; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/rest/ModelResource.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.rest; 2 | 3 | import javax.ws.rs.GET; 4 | import javax.ws.rs.Path; 5 | import javax.ws.rs.PathParam; 6 | import javax.ws.rs.Produces; 7 | import javax.ws.rs.core.MediaType; 8 | import javax.ws.rs.core.Response; 9 | import javax.ws.rs.core.Response.Status; 10 | 11 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 12 | import org.baderlab.csplugins.enrichmentmap.model.io.ModelSerializer; 13 | 14 | import com.google.inject.Inject; 15 | 16 | import io.swagger.annotations.Api; 17 | import io.swagger.annotations.ApiOperation; 18 | import io.swagger.annotations.ApiParam; 19 | 20 | @Api(tags="Apps: EnrichmentMap") 21 | @Path("/enrichmentmap/model") 22 | public class ModelResource { 23 | 24 | @Inject private ResourceUtil resourceUtil; 25 | 26 | @GET 27 | @ApiOperation(value="Get enrichment map model data for a given network.", response=EnrichmentMap.class) 28 | @Path("/{network}") 29 | @Produces(MediaType.APPLICATION_JSON) 30 | public Response getModelData( 31 | @ApiParam(value="Network name or SUID") @PathParam("network") String network 32 | ) { 33 | return 34 | resourceUtil.getEnrichmentMap(network) 35 | .map(this::getEnrichmentMapJSON) 36 | .map(data -> Response.ok(data).build()) 37 | .orElse(Response.status(Status.NOT_FOUND).build()); 38 | } 39 | 40 | 41 | private String getEnrichmentMapJSON(EnrichmentMap map) { 42 | // Don't rely on the auto json serialization because ModelSerializer needs to customize the GSON serializer. 43 | return ModelSerializer.serialize(map, true); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/rest/ResourceUtil.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.rest; 2 | 3 | import java.util.Optional; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 6 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager; 7 | import org.cytoscape.model.CyNetwork; 8 | import org.cytoscape.model.CyNetworkManager; 9 | 10 | import com.google.inject.Inject; 11 | 12 | public class ResourceUtil { 13 | 14 | @Inject private EnrichmentMapManager emManager; 15 | @Inject private CyNetworkManager networkManager; 16 | 17 | 18 | public Optional getEnrichmentMap(String network) { 19 | try { 20 | long suid = Long.parseLong(network); 21 | return Optional.ofNullable(emManager.getEnrichmentMap(suid)); 22 | } catch(NumberFormatException e) { 23 | Optional suid = getNetworkByName(network); 24 | return suid.map(emManager::getEnrichmentMap); 25 | } 26 | } 27 | 28 | private Optional getNetworkByName(String name) { 29 | for(CyNetwork network : networkManager.getNetworkSet()) { 30 | String netName = network.getRow(network).get(CyNetwork.NAME, String.class); 31 | if(name.equals(netName)) { 32 | return Optional.of(network.getSUID()); 33 | } 34 | } 35 | return Optional.empty(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/rest/response/DataSetClassResponse.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.rest.response; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import org.baderlab.csplugins.enrichmentmap.model.EMDataSet; 7 | 8 | public class DataSetClassResponse { 9 | 10 | private final String dataSet; 11 | private final List classes; 12 | private final String phenotype1; 13 | private final String phenotype2; 14 | 15 | public DataSetClassResponse(EMDataSet dataSet) { 16 | this.dataSet = dataSet.getName(); 17 | this.classes = Arrays.asList(dataSet.getEnrichments().getPhenotypes()); 18 | this.phenotype1 = dataSet.getEnrichments().getPhenotype1(); 19 | this.phenotype2 = dataSet.getEnrichments().getPhenotype2(); 20 | } 21 | 22 | public String getDataSet() { 23 | return dataSet; 24 | } 25 | 26 | public List getClasses() { 27 | return classes; 28 | } 29 | 30 | public String getPhenotype1() { 31 | return phenotype1; 32 | } 33 | 34 | public String getPhenotype2() { 35 | return phenotype2; 36 | } 37 | 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/rest/response/DataSetExpressionResponse.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.rest.response; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | import java.util.Optional; 7 | import java.util.Set; 8 | import java.util.function.Predicate; 9 | 10 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 11 | import org.baderlab.csplugins.enrichmentmap.model.GeneExpressionMatrix; 12 | 13 | public class DataSetExpressionResponse { 14 | 15 | private List dataSets; 16 | private int numConditions; 17 | private List columnNames; 18 | private int expressionUniverse; 19 | private List expressions; 20 | 21 | public DataSetExpressionResponse(EnrichmentMap map, List dataSets, GeneExpressionMatrix matrix, Optional> genes) { 22 | this.dataSets = dataSets; 23 | 24 | Predicate geneFilter = genes.isPresent() ? genes.get()::contains : s -> true; 25 | 26 | numConditions = matrix.getNumConditions() - 2; 27 | String[] colsWithName = matrix.getColumnNames(); 28 | columnNames = Arrays.asList(colsWithName).subList(2, colsWithName.length); 29 | expressionUniverse = matrix.getExpressionUniverse(); 30 | 31 | expressions = new ArrayList<>(); 32 | 33 | matrix.getExpressionMatrix().forEach((hash, geneExpression) -> { 34 | String geneName = map.getGeneFromHashKey(hash); 35 | if(geneFilter.test(geneName)) { 36 | float[] values = geneExpression.getExpression(); 37 | expressions.add(new GeneExpressionResponse(geneName, values)); 38 | } 39 | }); 40 | } 41 | 42 | public List getDataSets() { 43 | return dataSets; 44 | } 45 | 46 | public List getExpressions() { 47 | return expressions; 48 | } 49 | 50 | public int getNumConditions() { 51 | return numConditions; 52 | } 53 | 54 | public List getColumnNames() { 55 | return columnNames; 56 | } 57 | 58 | public int getExpressionUniverse() { 59 | return expressionUniverse; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/rest/response/GeneExpressionResponse.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.rest.response; 2 | 3 | public class GeneExpressionResponse { 4 | 5 | private String geneName; 6 | private float[] values; 7 | 8 | public GeneExpressionResponse(String geneName, float[] values) { 9 | this.geneName = geneName; 10 | this.values = values; 11 | } 12 | 13 | public String getGeneName() { 14 | return geneName; 15 | } 16 | 17 | public float[] getValues() { 18 | return values; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/ChartData.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.style.EMStyleBuilder.Columns; 4 | import org.baderlab.csplugins.enrichmentmap.view.util.Labels; 5 | 6 | public enum ChartData { 7 | 8 | NONE(Labels.NONE, null), 9 | NES_VALUE("NES Columns", Columns.NODE_NES), 10 | NES_SIG("NES Columns (significant)", Columns.NODE_NES), 11 | P_VALUE("P-value Columns", Columns.NODE_PVALUE), 12 | FDR_VALUE("Q-value (FDR) Columns", Columns.NODE_FDR_QVALUE), 13 | PHENOTYPES("Phenotypes", Columns.NODE_COLOURING), 14 | DATA_SET("Color by Data Set", Columns.DATASET_CHART), 15 | EXPRESSION_DATA("Color by Expression Data", Columns.EXPRESSION_DATA_CHART), 16 | LOG10_PVAL("-log10(pvalue)", Columns.NODE_LOG_PVALUE), 17 | LOG10_PVAL_NES("-log10(pvalue)*sign(NES)", Columns.NODE_LOG_PVALUE_NES); 18 | 19 | private final String label; 20 | private final AbstractColumnDescriptor columnDescriptor; 21 | 22 | private ChartData(String label, AbstractColumnDescriptor columnDescriptor) { 23 | this.label = label; 24 | this.columnDescriptor = columnDescriptor; 25 | } 26 | 27 | public String getLabel() { 28 | return label; 29 | } 30 | 31 | public AbstractColumnDescriptor getColumnDescriptor() { 32 | return columnDescriptor; 33 | } 34 | 35 | public boolean isChartTypeSelectable() { 36 | return this != NONE && this != DATA_SET && this != EXPRESSION_DATA; 37 | } 38 | 39 | /** 40 | * Returns true if the data range goes negative-zero-positive 41 | */ 42 | public boolean isDiverging() { 43 | return this == NES_VALUE || this == NES_SIG || this == LOG10_PVAL_NES; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return label; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/ChartFactoryManager.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import org.cytoscape.view.presentation.customgraphics.CyCustomGraphics2Factory; 7 | 8 | import com.google.inject.Singleton; 9 | 10 | @Singleton 11 | public class ChartFactoryManager { 12 | 13 | private Map> factories = new HashMap<>(); 14 | 15 | public void addFactory(CyCustomGraphics2Factory factory, Map serviceProps) { 16 | factories.put(factory.getId(), factory); 17 | } 18 | 19 | public void removeFactory(CyCustomGraphics2Factory factory, Map serviceProps) { 20 | factories.remove(factory.getId()); 21 | } 22 | 23 | public CyCustomGraphics2Factory getChartFactory(final String id) { 24 | return factories.get(id); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/ChartOptions.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style; 2 | 3 | public class ChartOptions { 4 | 5 | private ChartData data; 6 | private ChartType type; 7 | private ColorScheme colorScheme; 8 | private boolean showLabels; 9 | 10 | public ChartOptions(ChartData data, ChartType type, ColorScheme colorScheme, boolean showLabels) { 11 | this.data = data; 12 | this.type = type; 13 | this.colorScheme = colorScheme; 14 | this.showLabels = showLabels; 15 | } 16 | 17 | public ChartData getData() { 18 | return data; 19 | } 20 | 21 | public void setData(ChartData data) { 22 | this.data = data; 23 | } 24 | 25 | public ChartType getType() { 26 | return type; 27 | } 28 | 29 | public void setType(ChartType type) { 30 | this.type = type; 31 | } 32 | 33 | public ColorScheme getColorScheme() { 34 | return colorScheme; 35 | } 36 | 37 | public void setColorScheme(ColorScheme colorScheme) { 38 | this.colorScheme = colorScheme; 39 | } 40 | 41 | public boolean isShowLabels() { 42 | return showLabels; 43 | } 44 | 45 | public void setShowLabels(boolean showLabels) { 46 | this.showLabels = showLabels; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/ColumnDescriptor.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet; 4 | import org.cytoscape.model.CyRow; 5 | import org.cytoscape.model.CyTable; 6 | 7 | public class ColumnDescriptor extends AbstractColumnDescriptor { 8 | 9 | private final Class type; 10 | 11 | public ColumnDescriptor(String name, Class type) { 12 | super(name); 13 | this.type = type; 14 | } 15 | 16 | public Class getType() { 17 | return type; 18 | } 19 | 20 | public T get(CyRow row, String prefix, AbstractDataSet ds) { 21 | return row.get(with(prefix,ds), type); 22 | } 23 | 24 | public T get(CyRow row, String prefix) { 25 | return row.get(with(prefix,null), type); 26 | } 27 | 28 | public T get(CyRow row) { 29 | return row.get(name, type); 30 | } 31 | 32 | public void set(CyRow row, String prefix, AbstractDataSet ds, T value) { 33 | row.set(with(prefix,ds), value); 34 | } 35 | 36 | public void set(CyRow row, String prefix, T value) { 37 | row.set(with(prefix,null), value); 38 | } 39 | 40 | public void set(CyRow row, T value) { 41 | row.set(name, value); 42 | } 43 | 44 | public void createColumn(CyTable table, String prefix, AbstractDataSet ds) { 45 | table.createColumn(with(prefix,ds), type, true); 46 | } 47 | 48 | @Override 49 | public void createColumn(CyTable table) { 50 | table.createColumn(name, type, true); 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/ColumnListDescriptor.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style; 2 | 3 | import java.util.List; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.model.AbstractDataSet; 6 | import org.cytoscape.model.CyRow; 7 | import org.cytoscape.model.CyTable; 8 | 9 | /** 10 | * MKTODO Replace the "String suffix" parameters with "AbstractDataSet" like in ColumnDescriptor. 11 | */ 12 | public class ColumnListDescriptor extends AbstractColumnDescriptor { 13 | 14 | private final Class elementType; 15 | 16 | public ColumnListDescriptor(String name, Class elementType) { 17 | super(name); 18 | this.elementType = elementType; 19 | } 20 | 21 | public Class getElementType() { 22 | return elementType; 23 | } 24 | 25 | public List get(CyRow row, String prefix, AbstractDataSet ds) { 26 | return row.getList(with(prefix,ds), elementType); 27 | } 28 | 29 | public List get(CyRow row, String prefix) { 30 | return row.getList(with(prefix,null), elementType); 31 | } 32 | 33 | public List get(CyRow row) { 34 | return row.getList(name, elementType); 35 | } 36 | 37 | public void set(CyRow row, String prefix, AbstractDataSet ds, List value) { 38 | row.set(with(prefix,ds), value); 39 | } 40 | 41 | public void set(CyRow row, String prefix, List value) { 42 | row.set(with(prefix,null), value); 43 | } 44 | 45 | public void set(CyRow row, List value) { 46 | row.set(name, value); 47 | } 48 | 49 | @Override 50 | public void createColumn(CyTable table, String prefix, AbstractDataSet ds) { 51 | table.createListColumn(with(prefix,ds), elementType, true); 52 | } 53 | 54 | @Override 55 | public void createColumn(CyTable table) { 56 | table.createListColumn(name, elementType, true); 57 | } 58 | 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/CustomPieSectionLabelGenerator.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts; 2 | 3 | import java.text.DecimalFormat; 4 | import java.text.NumberFormat; 5 | import java.util.Locale; 6 | import java.util.Map; 7 | 8 | import org.jfree.chart.labels.StandardPieSectionLabelGenerator; 9 | import org.jfree.data.general.PieDataset; 10 | 11 | 12 | @SuppressWarnings("serial") 13 | public class CustomPieSectionLabelGenerator extends StandardPieSectionLabelGenerator { 14 | 15 | private final Map labels; 16 | 17 | public CustomPieSectionLabelGenerator(final Map labels) { 18 | this("{1} ({2})", new DecimalFormat("0.0"), new DecimalFormat("0%"), labels); 19 | } 20 | 21 | public CustomPieSectionLabelGenerator(final Locale locale, final Map labels) { 22 | super(locale); 23 | this.labels = labels; 24 | } 25 | 26 | public CustomPieSectionLabelGenerator(final String labelFormat, final Locale locale, 27 | final Map labels) { 28 | super(labelFormat, locale); 29 | this.labels = labels; 30 | } 31 | 32 | public CustomPieSectionLabelGenerator(final String labelFormat, final NumberFormat numberFormat, 33 | final NumberFormat percentFormat, final Map labels) { 34 | super(labelFormat, numberFormat, percentFormat); 35 | this.labels = labels; 36 | } 37 | 38 | public CustomPieSectionLabelGenerator(final String labelFormat, final Map labels) { 39 | super(labelFormat); 40 | this.labels = labels; 41 | } 42 | 43 | @Override 44 | @SuppressWarnings("rawtypes") 45 | public String generateSectionLabel(PieDataset dataset, Comparable key) { 46 | if (dataset.getValue(key).doubleValue() == 0.0) 47 | return null; 48 | if (labels != null && labels.get(key.toString()) != null) 49 | return labels.get(key.toString()); 50 | 51 | return super.generateSectionLabel(dataset, key); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/LabelPosition.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts; 2 | 3 | public enum LabelPosition { 4 | STANDARD("Standard"), 5 | DOWN_45("Down 45\u00B0"), 6 | DOWN_90("Down 90\u00B0"), 7 | UP_45("Up 45\u00B0"), 8 | UP_90("Up 90\u00B0"); 9 | 10 | private String label; 11 | 12 | private LabelPosition(final String label) { 13 | this.label = label; 14 | } 15 | 16 | public String getLabel() { 17 | return label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/Orientation.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts; 2 | 3 | public enum Orientation { 4 | HORIZONTAL, 5 | VERTICAL 6 | } 7 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/Rotation.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts; 2 | 3 | public enum Rotation { 4 | ANTICLOCKWISE, 5 | CLOCKWISE; 6 | } 7 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/TexturePaintFactory.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts; 2 | 3 | import java.awt.TexturePaint; 4 | import java.awt.geom.Rectangle2D; 5 | import java.awt.image.BufferedImage; 6 | 7 | public class TexturePaintFactory { 8 | 9 | private BufferedImage img; 10 | 11 | public TexturePaintFactory(final BufferedImage img) { 12 | this.img = img; 13 | } 14 | 15 | public TexturePaint getPaint(Rectangle2D bound) { 16 | return new TexturePaint(img, bound); 17 | } 18 | 19 | public BufferedImage getImage() { 20 | return img; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/json/ColorJsonDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts.json; 2 | 3 | import java.awt.Color; 4 | import java.io.IOException; 5 | 6 | import org.baderlab.csplugins.enrichmentmap.view.util.ColorUtil; 7 | 8 | import com.fasterxml.jackson.core.JsonParser; 9 | import com.fasterxml.jackson.core.JsonProcessingException; 10 | import com.fasterxml.jackson.core.ObjectCodec; 11 | import com.fasterxml.jackson.databind.DeserializationContext; 12 | import com.fasterxml.jackson.databind.JsonDeserializer; 13 | import com.fasterxml.jackson.databind.JsonNode; 14 | 15 | public class ColorJsonDeserializer extends JsonDeserializer { 16 | 17 | @Override 18 | public Color deserialize(final JsonParser jp, final DeserializationContext ctxt) 19 | throws IOException, JsonProcessingException { 20 | final ObjectCodec oc = jp.getCodec(); 21 | final JsonNode node = oc.readTree(jp); 22 | 23 | return node.isTextual() ? ColorUtil.parseColor(node.asText()) : null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/json/ColorJsonSerializer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts.json; 2 | 3 | import java.awt.Color; 4 | import java.io.IOException; 5 | 6 | import org.baderlab.csplugins.enrichmentmap.view.util.ColorUtil; 7 | 8 | import com.fasterxml.jackson.core.JsonGenerator; 9 | import com.fasterxml.jackson.core.JsonProcessingException; 10 | import com.fasterxml.jackson.databind.JsonSerializer; 11 | import com.fasterxml.jackson.databind.SerializerProvider; 12 | 13 | public class ColorJsonSerializer extends JsonSerializer { 14 | 15 | @Override 16 | public void serialize(final Color value, final JsonGenerator jgen, final SerializerProvider provider) 17 | throws IOException, JsonProcessingException { 18 | if (value != null) 19 | jgen.writeString(ColorUtil.toHexString((Color)value)); 20 | else 21 | jgen.writeNull(); 22 | } 23 | 24 | @Override 25 | public Class handledType() { 26 | return Color.class; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/json/CyColumnIdentifierJsonDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.cytoscape.view.presentation.property.values.CyColumnIdentifier; 6 | import org.cytoscape.view.presentation.property.values.CyColumnIdentifierFactory; 7 | 8 | import com.fasterxml.jackson.core.JsonParser; 9 | import com.fasterxml.jackson.core.JsonProcessingException; 10 | import com.fasterxml.jackson.core.ObjectCodec; 11 | import com.fasterxml.jackson.databind.DeserializationContext; 12 | import com.fasterxml.jackson.databind.JsonDeserializer; 13 | import com.fasterxml.jackson.databind.JsonNode; 14 | 15 | public class CyColumnIdentifierJsonDeserializer extends JsonDeserializer { 16 | 17 | private final CyColumnIdentifierFactory colIdFactory; 18 | 19 | public CyColumnIdentifierJsonDeserializer(final CyColumnIdentifierFactory colIdFactory) { 20 | this.colIdFactory = colIdFactory; 21 | } 22 | 23 | @Override 24 | public CyColumnIdentifier deserialize(final JsonParser jp, final DeserializationContext ctxt) 25 | throws IOException, JsonProcessingException { 26 | final ObjectCodec oc = jp.getCodec(); 27 | final JsonNode node = oc.readTree(jp); 28 | 29 | return node != null && node.isTextual() ? colIdFactory.createColumnIdentifier(node.textValue()) : null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/json/CyColumnIdentifierJsonSerializer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.cytoscape.view.presentation.property.values.CyColumnIdentifier; 6 | 7 | import com.fasterxml.jackson.core.JsonGenerator; 8 | import com.fasterxml.jackson.core.JsonProcessingException; 9 | import com.fasterxml.jackson.databind.JsonSerializer; 10 | import com.fasterxml.jackson.databind.SerializerProvider; 11 | 12 | public class CyColumnIdentifierJsonSerializer extends JsonSerializer { 13 | 14 | @Override 15 | public void serialize(final CyColumnIdentifier value, final JsonGenerator jgen, final SerializerProvider provider) 16 | throws IOException, JsonProcessingException { 17 | if (value != null) 18 | jgen.writeString(((CyColumnIdentifier)value).toString()); 19 | else 20 | jgen.writeNull(); 21 | } 22 | 23 | @Override 24 | public Class handledType() { 25 | return CyColumnIdentifier.class; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/json/Point2DJsonDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts.json; 2 | 3 | import java.awt.geom.Point2D; 4 | import java.io.IOException; 5 | 6 | import com.fasterxml.jackson.core.JsonParser; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.ObjectCodec; 9 | import com.fasterxml.jackson.databind.DeserializationContext; 10 | import com.fasterxml.jackson.databind.JsonDeserializer; 11 | import com.fasterxml.jackson.databind.JsonNode; 12 | 13 | public class Point2DJsonDeserializer extends JsonDeserializer { 14 | 15 | @Override 16 | public Point2D deserialize(final JsonParser jp, final DeserializationContext ctxt) 17 | throws IOException, JsonProcessingException { 18 | final ObjectCodec oc = jp.getCodec(); 19 | final JsonNode node = oc.readTree(jp); 20 | 21 | final JsonNode xNode = node.get("x"); 22 | final JsonNode yNode = node.get("y"); 23 | 24 | final double x = xNode != null && xNode.isNumber() ? xNode.asDouble() : 0; 25 | final double y = yNode != null && yNode.isNumber() ? yNode.asDouble() : 0; 26 | 27 | return new Point2D.Double(x, y); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/json/Point2DJsonSerializer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts.json; 2 | 3 | import java.awt.geom.Point2D; 4 | import java.io.IOException; 5 | 6 | import com.fasterxml.jackson.core.JsonGenerator; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.databind.JsonSerializer; 9 | import com.fasterxml.jackson.databind.SerializerProvider; 10 | 11 | public class Point2DJsonSerializer extends JsonSerializer { 12 | 13 | @Override 14 | public void serialize(final Point2D value, final JsonGenerator jgen, final SerializerProvider provider) 15 | throws IOException, JsonProcessingException { 16 | if (value != null) { 17 | jgen.writeStartObject(); 18 | jgen.writeNumberField("x", value.getX()); 19 | jgen.writeNumberField("y", value.getY()); 20 | jgen.writeEndObject(); 21 | } else { 22 | jgen.writeNull(); 23 | } 24 | } 25 | 26 | @Override 27 | public Class handledType() { 28 | return Point2D.class; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/json/PropertiesJsonSerializer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts.json; 2 | 3 | import java.io.IOException; 4 | import java.lang.reflect.Array; 5 | import java.util.Collection; 6 | import java.util.Map; 7 | import java.util.Map.Entry; 8 | 9 | import com.fasterxml.jackson.core.JsonGenerator; 10 | import com.fasterxml.jackson.core.JsonProcessingException; 11 | import com.fasterxml.jackson.databind.JsonSerializer; 12 | import com.fasterxml.jackson.databind.SerializerProvider; 13 | 14 | public class PropertiesJsonSerializer extends JsonSerializer> { 15 | 16 | @Override 17 | public void serialize(final Map map, final JsonGenerator jgen, final SerializerProvider provider) 18 | throws IOException, JsonProcessingException { 19 | // Start 20 | jgen.writeStartObject(); 21 | 22 | // Write properties 23 | for (final Entry entry : map.entrySet()) { 24 | final String key = entry.getKey(); 25 | final Object value = entry.getValue(); 26 | 27 | if (key != null && value != null) { 28 | if (value.getClass().isArray()) { 29 | int length = Array.getLength(value); 30 | 31 | jgen.writeArrayFieldStart(key); 32 | 33 | for (int i = 0; i < length; i++) 34 | jgen.writeObject(Array.get(value, i)); 35 | 36 | jgen.writeEndArray(); 37 | } else if (value instanceof Collection) { 38 | jgen.writeArrayFieldStart(key); 39 | 40 | for (final Object v : (Collection)value) 41 | jgen.writeObject(v); 42 | 43 | jgen.writeEndArray(); 44 | } else { 45 | jgen.writeFieldName(key); 46 | jgen.writeObject(value); 47 | } 48 | } 49 | } 50 | 51 | // End 52 | jgen.writeEndObject(); 53 | } 54 | 55 | @Override 56 | public Class handledType() { 57 | return Map.class; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/json/Rectangle2DJsonDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts.json; 2 | 3 | import java.awt.geom.Rectangle2D; 4 | import java.io.IOException; 5 | 6 | import com.fasterxml.jackson.core.JsonParser; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.core.ObjectCodec; 9 | import com.fasterxml.jackson.databind.DeserializationContext; 10 | import com.fasterxml.jackson.databind.JsonDeserializer; 11 | import com.fasterxml.jackson.databind.JsonNode; 12 | 13 | public class Rectangle2DJsonDeserializer extends JsonDeserializer { 14 | 15 | @Override 16 | public Rectangle2D deserialize(final JsonParser jp, final DeserializationContext ctxt) 17 | throws IOException, JsonProcessingException { 18 | final ObjectCodec oc = jp.getCodec(); 19 | final JsonNode node = oc.readTree(jp); 20 | 21 | final JsonNode xNode = node.get("x"); 22 | final JsonNode yNode = node.get("y"); 23 | final JsonNode wNode = node.get("width"); 24 | final JsonNode hNode = node.get("height"); 25 | 26 | final double x = xNode != null && xNode.isNumber() ? xNode.asDouble() : 0; 27 | final double y = yNode != null && yNode.isNumber() ? yNode.asDouble() : 0; 28 | final double w = wNode != null && wNode.isNumber() ? wNode.asDouble() : 0; 29 | final double h = hNode != null && hNode.isNumber() ? hNode.asDouble() : 0; 30 | 31 | return new Rectangle2D.Double(x, y, w, h); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/style/charts/json/Rectangle2DJsonSerializer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.style.charts.json; 2 | 3 | import java.awt.geom.Rectangle2D; 4 | import java.io.IOException; 5 | 6 | import com.fasterxml.jackson.core.JsonGenerator; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.databind.JsonSerializer; 9 | import com.fasterxml.jackson.databind.SerializerProvider; 10 | 11 | public class Rectangle2DJsonSerializer extends JsonSerializer { 12 | 13 | @Override 14 | public void serialize(final Rectangle2D value, final JsonGenerator jgen, final SerializerProvider provider) 15 | throws IOException, JsonProcessingException { 16 | if (value != null) { 17 | jgen.writeStartObject(); 18 | jgen.writeNumberField("x", value.getX()); 19 | jgen.writeNumberField("y", value.getY()); 20 | jgen.writeNumberField("width", value.getWidth()); 21 | jgen.writeNumberField("height", value.getHeight()); 22 | jgen.writeEndObject(); 23 | } else { 24 | jgen.writeNull(); 25 | } 26 | } 27 | 28 | @Override 29 | public Class handledType() { 30 | return Rectangle2D.class; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/AutoAnnotateInitTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.view.creation.DependencyChecker; 4 | import org.cytoscape.command.CommandExecutorTaskFactory; 5 | import org.cytoscape.work.AbstractTask; 6 | import org.cytoscape.work.TaskMonitor; 7 | 8 | import com.google.inject.Inject; 9 | import com.google.inject.Provider; 10 | import com.google.inject.assistedinject.Assisted; 11 | import com.google.inject.assistedinject.AssistedInject; 12 | 13 | public class AutoAnnotateInitTask extends AbstractTask { 14 | 15 | @Inject private CommandExecutorTaskFactory commandTaskFactory; 16 | @Inject private Provider dependencyCheckerProvider; 17 | 18 | private String dataset; 19 | 20 | public static interface Factory { 21 | AutoAnnotateInitTask create(String dataset); 22 | } 23 | 24 | @AssistedInject 25 | public AutoAnnotateInitTask(@Assisted String dataset) { 26 | this.dataset = dataset; 27 | } 28 | 29 | @Override 30 | public void run(TaskMonitor tm) { 31 | var commandAvailable = dependencyCheckerProvider.get().isCommandAvailable("autoannotate", "eminit"); 32 | if(commandAvailable) { 33 | var tasks = commandTaskFactory.createTaskIterator(null, "autoannotate eminit warn=true dataSet=\"" + dataset + "\""); 34 | insertTasksAfterCurrentTask(tasks); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/AutoAnnotateOpenTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.view.creation.DependencyChecker; 4 | import org.cytoscape.command.CommandExecutorTaskFactory; 5 | import org.cytoscape.work.AbstractTask; 6 | import org.cytoscape.work.TaskMonitor; 7 | 8 | import com.google.inject.Inject; 9 | import com.google.inject.Provider; 10 | 11 | public class AutoAnnotateOpenTask extends AbstractTask { 12 | 13 | @Inject private CommandExecutorTaskFactory commandTaskFactory; 14 | @Inject private Provider dependencyCheckerProvider; 15 | 16 | @Override 17 | public void run(TaskMonitor tm) { 18 | var commandAvailable = dependencyCheckerProvider.get().isCommandAvailable("autoannotate", "open"); 19 | if(commandAvailable) { 20 | var tasks = commandTaskFactory.createTaskIterator(null, "autoannotate open tab=QUICK"); 21 | insertTasksAfterCurrentTask(tasks); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/AutoAnnotateRedrawTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.view.creation.DependencyChecker; 4 | import org.cytoscape.command.CommandExecutorTaskFactory; 5 | import org.cytoscape.work.AbstractTask; 6 | import org.cytoscape.work.TaskMonitor; 7 | 8 | import com.google.inject.Inject; 9 | import com.google.inject.Provider; 10 | 11 | public class AutoAnnotateRedrawTask extends AbstractTask { 12 | 13 | @Inject private CommandExecutorTaskFactory commandTaskFactory; 14 | @Inject private Provider dependencyCheckerProvider; 15 | 16 | @Override 17 | public void run(TaskMonitor tm) { 18 | var commandAvailable = dependencyCheckerProvider.get().isCommandAvailable("autoannotate", "redraw"); 19 | if(commandAvailable) { 20 | var tasks = commandTaskFactory.createTaskIterator(null, "autoannotate redraw eventType=emChartChanged"); 21 | insertTasksAfterCurrentTask(tasks); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/CancellableParallelTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task; 2 | 3 | import java.text.MessageFormat; 4 | import java.util.Timer; 5 | import java.util.TimerTask; 6 | import java.util.concurrent.ExecutorService; 7 | import java.util.concurrent.Executors; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import org.baderlab.csplugins.enrichmentmap.util.DiscreteTaskMonitor; 11 | import org.baderlab.csplugins.enrichmentmap.util.NullTaskMonitor; 12 | import org.cytoscape.work.AbstractTask; 13 | import org.cytoscape.work.TaskMonitor; 14 | 15 | public abstract class CancellableParallelTask extends AbstractTask { 16 | 17 | @Override 18 | public void run(TaskMonitor tm) throws InterruptedException { 19 | tm = NullTaskMonitor.check(tm); 20 | 21 | int cpus = Runtime.getRuntime().availableProcessors(); 22 | ExecutorService executor = Executors.newFixedThreadPool(cpus); 23 | 24 | T t = compute(tm, executor); 25 | 26 | // Support cancellation 27 | Timer timer = new Timer(); 28 | timer.scheduleAtFixedRate(new TimerTask() { 29 | public void run() { 30 | if (cancelled) { 31 | executor.shutdownNow(); 32 | } 33 | } 34 | }, 0, 1000); 35 | 36 | executor.shutdown(); 37 | executor.awaitTermination(3, TimeUnit.HOURS); 38 | timer.cancel(); 39 | 40 | if(!cancelled) 41 | done(t); 42 | } 43 | 44 | public abstract T compute(TaskMonitor tm, ExecutorService executor); 45 | 46 | public void done(T t) { 47 | 48 | } 49 | 50 | 51 | 52 | public static DiscreteTaskMonitor discreteTaskMonitor(TaskMonitor tm, int size) { 53 | DiscreteTaskMonitor taskMonitor = new DiscreteTaskMonitor(tm, size); 54 | taskMonitor.setTitle("Computing Geneset Similarities..."); 55 | taskMonitor.setPercentMessageCallback(percent -> MessageFormat.format("Computing Geneset Similarity: {0,number,#%}", percent)); 56 | return taskMonitor; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/MissingGenesetsException.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task; 2 | 3 | import java.util.Collection; 4 | import java.util.Collections; 5 | 6 | @SuppressWarnings("serial") 7 | public class MissingGenesetsException extends RuntimeException { 8 | 9 | private final Collection missingGenesetNames; 10 | 11 | public MissingGenesetsException(String missingGenesetName) { 12 | super("The Geneset " + missingGenesetName + " is not found in the GMT file."); 13 | this.missingGenesetNames = Collections.singleton(missingGenesetName); 14 | } 15 | 16 | public MissingGenesetsException(Collection missingGenesetNames) { 17 | super("There were " + missingGenesetNames.size() + " genesets not found in the GMT file."); 18 | this.missingGenesetNames = missingGenesetNames; 19 | } 20 | 21 | public Collection getMissingGenesetNames() { 22 | return Collections.unmodifiableCollection(missingGenesetNames); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/TitleTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task; 2 | 3 | import org.cytoscape.work.AbstractTask; 4 | import org.cytoscape.work.TaskMonitor; 5 | //A dummy task so that the correct title is set on the task dialog. 6 | 7 | public class TitleTask extends AbstractTask { 8 | 9 | private final String title; 10 | 11 | public TitleTask(String title) { 12 | this.title = title; 13 | } 14 | 15 | @Override 16 | public void run(TaskMonitor taskMonitor) throws Exception { 17 | //add sleep so that the correct title gets put in the dialog 18 | Thread.sleep(1500); 19 | taskMonitor.setTitle(title); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/genemania/GMGene.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task.genemania; 2 | 3 | import java.io.Serializable; 4 | 5 | public class GMGene implements Serializable { 6 | 7 | private static final long serialVersionUID = -4637681171522174342L; 8 | 9 | private String symbol; 10 | private String queryTerm; 11 | private boolean queryGene; 12 | private String description; 13 | private double score; 14 | 15 | public String getSymbol() { 16 | return symbol; 17 | } 18 | 19 | public void setSymbol(String symbol) { 20 | this.symbol = symbol; 21 | } 22 | 23 | public String getQueryTerm() { 24 | return queryTerm; 25 | } 26 | 27 | public void setQuerySymbol(String querySymbol) { 28 | this.queryTerm = querySymbol; 29 | } 30 | 31 | public boolean isQueryGene() { 32 | return queryGene; 33 | } 34 | 35 | public void setQueryGene(boolean queryGene) { 36 | this.queryGene = queryGene; 37 | } 38 | 39 | public String getDescription() { 40 | return description; 41 | } 42 | 43 | public void setDescription(String description) { 44 | this.description = description; 45 | } 46 | 47 | public double getScore() { 48 | return score; 49 | } 50 | 51 | public void setScore(double score) { 52 | this.score = score; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return symbol; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/genemania/GMOrganism.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task.genemania; 2 | 3 | import java.io.Serializable; 4 | 5 | public class GMOrganism implements Serializable { 6 | 7 | private static final long serialVersionUID = -4488165932347985569L; 8 | 9 | private long taxonomyId; 10 | private String scientificName; 11 | private String abbreviatedName; 12 | private String commonName; 13 | 14 | public GMOrganism() { 15 | } 16 | 17 | public long getTaxonomyId() { 18 | return taxonomyId; 19 | } 20 | 21 | public void setTaxonomyId(long taxonomyId) { 22 | this.taxonomyId = taxonomyId; 23 | } 24 | 25 | public String getScientificName() { 26 | return scientificName; 27 | } 28 | 29 | public void setScientificName(String scientificName) { 30 | this.scientificName = scientificName; 31 | } 32 | 33 | public String getAbbreviatedName() { 34 | return abbreviatedName; 35 | } 36 | 37 | public void setAbbreviatedName(String abbreviatedName) { 38 | this.abbreviatedName = abbreviatedName; 39 | } 40 | 41 | public String getCommonName() { 42 | return commonName; 43 | } 44 | 45 | public void setCommonName(String commonName) { 46 | this.commonName = commonName; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return scientificName; 52 | } 53 | } -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/genemania/GMOrganismsResult.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task.genemania; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class GMOrganismsResult implements Serializable { 7 | 8 | private static final long serialVersionUID = 8454506417358350512L; 9 | 10 | private List organisms; 11 | 12 | public List getOrganisms() { 13 | return organisms; 14 | } 15 | 16 | public void setOrganisms(List organisms) { 17 | this.organisms = organisms; 18 | } 19 | } -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/genemania/GMSearchResult.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task.genemania; 2 | 3 | import java.io.Serializable; 4 | import java.util.Collection; 5 | 6 | public class GMSearchResult implements Serializable { 7 | 8 | private static final long serialVersionUID = -795122082632063250L; 9 | 10 | private GMOrganism organism; 11 | private String combiningMethod; 12 | private Collection genes; 13 | private Long network; 14 | 15 | public GMOrganism getOrganism() { 16 | return organism; 17 | } 18 | 19 | public void setOrganism(GMOrganism organism) { 20 | this.organism = organism; 21 | } 22 | 23 | public String getCombiningMethod() { 24 | return combiningMethod; 25 | } 26 | 27 | public void setCombiningMethod(String combiningMethod) { 28 | this.combiningMethod = combiningMethod; 29 | } 30 | 31 | public Collection getGenes() { 32 | return genes; 33 | } 34 | 35 | public void setGenes(Collection genes) { 36 | this.genes = genes; 37 | } 38 | 39 | public Long getNetwork() { 40 | return network; 41 | } 42 | 43 | public void setNetwork(Long network) { 44 | this.network = network; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/genemania/GMWeightingMethod.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task.genemania; 2 | 3 | public enum GMWeightingMethod { 4 | 5 | AUTOMATIC_SELECT("automatic"), 6 | AUTOMATIC("query gene-based"), 7 | BP("GO biological process-based"), 8 | MF("GO molecular function-based"), 9 | CC("GO cellular component-based"), 10 | AVERAGE("equal (by network)"), 11 | AVERAGE_CATEGORY("equal (by data type)"); 12 | 13 | private final String description; 14 | 15 | GMWeightingMethod(String description) { 16 | this.description = description; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return description; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/postanalysis/FilterMetricSet.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task.postanalysis; 2 | 3 | import java.util.Collection; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import java.util.Objects; 7 | 8 | import org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterType; 9 | 10 | /** 11 | * Each data set may be filtered using a different universe size in the case of hypergeometric 12 | * or a different rank file in the case of mann-whitney. However all the datasets must use 13 | * the same type of filter. 14 | * 15 | * @author mkucera 16 | * 17 | */ 18 | public class FilterMetricSet { 19 | 20 | private final Map metrics = new HashMap<>(); 21 | 22 | private final PostAnalysisFilterType type; 23 | 24 | public FilterMetricSet(PostAnalysisFilterType type) { 25 | this.type = Objects.requireNonNull(type); 26 | } 27 | 28 | public PostAnalysisFilterType getType() { 29 | return type; 30 | } 31 | 32 | public void put(String dataSetName, FilterMetric metric) { 33 | if(metric.getFilterType() != type) 34 | throw new IllegalArgumentException("Wrong PostAnalysisFilterType"); 35 | metrics.put(dataSetName, metric); 36 | } 37 | 38 | public FilterMetric get(String dataSetName) { 39 | return metrics.get(dataSetName); 40 | } 41 | 42 | public Collection getDataSetNames() { 43 | return metrics.keySet(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/string/QueryStringNodeViewTaskFactory.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task.string; 2 | 3 | import java.util.List; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap; 6 | import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMapManager; 7 | import org.baderlab.csplugins.enrichmentmap.style.EMStyleBuilder.Columns; 8 | import org.baderlab.csplugins.enrichmentmap.task.tunables.GeneListTunable; 9 | import org.baderlab.csplugins.enrichmentmap.view.heatmap.GSEALeadingEdgeRankingOption; 10 | import org.baderlab.csplugins.enrichmentmap.view.heatmap.RankingOptionFactory; 11 | import org.cytoscape.model.CyNetwork; 12 | import org.cytoscape.model.CyNode; 13 | import org.cytoscape.model.CyRow; 14 | import org.cytoscape.task.NodeViewTaskFactory; 15 | import org.cytoscape.view.model.CyNetworkView; 16 | import org.cytoscape.view.model.View; 17 | import org.cytoscape.work.TaskIterator; 18 | 19 | import com.google.inject.Inject; 20 | 21 | public class QueryStringNodeViewTaskFactory implements NodeViewTaskFactory { 22 | 23 | @Inject private StringAppTaskFactory stringAppFactory; 24 | @Inject private EnrichmentMapManager emManager; 25 | @Inject private RankingOptionFactory rankingOptionFactory; 26 | 27 | @Override 28 | public TaskIterator createTaskIterator(View nodeView, CyNetworkView networkView) { 29 | CyNode node = nodeView.getModel(); 30 | CyNetwork network = networkView.getModel(); 31 | EnrichmentMap map = emManager.getEnrichmentMap(network.getSUID()); 32 | 33 | CyRow row = network.getRow(node); 34 | List genes = Columns.NODE_GENES.get(row, map.getParams().getAttributePrefix()); 35 | 36 | List rankOptions = rankingOptionFactory.getGSEADataSetSetRankOptions(map); 37 | 38 | GeneListTunable geneListTunable = new GeneListTunable(map, genes, null, rankOptions); 39 | return stringAppFactory.createTaskIterator(geneListTunable); 40 | } 41 | 42 | @Override 43 | public boolean isReady(View nodeView, CyNetworkView networkView) { 44 | return emManager.isEnrichmentMap(networkView); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/task/string/STRSpecies.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.task.string; 2 | 3 | import java.io.Serializable; 4 | 5 | public class STRSpecies implements Serializable { 6 | 7 | private static final long serialVersionUID = 8696720316867220538L; 8 | 9 | private long taxonomyId; 10 | private String scientificName; 11 | 12 | public STRSpecies() { 13 | } 14 | 15 | public long getTaxonomyId() { 16 | return taxonomyId; 17 | } 18 | 19 | public void setTaxonomyId(long taxonomyId) { 20 | this.taxonomyId = taxonomyId; 21 | } 22 | 23 | public String getScientificName() { 24 | return scientificName; 25 | } 26 | 27 | public void setScientificName(String scientificName) { 28 | this.scientificName = scientificName; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return scientificName; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/util/Baton.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.util; 2 | 3 | import java.util.function.Consumer; 4 | import java.util.function.Supplier; 5 | 6 | public class Baton { 7 | 8 | private T t; 9 | 10 | public Supplier supplier() { 11 | return new Supplier() { 12 | public T get() { 13 | return t; 14 | } 15 | }; 16 | } 17 | 18 | public Consumer consumer() { 19 | return new Consumer() { 20 | public void accept(T t) { 21 | Baton.this.t = t; 22 | } 23 | }; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/util/DelegatingTaskMonitor.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.util; 2 | 3 | import org.cytoscape.work.TaskMonitor; 4 | 5 | public class DelegatingTaskMonitor implements TaskMonitor { 6 | 7 | 8 | private final TaskMonitor delegate; 9 | 10 | public DelegatingTaskMonitor(TaskMonitor delegate) { 11 | this.delegate = delegate; 12 | } 13 | 14 | @Override 15 | public void setTitle(String title) { 16 | delegate.setTitle(title); 17 | } 18 | 19 | @Override 20 | public void setProgress(double progress) { 21 | delegate.setProgress(progress); 22 | } 23 | 24 | @Override 25 | public void setStatusMessage(String statusMessage) { 26 | delegate.setStatusMessage(statusMessage); 27 | } 28 | 29 | @Override 30 | public void showMessage(Level level, String message) { 31 | delegate.showMessage(level, message); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/util/LinearNumberInterpolator.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.util; 2 | 3 | /** 4 | * A simple linear interpolator from a domain to a range. 5 | * 6 | * 7 | * The following code is based on
8 | * org.cytoscape.view.vizmap.internal.mappings.interpolators. 9 | * LinearNumberInterpolator
10 | * and
11 | * org.cytoscape.view.vizmap.internal.mappings.interpolators. 12 | * LinearNumberToNumberInterpolator
13 | * 14 | */ 15 | public class LinearNumberInterpolator { 16 | 17 | private final double lowerDomain, lowerRange, upperDomain, upperRange; 18 | 19 | public LinearNumberInterpolator(double lowerDomain, double upperDomain, double lowerRange, double upperRange) { 20 | this.lowerDomain = lowerDomain; 21 | this.lowerRange = lowerRange; 22 | this.upperDomain = upperDomain; 23 | this.upperRange = upperRange; 24 | } 25 | 26 | public double getRangeValue(double domainValue) { 27 | if(lowerDomain == upperDomain) 28 | return lowerRange; 29 | 30 | double frac = (domainValue - lowerDomain) / (upperDomain - lowerDomain); 31 | return (frac * upperRange) + ((1.0 - frac) * lowerRange); 32 | } 33 | 34 | /** 35 | * Returns a new LinearNumberInterpolator with the following property: If a 36 | * domain value is below the lowerDomain parameter then return lowerValue, 37 | * if a domain value is above the upperDomain parameter then return 38 | * upperValue. 39 | */ 40 | public LinearNumberInterpolator withDomainCutoff(final double lowerValue, final double upperValue) { 41 | return new LinearNumberInterpolator(lowerDomain, upperDomain, lowerRange, upperRange) { 42 | @Override 43 | public double getRangeValue(double domainValue) { 44 | if(domainValue < lowerDomain) 45 | return lowerValue; 46 | if(domainValue > upperDomain) 47 | return upperValue; 48 | return super.getRangeValue(domainValue); 49 | } 50 | }; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/util/NamingUtil.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.util; 2 | 3 | import java.util.Set; 4 | import java.util.regex.Matcher; 5 | import java.util.regex.Pattern; 6 | 7 | public final class NamingUtil { 8 | 9 | private static final Pattern PATTERN = Pattern.compile(".*\\((\\d*)\\)$"); // capture just the digits 10 | 11 | public static String getUniqueName(final String suggestedName, final Set existingNames) { 12 | String name = suggestedName != null ? suggestedName.trim() : ""; 13 | 14 | if (name.isEmpty()) 15 | name = "UNDEFINED"; 16 | 17 | if (existingNames != null && !existingNames.isEmpty()) { 18 | if (!isNameTaken(name, existingNames)) 19 | return name; 20 | 21 | Matcher m = PATTERN.matcher(name); 22 | int start = 0; 23 | 24 | if (m.matches()) { 25 | name = name.substring(0, m.start(1) - 1); 26 | start = Integer.decode(m.group(1)); 27 | } 28 | 29 | for (int i = start; true; i++) { 30 | final String numberedName = name + "(" + (i + 1) + ")"; 31 | 32 | if (!isNameTaken(numberedName, existingNames)) 33 | return numberedName; 34 | } 35 | } 36 | 37 | return name; 38 | } 39 | 40 | private static boolean isNameTaken(final String name, final Set existingNames) { 41 | if (name != null && existingNames.contains(name)) 42 | return true; 43 | 44 | return false; 45 | } 46 | 47 | private NamingUtil() { 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/util/NullTaskMonitor.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.util; 2 | 3 | import org.cytoscape.work.TaskMonitor; 4 | 5 | public class NullTaskMonitor implements TaskMonitor { 6 | 7 | public static TaskMonitor check(TaskMonitor tm) { 8 | return tm == null ? new NullTaskMonitor() : tm; 9 | } 10 | 11 | @Override 12 | public void setTitle(String title) { 13 | } 14 | 15 | @Override 16 | public void setProgress(double progress) { 17 | } 18 | 19 | @Override 20 | public void setStatusMessage(String statusMessage) { 21 | } 22 | 23 | @Override 24 | public void showMessage(Level level, String message) { 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/util/PathUtil.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.util; 2 | 3 | import java.nio.file.Path; 4 | import java.nio.file.Paths; 5 | import java.util.Collection; 6 | import java.util.List; 7 | import java.util.stream.Collectors; 8 | 9 | import org.baderlab.csplugins.enrichmentmap.model.DataSetParameters; 10 | 11 | public class PathUtil { 12 | 13 | private PathUtil() {} 14 | 15 | public static List dataSetsRoots(Collection dataSets) { 16 | return dataSets.stream() 17 | .map(DataSetParameters::getFilePaths) 18 | .map(PathUtil::commonRoot) 19 | .collect(Collectors.toList()); 20 | } 21 | 22 | public static Path commonRoot(List paths) { 23 | if(paths == null || paths.isEmpty()) 24 | return null; 25 | if(paths.size() == 1) 26 | return paths.get(0); 27 | 28 | Path common = paths.get(0); 29 | for(Path path : paths.subList(1, paths.size())) { 30 | common = commonRoot(common, path); 31 | if(common == null) { 32 | return null; 33 | } 34 | } 35 | return common; 36 | } 37 | 38 | 39 | public static Path commonRoot(Path p1, Path p2) { 40 | if(p1 == null || p2 == null) 41 | return null; 42 | Path common; 43 | if(p1.isAbsolute() && p2.isAbsolute() && p1.getRoot().equals(p2.getRoot())) 44 | common = p1.getRoot(); 45 | else if(!p1.isAbsolute() && !p2.isAbsolute()) 46 | common = Paths.get(""); 47 | else 48 | return null; 49 | 50 | int n = Math.min(p1.getNameCount(), p2.getNameCount()); 51 | for(int i = 0; i < n; i++) { 52 | Path name1 = p1.getName(i); 53 | Path name2 = p2.getName(i); 54 | if(!name1.equals(name2)) 55 | break; 56 | common = common.resolve(name1); 57 | } 58 | return common; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/EMColumnPresentation.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view; 2 | 3 | import java.net.URL; 4 | 5 | import javax.swing.Icon; 6 | import javax.swing.ImageIcon; 7 | 8 | import org.cytoscape.application.swing.CyColumnPresentation; 9 | 10 | public class EMColumnPresentation implements CyColumnPresentation { 11 | 12 | private final Icon icon; 13 | 14 | public EMColumnPresentation() { 15 | URL logoURL = getClass().getClassLoader().getResource("images/enrichmentmap_logo_16.png"); 16 | icon = new ImageIcon(logoURL); 17 | } 18 | 19 | @Override 20 | public Icon getNamespaceIcon() { 21 | return icon; 22 | } 23 | 24 | @Override 25 | public String getNamespaceDescription() { 26 | return null; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/EnablementComboBoxRenderer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.util.HashSet; 6 | import java.util.Set; 7 | 8 | import javax.swing.JList; 9 | import javax.swing.plaf.basic.BasicComboBoxRenderer; 10 | 11 | /** 12 | * Allows items in a JCombo box to look disabled. 13 | */ 14 | @SuppressWarnings("serial") 15 | public class EnablementComboBoxRenderer extends BasicComboBoxRenderer { 16 | 17 | private final Set disabledItems = new HashSet<>(); 18 | 19 | @SafeVarargs 20 | public final void disableItems(T ... items) { 21 | for(T item : items) 22 | disabledItems.add(item); 23 | } 24 | 25 | @SafeVarargs 26 | public final void enableItems(T ... items) { 27 | for(T item : items) 28 | disabledItems.remove(item); 29 | } 30 | 31 | public void enableAll() { 32 | disabledItems.clear(); 33 | } 34 | 35 | @Override 36 | public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, 37 | int index, boolean isSelected, boolean cellHasFocus) { 38 | 39 | Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 40 | 41 | if(disabledItems.contains(value)) { 42 | component.setForeground(Color.LIGHT_GRAY); 43 | } 44 | else { 45 | component.setForeground(super.getForeground()); 46 | } 47 | 48 | return component; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/control/SortedListModel.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.control; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Comparator; 5 | import java.util.SortedSet; 6 | import java.util.TreeSet; 7 | 8 | import javax.swing.AbstractListModel; 9 | 10 | @SuppressWarnings("serial") 11 | public class SortedListModel extends AbstractListModel { 12 | 13 | private final SortedSet elements; 14 | 15 | public SortedListModel(Comparator comparator) { 16 | elements = new TreeSet<>(comparator); 17 | } 18 | 19 | public SortedListModel() { 20 | elements = new TreeSet<>(); 21 | } 22 | 23 | @Override 24 | public int getSize() { 25 | return elements.size(); 26 | } 27 | 28 | @Override 29 | @SuppressWarnings("unchecked") 30 | public E getElementAt(int index) { 31 | return (E)elements.toArray()[index]; 32 | } 33 | 34 | public void add(E e) { 35 | if(elements.add(e)) { 36 | fireContentsChanged(this, 0, elements.size()); 37 | } 38 | } 39 | 40 | public void remove(E e) { 41 | if(elements.remove(e)) { 42 | fireContentsChanged(this, 0, elements.size()); 43 | } 44 | } 45 | 46 | public void clear() { 47 | if(!elements.isEmpty()) { 48 | elements.clear(); 49 | fireContentsChanged(this, 0, elements.size()); 50 | } 51 | } 52 | 53 | public boolean contains(E e) { 54 | return elements.contains(e); 55 | } 56 | 57 | public int indexOf(E e) { 58 | return new ArrayList<>(elements).indexOf(e); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/CombinedConstantSlider.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation; 2 | 3 | import java.awt.BorderLayout; 4 | 5 | import javax.swing.JLabel; 6 | import javax.swing.JPanel; 7 | import javax.swing.JSlider; 8 | 9 | import org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil; 10 | 11 | @SuppressWarnings("serial") 12 | public class CombinedConstantSlider extends JPanel { 13 | 14 | private JSlider slider; 15 | private final int defaultValue; 16 | 17 | public CombinedConstantSlider(int defaultValue) { 18 | if(defaultValue < 0) 19 | defaultValue = 0; 20 | if(defaultValue > 100) 21 | defaultValue = 100; 22 | this.defaultValue = defaultValue; 23 | 24 | JLabel jaccardLabel = new JLabel(mkLabel("Jaccard", 100-defaultValue)); 25 | JLabel overlapLabel = new JLabel(mkLabel("Overlap", defaultValue)); 26 | JLabel plusLabel = new JLabel("+"); 27 | SwingUtil.makeSmall(jaccardLabel, overlapLabel, plusLabel); 28 | 29 | plusLabel.setHorizontalAlignment(JLabel.CENTER); 30 | 31 | slider = new JSlider(0, 100, defaultValue); 32 | slider.addChangeListener(e -> { 33 | int percent = slider.getValue(); 34 | jaccardLabel.setText(mkLabel("Jaccard", 100-percent)); 35 | overlapLabel.setText(mkLabel("Overlap", percent)); 36 | CombinedConstantSlider.this.revalidate(); 37 | }); 38 | 39 | setLayout(new BorderLayout()); 40 | add(jaccardLabel, BorderLayout.WEST); 41 | add(plusLabel, BorderLayout.CENTER); 42 | add(overlapLabel, BorderLayout.EAST); 43 | add(slider, BorderLayout.SOUTH); 44 | } 45 | 46 | public int getValue() { 47 | return slider.getValue(); 48 | } 49 | 50 | public void reset() { 51 | slider.setValue(defaultValue); 52 | } 53 | 54 | private static String mkLabel(String name, int percent) { 55 | return name + " (" + percent + "%)"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/CreationDialogShowAction.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.view.util.dialog.CardDialogShowAction; 4 | 5 | import com.google.inject.Singleton; 6 | 7 | @SuppressWarnings("serial") 8 | @Singleton 9 | public class CreationDialogShowAction extends CardDialogShowAction { 10 | 11 | public CreationDialogShowAction() { 12 | super(CreationDialogParameters.class, "New EnrichmentMap..."); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/DependencyChecker.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation; 2 | 3 | import org.cytoscape.command.AvailableCommands; 4 | import org.cytoscape.view.layout.CyLayoutAlgorithmManager; 5 | 6 | import com.google.inject.Inject; 7 | 8 | public class DependencyChecker { 9 | 10 | public static final String YFILES_APP_STORE_URL = "https://apps.cytoscape.org/apps/yfileslayoutalgorithms"; 11 | public static final String AUTOANNOTATE_APP_STORE_URL = "https://apps.cytoscape.org/apps/autoannotate"; 12 | 13 | @Inject private AvailableCommands availableCommands; 14 | @Inject private CyLayoutAlgorithmManager layoutManager; 15 | 16 | 17 | public boolean isYFilesInstalled() { 18 | return layoutManager.getAllLayouts().stream().anyMatch(layout -> layout.getName().startsWith("yfiles")); 19 | } 20 | 21 | public boolean isCommandAvailable(String namespace, String command) { 22 | boolean namespaceAvailable = availableCommands.getNamespaces().contains(namespace); 23 | if(namespaceAvailable) { 24 | return availableCommands.getCommands(namespace).contains(command); 25 | } 26 | return false; 27 | } 28 | 29 | 30 | // public boolean isAutoAnnotateOpenCommandAvailable() { 31 | // return isCommandAvailable("autoannotate", "open"); 32 | // } 33 | // 34 | // public boolean isAutoAnnotateRedrawCommandAvailable() { 35 | // return isCommandAvailable("autoannotate", "redraw"); 36 | // } 37 | // 38 | // public boolean isAutoAnnotateInitCommandAvailable() { 39 | // return isCommandAvailable("autoannotate", "eminit"); 40 | // } 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/DetailPanel.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation; 2 | 3 | import java.util.List; 4 | 5 | import javax.swing.JPanel; 6 | 7 | import org.baderlab.csplugins.enrichmentmap.model.DataSetParameters; 8 | import org.baderlab.csplugins.enrichmentmap.view.util.dialog.Message; 9 | 10 | public interface DetailPanel { 11 | 12 | JPanel getPanel(); 13 | 14 | String getDisplayName(); 15 | 16 | String getDataSetName(); 17 | 18 | String getIcon(); 19 | 20 | List validateInput(MasterDetailDialogPage parent); 21 | 22 | default DataSetParameters createDataSetParameters() { return null; }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/ResolverTaskTransferHandler.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation; 2 | 3 | import java.awt.datatransfer.DataFlavor; 4 | import java.awt.datatransfer.UnsupportedFlavorException; 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.util.List; 8 | import java.util.Objects; 9 | import java.util.function.Consumer; 10 | 11 | import javax.swing.TransferHandler; 12 | 13 | @SuppressWarnings("serial") 14 | public class ResolverTaskTransferHandler extends TransferHandler { 15 | 16 | private final Consumer> consumer; 17 | 18 | public ResolverTaskTransferHandler(Consumer> consumer) { 19 | this.consumer = Objects.requireNonNull(consumer); 20 | } 21 | 22 | @Override 23 | public boolean canImport(TransferSupport support) { 24 | if(!support.isDrop()) 25 | return false; 26 | if(!support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) 27 | return false; 28 | boolean copySupported = (COPY & support.getSourceDropActions()) == COPY; 29 | if(!copySupported) 30 | return false; 31 | return true; 32 | } 33 | 34 | @Override 35 | public boolean importData(TransferSupport support) { 36 | if(!canImport(support)) 37 | return false; 38 | 39 | Object transferData; 40 | try { 41 | transferData = support.getTransferable().getTransferData(DataFlavor.javaFileListFlavor); 42 | } catch (UnsupportedFlavorException | IOException e) { 43 | e.printStackTrace(); 44 | return false; 45 | } 46 | 47 | if(transferData instanceof List) { 48 | @SuppressWarnings("unchecked") 49 | List fileList = (List) transferData; 50 | consumer.accept(fileList); 51 | return true; 52 | } 53 | return false; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/SimilaritySlider.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation; 2 | 3 | import java.awt.BorderLayout; 4 | import java.util.Hashtable; 5 | import java.util.List; 6 | 7 | import javax.swing.JLabel; 8 | import javax.swing.JPanel; 9 | import javax.swing.JSlider; 10 | 11 | import org.apache.commons.lang3.tuple.Pair; 12 | import org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric; 13 | import org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil; 14 | 15 | @SuppressWarnings("serial") 16 | public class SimilaritySlider extends JPanel { 17 | 18 | private JSlider slider; 19 | private final int defaultTick; 20 | private final List> cutoffs; 21 | 22 | public SimilaritySlider(List> cutoffs, int defaultTick) { 23 | this.defaultTick = defaultTick; 24 | this.cutoffs = cutoffs; 25 | 26 | slider = new JSlider(1, cutoffs.size(), defaultTick); 27 | slider.setMajorTickSpacing(1); 28 | slider.setSnapToTicks(true); 29 | slider.setPaintTicks(true); 30 | 31 | JLabel sparseLabel = new JLabel("sparse"); 32 | JLabel denseLabel = new JLabel("dense"); 33 | SwingUtil.makeSmall(sparseLabel, denseLabel); 34 | 35 | Hashtable labelTable = new Hashtable<>(); 36 | labelTable.put(1, sparseLabel); 37 | labelTable.put(cutoffs.size(), denseLabel); 38 | 39 | slider.setLabelTable(labelTable); 40 | slider.setPaintLabels(true); 41 | 42 | setLayout(new BorderLayout()); 43 | add(slider, BorderLayout.SOUTH); 44 | } 45 | 46 | public void setTick(int tick) { 47 | slider.setValue(tick); 48 | } 49 | 50 | public Pair getTickValue() { 51 | return cutoffs.get(slider.getValue()-1); 52 | } 53 | 54 | public SimilarityMetric getSimilarityMetric() { 55 | return getTickValue().getKey(); 56 | } 57 | 58 | public double getCutoff() { 59 | return getTickValue().getValue(); 60 | } 61 | 62 | public void reset() { 63 | slider.setValue(defaultTick); 64 | } 65 | 66 | public JSlider getSlider() { 67 | return slider; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/genemania/GenemaniaAnnotation.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation.genemania; 2 | 3 | public class GenemaniaAnnotation { 4 | 5 | private String name; 6 | private String description; 7 | private double qValue; 8 | private int sample; 9 | private int total; 10 | 11 | public String getName() { 12 | return name; 13 | } 14 | 15 | public String getDescription() { 16 | return description; 17 | } 18 | 19 | public double getqValue() { 20 | return qValue; 21 | } 22 | 23 | public int getSample() { 24 | return sample; 25 | } 26 | 27 | public int getTotal() { 28 | return total; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | StringBuilder builder = new StringBuilder(); 34 | builder.append("GenemaniaAnnotation [name="); 35 | builder.append(name); 36 | builder.append(", description="); 37 | builder.append(description); 38 | builder.append(", qValue="); 39 | builder.append(qValue); 40 | builder.append(", sample="); 41 | builder.append(sample); 42 | builder.append(", total="); 43 | builder.append(total); 44 | builder.append("]"); 45 | return builder.toString(); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/genemania/GenemaniaDialogPage.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation.genemania; 2 | 3 | import javax.swing.JPanel; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.PropertyManager; 6 | import org.baderlab.csplugins.enrichmentmap.model.DataSetParameters; 7 | import org.baderlab.csplugins.enrichmentmap.model.GenemaniaParameters; 8 | import org.baderlab.csplugins.enrichmentmap.view.util.dialog.CardDialogCallback; 9 | import org.cytoscape.application.CyApplicationManager; 10 | import org.cytoscape.model.CyNetwork; 11 | 12 | import com.google.inject.Inject; 13 | 14 | public class GenemaniaDialogPage extends NetworkLoadDialogPage { 15 | 16 | @Inject private CyApplicationManager applicationManager; 17 | @Inject private PropertyManager propertyManager; 18 | 19 | private CyNetwork genemaniaNetwork; 20 | 21 | 22 | private String getOrganismName() { 23 | final String ORGANISM_COLUMN = propertyManager.getValue(PropertyManager.GENEMANIA_COLUMN_ORGANISM); 24 | return genemaniaNetwork.getRow(genemaniaNetwork).get(ORGANISM_COLUMN, String.class); 25 | } 26 | 27 | @Override 28 | public JPanel createBodyPanel(CardDialogCallback callback) { 29 | JPanel panel = super.createBodyPanel(callback); 30 | opened(); 31 | return panel; 32 | } 33 | 34 | @Override 35 | public void opened() { 36 | genemaniaNetwork = applicationManager.getCurrentNetwork(); 37 | networkNamePanel.setAutomaticName(getOrganismName()); 38 | } 39 | 40 | @Override 41 | public DataSetParameters getDataSetParameters() { 42 | String dataSetName = getOrganismName(); 43 | if(dataSetName == null) 44 | dataSetName = "Genemania"; 45 | 46 | GenemaniaParameters params = new GenemaniaParameters(genemaniaNetwork); 47 | return new DataSetParameters(dataSetName, params); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/genemania/GenemaniaDialogParameters.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation.genemania; 2 | 3 | import java.awt.Dimension; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | import javax.swing.AbstractButton; 8 | import javax.swing.JButton; 9 | 10 | import org.baderlab.csplugins.enrichmentmap.view.util.dialog.CardDialogPage; 11 | import org.baderlab.csplugins.enrichmentmap.view.util.dialog.CardDialogParameters; 12 | 13 | import com.google.inject.Inject; 14 | import com.google.inject.Provider; 15 | 16 | public class GenemaniaDialogParameters implements CardDialogParameters { 17 | 18 | public static final String ORGANISM_COLUMN_DEF ="organism"; 19 | public static final String ANNOTATIONS_COLUMN_DEF = "annotations"; 20 | public static final String GENE_NAME_COLUMN_DEF = "gene name"; 21 | public static final String ANNOTATION_NAME_COLUMN_DEF = "annotation name"; 22 | 23 | @Inject private Provider genemaniaDialogPage; 24 | 25 | @Override 26 | public String getTitle() { 27 | return "Create Enrichment Map from Genemania Network"; 28 | } 29 | 30 | @Override 31 | public List getPages() { 32 | return Arrays.asList(genemaniaDialogPage.get()); 33 | } 34 | 35 | @Override 36 | public Dimension getPreferredSize() { 37 | return new Dimension(820, 320); 38 | } 39 | 40 | @Override 41 | public Dimension getMinimumSize() { 42 | return new Dimension(650, 320); 43 | } 44 | 45 | @Override 46 | public AbstractButton[] getExtraButtons() { 47 | JButton resetButton = new JButton("Reset"); 48 | resetButton.setActionCommand("reset"); 49 | 50 | return new JButton[] { resetButton }; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/genemania/StringDialogParameters.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.creation.genemania; 2 | 3 | import java.awt.Dimension; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | import javax.swing.AbstractButton; 8 | import javax.swing.JButton; 9 | 10 | import org.baderlab.csplugins.enrichmentmap.view.util.dialog.CardDialogPage; 11 | import org.baderlab.csplugins.enrichmentmap.view.util.dialog.CardDialogParameters; 12 | 13 | import com.google.inject.Inject; 14 | import com.google.inject.Provider; 15 | 16 | public class StringDialogParameters implements CardDialogParameters { 17 | 18 | public static final String NAME_COLUMN_DEF = "term name"; 19 | public static final String FDR_COLUMN_DEF = "FDR value"; 20 | public static final String GENES_COLUMN_DEF = "genes"; 21 | public static final String DESC_COLUMN_DEF = "description"; 22 | public static final String SUID_COLUMN_DEF = "network.SUID"; 23 | 24 | @Inject private Provider stringDialogPage; 25 | 26 | @Override 27 | public String getTitle() { 28 | return "Create Enrichment Map from STRING Network"; 29 | } 30 | 31 | @Override 32 | public List getPages() { 33 | return Arrays.asList(stringDialogPage.get()); 34 | } 35 | 36 | @Override 37 | public Dimension getPreferredSize() { 38 | return new Dimension(820, 320); 39 | } 40 | 41 | @Override 42 | public Dimension getMinimumSize() { 43 | return new Dimension(650, 320); 44 | } 45 | 46 | @Override 47 | public AbstractButton[] getExtraButtons() { 48 | JButton resetButton = new JButton("Reset"); 49 | resetButton.setActionCommand("reset"); 50 | return new JButton[] { resetButton }; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/heatmap/RankingOption.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.heatmap; 2 | 3 | import java.util.Collection; 4 | import java.util.Optional; 5 | import java.util.concurrent.CompletableFuture; 6 | 7 | import org.baderlab.csplugins.enrichmentmap.model.EMDataSet; 8 | 9 | public interface RankingOption { 10 | 11 | /** Value to be displayed in the combo box */ 12 | String toString(); 13 | 14 | default String getName() { 15 | return toString(); 16 | } 17 | 18 | /** If the ranking comes directly from a DataSet, then get the ranking's name in the DataSet. */ 19 | Optional getNameInDataSet(); 20 | 21 | 22 | /** Text to be used in the JTable header. The given string will be passed to JLabel.setText(), so basic html is allowed. */ 23 | String getTableHeaderText(); 24 | 25 | 26 | /** Text to be used in the PDF export table header. The given string will be split on newlines. */ 27 | String getPdfHeaderText(); 28 | 29 | default EMDataSet getDataSet() { 30 | return null; 31 | } 32 | 33 | /** 34 | * Asynchronously compute the rankings. 35 | * @return Map where keys are geneIDs and value is the rank. 36 | */ 37 | CompletableFuture> computeRanking(Collection genes); 38 | 39 | 40 | public static RankingOption none() { 41 | return new RankingOption() { 42 | public String toString() { 43 | return "None"; 44 | } 45 | public CompletableFuture> computeRanking(Collection genes) { 46 | return CompletableFuture.completedFuture(Optional.empty()); 47 | } 48 | public Optional getNameInDataSet() { 49 | return Optional.empty(); 50 | } 51 | public String getTableHeaderText() { 52 | return toString(); 53 | } 54 | public String getPdfHeaderText() { 55 | return toString(); 56 | } 57 | }; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/heatmap/RankingResult.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.heatmap; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.Comparator; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import org.baderlab.csplugins.enrichmentmap.view.heatmap.table.RankValue; 10 | 11 | public class RankingResult { 12 | 13 | public enum SortSuggestion { 14 | ASC, DESC, NONE 15 | } 16 | 17 | private final Map ranking; 18 | private final boolean isGsea; // there might be significant genes (leading edge) 19 | 20 | private SortSuggestion sortSuggestion; 21 | 22 | 23 | public RankingResult(Map ranking, boolean isGsea) { 24 | this.ranking = ranking == null ? Collections.emptyMap() : ranking; 25 | this.isGsea = isGsea; 26 | } 27 | 28 | public static RankingResult empty() { 29 | return new RankingResult(Collections.emptyMap(), false); 30 | } 31 | 32 | public Map getRanking() { 33 | return ranking; 34 | } 35 | 36 | public SortSuggestion getSortSuggestion() { 37 | if(sortSuggestion == null) { 38 | sortSuggestion = computeSortSuggestion(); 39 | } 40 | return sortSuggestion; 41 | } 42 | 43 | 44 | private SortSuggestion computeSortSuggestion() { 45 | if(!isGsea) 46 | return SortSuggestion.NONE; 47 | if(ranking.isEmpty()) 48 | return SortSuggestion.NONE; 49 | 50 | List ranks = new ArrayList<>(ranking.values()); 51 | ranks.sort(Comparator.comparing(RankValue::getRank)); 52 | 53 | // If the leading edge is at the top 54 | if(ranks.get(0).isSignificant()) 55 | return SortSuggestion.ASC; 56 | 57 | // If the leading edgs is at the bottom 58 | if(ranks.get(ranks.size()-1).isSignificant()) 59 | return SortSuggestion.DESC; 60 | 61 | return SortSuggestion.NONE; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/heatmap/table/GradientLegendPanel.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.heatmap.table; 2 | 3 | import javax.swing.GroupLayout; 4 | import javax.swing.GroupLayout.Alignment; 5 | import javax.swing.GroupLayout.ParallelGroup; 6 | import javax.swing.GroupLayout.SequentialGroup; 7 | import javax.swing.JPanel; 8 | 9 | import org.baderlab.csplugins.org.mskcc.colorgradient.ColorGradientWidget; 10 | import org.cytoscape.util.swing.LookAndFeelUtil; 11 | 12 | @SuppressWarnings("serial") 13 | public class GradientLegendPanel extends JPanel { 14 | 15 | public static final int DEFAULT_HEIGHT = 25; 16 | private static final int BORDER_WIDTH = 1; 17 | 18 | 19 | public GradientLegendPanel(DataSetColorRange range) { 20 | GroupLayout layout = new GroupLayout(this); 21 | setLayout(layout); 22 | layout.setAutoCreateContainerGaps(false); 23 | layout.setAutoCreateGaps(false); 24 | 25 | ParallelGroup hGroup = layout.createParallelGroup(Alignment.CENTER, true); 26 | SequentialGroup vGroup = layout.createSequentialGroup(); 27 | layout.setHorizontalGroup(hGroup); 28 | layout.setVerticalGroup(vGroup); 29 | 30 | ColorGradientWidget legend = ColorGradientWidget.getInstance(null, range.getTheme(), 31 | range.getRange(), true, ColorGradientWidget.LEGEND_POSITION.NA); 32 | 33 | int h = DEFAULT_HEIGHT - 2 * BORDER_WIDTH; 34 | 35 | hGroup.addComponent(legend, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); 36 | vGroup.addComponent(legend, h, h, h); 37 | 38 | if (LookAndFeelUtil.isAquaLAF()) 39 | setOpaque(false); 40 | 41 | revalidate(); 42 | setOpaque(false); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/heatmap/table/RankOptionErrorHeader.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.heatmap.table; 2 | 3 | import org.baderlab.csplugins.enrichmentmap.view.heatmap.RankingOption; 4 | 5 | public class RankOptionErrorHeader { 6 | 7 | private final RankingOption rankingOption; 8 | 9 | public RankOptionErrorHeader(RankingOption rankOption) { 10 | this.rankingOption = rankOption; 11 | } 12 | 13 | public RankingOption getRankingOption() { 14 | return rankingOption; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/heatmap/table/RankValue.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.heatmap.table; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.model.Rank; 6 | 7 | /** 8 | * This is a wrapper object for a "rank" that is computed by a RankingOption. 9 | * We need this object to track which genes are significant (leading edge), 10 | * and to influence the sorting order in the JTable. 11 | */ 12 | public class RankValue { 13 | 14 | public static final RankValue EMPTY = new RankValue(null, null, false) { 15 | @Override public String toString() { 16 | return "RankValue[EMPTY]"; 17 | } 18 | }; 19 | 20 | private @Nullable Integer rank; 21 | private @Nullable Double score; 22 | private final boolean significant; 23 | 24 | public RankValue(@Nullable Integer rank, @Nullable Double score, boolean significant) { 25 | this.rank = rank; 26 | this.score = score; 27 | this.significant = significant; 28 | } 29 | 30 | public RankValue(Rank rank, boolean significant) { 31 | this.rank = rank.getRank(); 32 | this.score = rank.getScore(); 33 | this.significant = significant; 34 | } 35 | 36 | public @Nullable Integer getRank() { 37 | return rank; 38 | } 39 | 40 | public void setRank(Integer rank) { 41 | this.rank = rank; 42 | } 43 | 44 | public @Nullable Double getScore() { 45 | return score; 46 | } 47 | 48 | public boolean isSignificant() { 49 | return significant; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "RankValue[rank=" + rank + ", score=" + score + ", significant=" + significant + "]"; 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/heatmap/table/RankValueRenderer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.heatmap.table; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.text.DecimalFormat; 6 | 7 | import javax.swing.JTable; 8 | import javax.swing.table.DefaultTableCellRenderer; 9 | 10 | import org.baderlab.csplugins.enrichmentmap.view.heatmap.ExportTXTTask; 11 | 12 | @SuppressWarnings("serial") 13 | public class RankValueRenderer extends DefaultTableCellRenderer { 14 | 15 | public static final Color SIGNIFICANT_COLOR = Color.YELLOW; 16 | private final DecimalFormat format = new DecimalFormat("###.##"); 17 | 18 | @Override 19 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { 20 | super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); 21 | setBackground(table.getBackground()); 22 | setText(""); 23 | 24 | if(value instanceof RankValue) { 25 | RankValue rankValue = (RankValue) value; 26 | setText(ExportTXTTask.getRankText(format, rankValue)); 27 | 28 | if(rankValue.isSignificant()) { 29 | setBackground(SIGNIFICANT_COLOR); 30 | } 31 | } 32 | 33 | return this; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/heatmap/table/VerticalTextIcon.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.heatmap.table; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.awt.Font; 6 | import java.awt.FontMetrics; 7 | import java.awt.Graphics; 8 | import java.awt.Graphics2D; 9 | import java.awt.RenderingHints; 10 | 11 | import javax.swing.Icon; 12 | import javax.swing.UIManager; 13 | 14 | public class VerticalTextIcon implements Icon { 15 | 16 | private final int width; 17 | private final int height; 18 | private final boolean clockwise; 19 | private final Color color; 20 | private final Font font; 21 | private final String text; 22 | 23 | public VerticalTextIcon(FontMetrics fm, Color color, boolean clockwise, String text) { 24 | this.width = fm.getHeight() + 4; 25 | this.height = fm.stringWidth(text) + 4; 26 | this.clockwise = clockwise; 27 | this.color = color; 28 | this.font = fm.getFont(); 29 | this.text = text; 30 | } 31 | 32 | @Override 33 | public int getIconWidth() { 34 | return width; 35 | } 36 | 37 | @Override 38 | public int getIconHeight() { 39 | return height; 40 | } 41 | 42 | @Override 43 | public void paintIcon(Component c, Graphics g, int x, int y) { 44 | Graphics2D g2d = (Graphics2D) g.create(); 45 | g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); 46 | 47 | if(color == null) 48 | g2d.setColor(c != null ? c.getForeground() : UIManager.getColor("Label.foreground")); 49 | else 50 | g2d.setColor(color); 51 | 52 | g2d.setFont(font); 53 | 54 | if (clockwise) { 55 | g2d.rotate(Math.PI / 2); 56 | } else { 57 | g2d.rotate(-Math.PI / 2); 58 | g2d.translate(-c.getHeight(), c.getWidth()); 59 | } 60 | 61 | g2d.drawString(text, 4, -4); 62 | g2d.dispose(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/legend/LegendContent.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.legend; 2 | 3 | import java.awt.Paint; 4 | import java.util.Map; 5 | 6 | import javax.swing.Icon; 7 | 8 | import org.baderlab.csplugins.enrichmentmap.style.EMStyleOptions; 9 | import org.jfree.chart.JFreeChart; 10 | 11 | public interface LegendContent { 12 | 13 | public static final String NODE_COLOR_HEADER = "Node Fill Color"; 14 | public static final String NODE_CHART_HEADER = "Node Charts"; 15 | public static final String NODE_SHAPE_HEADER = "Node Shape"; 16 | public static final String NODE_CHART_COLOR_HEADER = "Node Chart Colors"; 17 | public static final String NODE_DATA_SET_COLOR_HEADER = "Data Set Color"; 18 | public static final String EDGE_COLOR_HEADER = "Edge Stroke Color"; 19 | 20 | public static final int LEGEND_ICON_SIZE = 18; 21 | 22 | 23 | JFreeChart getChart(); 24 | 25 | String getChartLabel(); 26 | 27 | Icon getGeneSetNodeShape(); 28 | 29 | Icon getSignatureNodeShape(); 30 | 31 | ColorLegendPanel getNodePosLegend(); 32 | 33 | ColorLegendPanel getNodeNegLegend(); 34 | 35 | String getNodeColorMappingColName(); 36 | 37 | ColorLegendPanel getChartPosLegend(); 38 | 39 | ColorLegendPanel getChartNegLegend(); 40 | 41 | Map getEdgeColors(); 42 | 43 | Map getDataSetColors(); 44 | 45 | EMStyleOptions getOptions(); 46 | } 47 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/postanalysis/SigGeneSetDescriptor.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.postanalysis; 2 | 3 | import java.util.Objects; 4 | 5 | import org.baderlab.csplugins.enrichmentmap.model.GeneSet; 6 | 7 | public class SigGeneSetDescriptor { 8 | 9 | private final GeneSet geneSet; 10 | private final int largestOverlap; 11 | private final double mostSimilar; 12 | private final boolean passes; 13 | 14 | private boolean wanted = true; 15 | 16 | public SigGeneSetDescriptor(GeneSet geneSet, int largestOverlap, double mostSimilar, boolean passes) { 17 | this.geneSet = Objects.requireNonNull(geneSet); 18 | this.largestOverlap = largestOverlap; 19 | this.mostSimilar = mostSimilar; 20 | this.passes = passes; 21 | } 22 | 23 | public boolean isWanted() { 24 | return wanted; 25 | } 26 | 27 | public void setWanted(boolean wanted) { 28 | this.wanted = wanted; 29 | } 30 | 31 | public String getName() { 32 | return geneSet.getName(); 33 | } 34 | 35 | public int getLargestOverlap() { 36 | return largestOverlap; 37 | } 38 | 39 | public int getGeneCount() { 40 | return geneSet.getGenes().size(); 41 | } 42 | 43 | public double getMostSimilar() { 44 | return mostSimilar; 45 | } 46 | 47 | public GeneSet getGeneSet() { 48 | return geneSet; 49 | } 50 | 51 | public boolean passes() { 52 | return passes; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/postanalysis/web/DateDir.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.postanalysis.web; 2 | 3 | public class DateDir { 4 | 5 | private String folder; 6 | private long timestamp; 7 | 8 | public DateDir(String folder, long timestamp) { 9 | this.folder = folder; 10 | this.timestamp = timestamp; 11 | } 12 | 13 | public String getFolder() { 14 | return folder; 15 | } 16 | 17 | public long getTimestamp() { 18 | return timestamp; 19 | } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/postanalysis/web/DialogParameters.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.postanalysis.web; 2 | 3 | import java.awt.Dimension; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | import org.baderlab.csplugins.enrichmentmap.view.postanalysis.PADialogPage; 8 | import org.baderlab.csplugins.enrichmentmap.view.util.dialog.CardDialogPage; 9 | import org.baderlab.csplugins.enrichmentmap.view.util.dialog.CardDialogParameters; 10 | 11 | public class DialogParameters implements CardDialogParameters { 12 | 13 | public static final String TITLE = "Signature Gene Sets"; 14 | 15 | private final PADialogPage parent; 16 | 17 | 18 | public DialogParameters(PADialogPage parent) { 19 | this.parent = parent; 20 | } 21 | 22 | 23 | @Override 24 | public String getTitle() { 25 | return TITLE; 26 | } 27 | 28 | @Override 29 | public List getPages() { 30 | return Arrays.asList( 31 | new BaderlabDialogPage(parent) 32 | ); 33 | } 34 | 35 | @Override 36 | public Dimension getPreferredSize() { 37 | return new Dimension(600, 500); 38 | } 39 | 40 | @Override 41 | public Dimension getMinimumSize() { 42 | return new Dimension(400, 400); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/postanalysis/web/DownloadGMTFileTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.postanalysis.web; 2 | 3 | import java.io.BufferedInputStream; 4 | import java.io.File; 5 | import java.io.FileOutputStream; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.io.OutputStream; 9 | import java.net.URL; 10 | import java.util.function.Consumer; 11 | 12 | import org.cytoscape.work.AbstractTask; 13 | import org.cytoscape.work.TaskMonitor; 14 | 15 | /** 16 | * The reason this is a Task and doesn't just use Files.copy(...) is because 17 | * I want the download to be cancellable. 18 | */ 19 | public class DownloadGMTFileTask extends AbstractTask { 20 | 21 | private final URL url; 22 | private final Consumer filePathConsumer; 23 | 24 | public DownloadGMTFileTask(URL url, Consumer filePathConsumer) { 25 | this.url = url; 26 | this.filePathConsumer = filePathConsumer; 27 | } 28 | 29 | @Override 30 | public void run(TaskMonitor tm) { 31 | tm.setTitle("Downloading GMT file"); 32 | 33 | try { 34 | File tempFile = File.createTempFile("baderlab-download-gmt", ".tmp"); 35 | tempFile.deleteOnExit(); 36 | download(tempFile); 37 | 38 | if(filePathConsumer != null) 39 | filePathConsumer.accept(tempFile.toString()); 40 | 41 | } catch(IOException e) { 42 | e.printStackTrace(); 43 | throw new RuntimeException("Error while downloading from " + url, e); 44 | } 45 | } 46 | 47 | 48 | private void download(File file) throws IOException { 49 | try ( 50 | InputStream in = new BufferedInputStream(url.openStream()); 51 | OutputStream out = new FileOutputStream(file) 52 | ) { 53 | byte[] bytes = new byte[1024]; 54 | int count; 55 | while((count = in.read(bytes)) != -1) { 56 | if(cancelled) { 57 | return; 58 | } 59 | out.write(bytes, 0, count); 60 | } 61 | } 62 | } 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/postanalysis/web/FileChooserPanel.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.postanalysis.web; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | import java.util.function.Consumer; 6 | 7 | import javax.swing.JPanel; 8 | 9 | public interface FileChooserPanel { 10 | 11 | JPanel getPanel(); 12 | 13 | void setFiles(List gmtFiles); 14 | 15 | Optional getSelectedFilePath(); 16 | 17 | void setSelectionListener(Consumer> listener); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/postanalysis/web/FileSizeRenderer.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.postanalysis.web; 2 | 3 | import javax.swing.table.DefaultTableCellRenderer; 4 | 5 | @SuppressWarnings("serial") 6 | public class FileSizeRenderer extends DefaultTableCellRenderer { 7 | 8 | @Override 9 | protected void setValue(Object value) { 10 | if(value instanceof Number) { 11 | int bytes = ((Number) value).intValue(); 12 | String text = humanReadableByteCount(bytes, true); 13 | super.setValue(text); 14 | } else { 15 | super.setValue(value); 16 | } 17 | } 18 | 19 | public static String humanReadableByteCount(long bytes, boolean si) { 20 | int unit = si ? 1000 : 1024; 21 | if (bytes < unit) 22 | return bytes + " B"; 23 | int exp = (int) (Math.log(bytes) / Math.log(unit)); 24 | String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i"); 25 | return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/postanalysis/web/GmtFile.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.postanalysis.web; 2 | 3 | import java.nio.file.Path; 4 | 5 | public class GmtFile { 6 | 7 | private final Path filePath; 8 | private final int size; 9 | 10 | public GmtFile(Path filePath, int size) { 11 | this.filePath = filePath; 12 | this.size = size; 13 | } 14 | 15 | public Path getPath() { 16 | return filePath; 17 | } 18 | 19 | public int getSize() { 20 | return size; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/CheckboxData.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util; 2 | 3 | import java.beans.PropertyChangeListener; 4 | import java.beans.PropertyChangeSupport; 5 | 6 | public class CheckboxData { 7 | 8 | private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); 9 | 10 | private boolean selected; 11 | 12 | private final String display; 13 | private final T data; 14 | 15 | public CheckboxData(String display, T data) { 16 | this(display, data, false); 17 | } 18 | 19 | public CheckboxData(String display, T data, boolean selected) { 20 | this.display = display; 21 | this.data = data; 22 | this.selected = selected; 23 | } 24 | 25 | public boolean isSelected() { 26 | return selected; 27 | } 28 | 29 | public void setSelected(boolean selected) { 30 | if(this.selected == selected) 31 | return; 32 | boolean oldValue = this.selected; 33 | this.selected = selected; 34 | pcs.firePropertyChange("selected", oldValue, selected); 35 | } 36 | 37 | public String getDisplay() { 38 | return display; 39 | } 40 | 41 | public T getData() { 42 | return data; 43 | } 44 | 45 | public void addPropertyChangeListener(String propName, PropertyChangeListener listener) { 46 | this.pcs.addPropertyChangeListener(propName, listener); 47 | } 48 | 49 | public void removePropertyChangeListener(String propName, PropertyChangeListener listener) { 50 | this.pcs.removePropertyChangeListener(propName, listener); 51 | } 52 | } -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/CheckboxListModel.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util; 2 | 3 | @SuppressWarnings("serial") 4 | public class CheckboxListModel extends IterableListModel> { 5 | 6 | public CheckboxListModel() { 7 | super(); 8 | } 9 | 10 | } -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/ComboItem.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util; 2 | 3 | public class ComboItem { 4 | 5 | private final V value; 6 | private final String label; 7 | 8 | public ComboItem(V value, String label) { 9 | this.value = value; 10 | this.label = label; 11 | } 12 | 13 | public ComboItem(V value) { 14 | this(value, String.valueOf(value)); 15 | } 16 | 17 | public V getValue() { 18 | return value; 19 | } 20 | 21 | public String getLabel() { 22 | return label; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return String.valueOf(label); 28 | } 29 | 30 | public static ComboItem of(V value) { 31 | return new ComboItem<>(value); 32 | } 33 | 34 | 35 | @Override 36 | public int hashCode() { 37 | final int prime = 31; 38 | int result = 1; 39 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 40 | return result; 41 | } 42 | 43 | @Override 44 | public boolean equals(Object obj) { 45 | if (this == obj) 46 | return true; 47 | if (obj == null) 48 | return false; 49 | if (getClass() != obj.getClass()) 50 | return false; 51 | ComboItem other = (ComboItem) obj; 52 | if (value == null) { 53 | if (other.value != null) 54 | return false; 55 | } else if (!value.equals(other.value)) 56 | return false; 57 | return true; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/GBCFactory.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util; 2 | 3 | import java.awt.GridBagConstraints; 4 | import java.awt.Insets; 5 | 6 | public class GBCFactory { 7 | 8 | private GridBagConstraints gbc = new GridBagConstraints(); 9 | 10 | private GBCFactory() { 11 | gbc.anchor = GridBagConstraints.WEST; 12 | gbc.fill = GridBagConstraints.HORIZONTAL; 13 | } 14 | 15 | public static GBCFactory grid(int x, int y) { 16 | GBCFactory factory = new GBCFactory(); 17 | factory.gbc.gridx = x; 18 | factory.gbc.gridy = y; 19 | return factory; 20 | } 21 | 22 | public GridBagConstraints get() { 23 | return gbc; 24 | } 25 | 26 | public GBCFactory weightx(double weightx) { 27 | gbc.weightx = weightx; 28 | return this; 29 | } 30 | 31 | public GBCFactory weighty(double weighty) { 32 | gbc.weighty = weighty; 33 | return this; 34 | } 35 | 36 | public GBCFactory gridwidth(int gridwidth) { 37 | gbc.gridwidth = gridwidth; 38 | return this; 39 | } 40 | 41 | public GBCFactory gridheight(int gridheight) { 42 | gbc.gridheight = gridheight; 43 | return this; 44 | } 45 | 46 | public GBCFactory anchor(int anchor) { 47 | gbc.anchor = anchor; 48 | return this; 49 | } 50 | 51 | public GBCFactory fill(int fill) { 52 | gbc.fill = fill; 53 | return this; 54 | } 55 | 56 | public GBCFactory insets(int top, int left, int bottom, int right) { 57 | gbc.insets = new Insets(top, left, bottom, right); 58 | return this; 59 | } 60 | 61 | public GBCFactory insets(int v) { 62 | return insets(v,v,v,v); 63 | } 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/IterableListModel.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.Iterator; 6 | import java.util.List; 7 | import java.util.stream.Stream; 8 | import java.util.stream.StreamSupport; 9 | 10 | import javax.swing.DefaultListModel; 11 | 12 | @SuppressWarnings("serial") 13 | public class IterableListModel extends DefaultListModel implements Iterable { 14 | 15 | public IterableListModel() { 16 | super(); 17 | } 18 | 19 | public void addElements(Collection elements) { 20 | elements.forEach(this::addElement); 21 | } 22 | 23 | public List toList() { 24 | int n = getSize(); 25 | List list = new ArrayList<>(n); 26 | for(int i = 0; i < n; i++) { 27 | list.add(get(i)); 28 | } 29 | return list; 30 | } 31 | 32 | public Stream stream() { 33 | return StreamSupport.stream(spliterator(), false); 34 | } 35 | 36 | public void update() { 37 | fireContentsChanged(this, 0, getSize()); 38 | } 39 | 40 | public Iterator iterator() { 41 | return new Iterator() { 42 | 43 | int i = 0; 44 | int n = getSize(); 45 | 46 | @Override 47 | public boolean hasNext() { 48 | return i < n; 49 | } 50 | 51 | @Override 52 | public T next() { 53 | return get(i++); 54 | } 55 | }; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/Labels.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util; 2 | 3 | public interface Labels { 4 | 5 | String ALL = "-- All --"; 6 | String NONE = "-- None --"; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/OpenPDFViewerTask.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util; 2 | 3 | import java.awt.Desktop; 4 | import java.io.File; 5 | import java.util.Objects; 6 | 7 | import org.cytoscape.work.AbstractTask; 8 | import org.cytoscape.work.TaskMonitor; 9 | 10 | public class OpenPDFViewerTask extends AbstractTask { 11 | 12 | private final File file; 13 | 14 | public OpenPDFViewerTask(File file) { 15 | this.file = Objects.requireNonNull(file); 16 | } 17 | 18 | @Override 19 | public void run(TaskMonitor tm) throws Exception { 20 | try { 21 | if(Desktop.isDesktopSupported()) { 22 | Desktop.getDesktop().open(file); 23 | } 24 | } catch(Exception e) { 25 | // ignore, just make best attempt to open the viewer 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/Range.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util; 2 | 3 | import java.util.List; 4 | 5 | public class Range { 6 | 7 | public final double min; 8 | public final double max; 9 | 10 | 11 | public Range(double min, double max) { 12 | assert min <= max; 13 | this.min = min; 14 | this.max = max; 15 | } 16 | 17 | 18 | public List toList() { 19 | return List.of(min, max); 20 | } 21 | 22 | public String getChartLabelMax() { 23 | return max > 0 ? String.format("%.2f", max) : "N/A"; 24 | } 25 | 26 | public String getChartLabelMin() { 27 | return min < 0 ? String.format("%.2f", min) : "N/A"; 28 | } 29 | 30 | 31 | @Override 32 | public String toString() { 33 | return "Range[min=" + min + ", max=" + max + "]"; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/dialog/CardDialogCallback.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util.dialog; 2 | 3 | import javax.swing.AbstractButton; 4 | import javax.swing.JDialog; 5 | 6 | import org.cytoscape.work.Task; 7 | import org.cytoscape.work.TaskObserver; 8 | 9 | public interface CardDialogCallback { 10 | 11 | void setFinishButtonEnabled(boolean enabled); 12 | 13 | AbstractButton getExtraButton(String actionCommand); 14 | 15 | CardDialog getDialog(); 16 | 17 | JDialog getDialogFrame(); 18 | 19 | void close(); 20 | 21 | Task getCloseTask(); 22 | 23 | TaskObserver getCloseTaskObserver(); 24 | } 25 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/dialog/CardDialogPage.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util.dialog; 2 | 3 | import javax.swing.AbstractButton; 4 | import javax.swing.JPanel; 5 | 6 | public interface CardDialogPage { 7 | 8 | String getID(); 9 | 10 | String getPageComboText(); 11 | 12 | JPanel createBodyPanel(CardDialogCallback callback); 13 | 14 | void finish(); 15 | 16 | /** 17 | * Lifecycle method called every time the page is made visible. 18 | */ 19 | default void opened() { }; 20 | 21 | /** 22 | * Called when one of the buttons returned by 23 | * {@link CardDialogParameters#getExtraButtons()} is clicked. 24 | * 25 | * @see AbstractButton#setActionCommand(String) 26 | */ 27 | default void extraButtonClicked(String actionCommand) { } 28 | } 29 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/dialog/CardDialogParameters.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util.dialog; 2 | 3 | import java.awt.Dimension; 4 | import java.util.List; 5 | 6 | import javax.swing.AbstractButton; 7 | import javax.swing.Icon; 8 | 9 | public interface CardDialogParameters { 10 | 11 | String getTitle(); 12 | 13 | List getPages(); 14 | 15 | default Icon getIcon() { 16 | return null; 17 | } 18 | 19 | default String getFinishButtonText() { 20 | return "Finish"; 21 | } 22 | 23 | default String getPageChooserLabelText() { 24 | return null; 25 | } 26 | 27 | default Dimension getPreferredSize() { 28 | return new Dimension(400, 300); 29 | } 30 | 31 | default Dimension getMinimumSize() { 32 | return null; 33 | } 34 | 35 | /** 36 | * Return a list of extra buttons, that will go in the bottom left area of the button bar. 37 | * An ActionListener will be attached to each button that will call 38 | * CardDialogPage.extraButtonClicked(button.getActionCommand()) when the button is clicked. 39 | * 40 | * @see AbstractButton#setActionCommand(String) 41 | */ 42 | default AbstractButton[] getExtraButtons() { 43 | return null; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/dialog/CardDialogShowAction.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util.dialog; 2 | 3 | import java.awt.event.ActionEvent; 4 | 5 | import javax.swing.JFrame; 6 | 7 | import org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil; 8 | import org.cytoscape.application.swing.AbstractCyAction; 9 | 10 | import com.google.inject.Inject; 11 | import com.google.inject.Injector; 12 | import com.google.inject.Provider; 13 | import com.google.inject.assistedinject.Assisted; 14 | 15 | @SuppressWarnings("serial") 16 | public class CardDialogShowAction extends AbstractCyAction { 17 | 18 | @Inject private Provider jframeProvider; 19 | @Inject private Injector injector; 20 | 21 | private final Class dialogParamsClass; 22 | 23 | private CardDialog dialog; 24 | 25 | 26 | public static interface Factory { 27 | CardDialogShowAction create(Class dialogParamsClass, String title); 28 | } 29 | 30 | @Inject 31 | public CardDialogShowAction(@Assisted Class dialogParamsClass, @Assisted String title) { 32 | super(title); 33 | this.dialogParamsClass = dialogParamsClass; 34 | } 35 | 36 | public void showDialog() { 37 | if (dialog == null) { 38 | CardDialogParameters dialogParams = injector.getInstance(dialogParamsClass); 39 | dialog = new CardDialog(jframeProvider.get(), dialogParams); 40 | } 41 | dialog.open(); 42 | } 43 | 44 | @Override 45 | public void actionPerformed(ActionEvent e) { 46 | showDialog(); 47 | } 48 | 49 | 50 | public void dispose() { 51 | if(dialog != null) { 52 | SwingUtil.invokeOnEDTAndWait(() -> { 53 | dialog.dispose(); 54 | }); 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/dialog/Message.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.view.util.dialog; 2 | 3 | import java.util.Objects; 4 | 5 | public class Message { 6 | 7 | public static enum MessageType { 8 | WARN, ERROR 9 | } 10 | 11 | private final MessageType type; 12 | private final String message; 13 | 14 | 15 | public Message(MessageType type, String message) { 16 | this.type = Objects.requireNonNull(type); 17 | this.message = Objects.requireNonNull(message); 18 | } 19 | 20 | public static Message warn(String message) { 21 | return new Message(MessageType.WARN, message); 22 | } 23 | 24 | public static Message error(String message) { 25 | return new Message(MessageType.ERROR, message); 26 | } 27 | 28 | public MessageType getType() { 29 | return type; 30 | } 31 | 32 | public String getMessage() { 33 | return message; 34 | } 35 | 36 | public boolean isError() { 37 | return type == MessageType.ERROR; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/fonts/enrichmentmap.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/main/resources/fonts/enrichmentmap.ttf -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/images/enrichmentmap_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/main/resources/images/enrichmentmap_logo.png -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/images/enrichmentmap_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/images/enrichmentmap_logo_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/main/resources/images/enrichmentmap_logo_16.png -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/images/folder_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/main/resources/images/folder_button.png -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/images/radialheatmap-chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/main/resources/images/radialheatmap-chart.png -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/images/spinner_16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/main/resources/images/spinner_16.gif -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/images/spinner_24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/main/resources/images/spinner_24.gif -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/org/baderlab/csplugins/enrichmentmap/app.props: -------------------------------------------------------------------------------- 1 | appName=${project.name} 2 | appVersion=${project.version} 3 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/main/resources/org/baderlab/csplugins/enrichmentmap/revision.props: -------------------------------------------------------------------------------- 1 | git.branch=${git.branch} 2 | git.commit.id.describe=${git.commit.id.describe} 3 | git.build.user.name=${git.build.user.name} 4 | git.build.user.email=${git.build.user.email} 5 | git.build.time=${git.build.time} 6 | git.commit.id=${git.commit.id} 7 | git.commit.id.abbrev=${git.commit.id.abbrev} 8 | build.user=${user.name} 9 | build.timestamp=${timestamp} 10 | build.os=${os.name} 11 | build.java_version=${java.version} 12 | build.number=${buildNumber} 13 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/support/java/org/baderlab/csplugins/mannwhit/MannWhitneyMemoized.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.mannwhit; 2 | 3 | import java.util.Arrays; 4 | import java.util.Map; 5 | import java.util.concurrent.ConcurrentHashMap; 6 | 7 | 8 | /** 9 | * A wrapper for MannWhitneyUTestSided that avoids recomputing results for arguments 10 | * that have already been computed. 11 | * @author mkucera 12 | */ 13 | public class MannWhitneyMemoized { 14 | 15 | private MannWhitneyUTestSided delegate = new MannWhitneyUTestSided(); 16 | private Map cache = new ConcurrentHashMap<>(); 17 | 18 | 19 | public MannWhitneyTestResult mannWhitneyUTestBatch(final double[] x, final double[] y) { 20 | return cache.computeIfAbsent(new CacheKey(x,y), k -> delegate.mannWhitneyUTestBatch(k.x, k.y)); 21 | } 22 | 23 | /** 24 | * The main reason for using a separate object for the key is that double[] 25 | * needs to use Arrays.hashCode() and Arrays.equal() to work properly. 26 | */ 27 | private static class CacheKey { 28 | final double[] x; 29 | final double[] y; 30 | 31 | public CacheKey(double[] x, double[] y) { 32 | this.x = x; 33 | this.y = y; 34 | } 35 | 36 | @Override 37 | public int hashCode() { 38 | final int prime = 31; 39 | int result = 1; 40 | result = prime * result + Arrays.hashCode(x); 41 | result = prime * result + Arrays.hashCode(y); 42 | return result; 43 | } 44 | 45 | @Override 46 | public boolean equals(Object obj) { 47 | if (this == obj) 48 | return true; 49 | if (obj == null) 50 | return false; 51 | CacheKey other = (CacheKey) obj; 52 | if (!Arrays.equals(x, other.x)) 53 | return false; 54 | if (!Arrays.equals(y, other.y)) 55 | return false; 56 | return true; 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/support/java/org/baderlab/csplugins/mannwhit/MannWhitneyTestResult.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.mannwhit; 2 | 3 | public class MannWhitneyTestResult { 4 | 5 | public final double twoSided; 6 | public final double greater; 7 | public final double less; 8 | 9 | public MannWhitneyTestResult(double twoSided, double greater, double less) { 10 | this.twoSided = twoSided; 11 | this.greater = greater; 12 | this.less = less; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/java/org/baderlab/csplugins/enrichmentmap/LogSilenceRule.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap; 2 | 3 | import org.junit.rules.ExternalResource; 4 | import org.ops4j.pax.logging.internal.DefaultServiceLog; 5 | 6 | /** 7 | * This rule will silence the cytoscape console logger when running a JUnit test. 8 | */ 9 | public class LogSilenceRule extends ExternalResource { 10 | 11 | private int logLevelBackup; 12 | 13 | @Override 14 | protected void before() { 15 | silenceLog(); 16 | } 17 | 18 | @Override 19 | protected void after() { 20 | restoreLog(); 21 | } 22 | 23 | 24 | private void silenceLog() { 25 | logLevelBackup = DefaultServiceLog.level; 26 | DefaultServiceLog.level = DefaultServiceLog.LEVEL_ERROR; 27 | } 28 | 29 | private void restoreLog() { 30 | DefaultServiceLog.level = logLevelBackup; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/java/org/baderlab/csplugins/enrichmentmap/MannWhitneyRankSumTest.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import java.io.InputStream; 6 | import java.util.Scanner; 7 | 8 | import org.apache.commons.math3.stat.inference.MannWhitneyUTest; 9 | import org.apache.commons.math3.stat.ranking.NaNStrategy; 10 | import org.apache.commons.math3.stat.ranking.TiesStrategy; 11 | import org.junit.Test; 12 | 13 | /** 14 | * Test cases for Mann Whitney U 15 | */ 16 | public class MannWhitneyRankSumTest { 17 | double[] x, y; 18 | double expected_pVal, pValue; 19 | 20 | 21 | @Test 22 | public void testMannWhitneyPvalue() throws Exception { 23 | String testDataFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/MannWhitneyTest_pvalues.csv"; 24 | InputStream reader = new StreamUtil().getInputStream(testDataFileName); 25 | 26 | try(Scanner scanner = new Scanner(reader,"UTF-8")) { 27 | String fullText = scanner.useDelimiter("\\A").next(); 28 | String[] lines = fullText.split("\n"); 29 | String[] tokens, x_s, y_s; 30 | int i, j, k; 31 | 32 | for (i=1; i < lines.length ; i++ ) { 33 | // Split 34 | tokens = lines[i].split(","); 35 | 36 | // Parse x contents 37 | x_s = tokens[0].split("\\s"); 38 | x = new double[x_s.length]; 39 | for (j = 0; j < x_s.length; j++) 40 | x[j] = Double.parseDouble(x_s[j]); 41 | 42 | // Parse y contents 43 | y_s = tokens[1].split("\\s"); 44 | y = new double[y_s.length]; 45 | for (k = 0; k < y_s.length; k++) 46 | y[k] = Double.parseDouble(y_s[k]); 47 | 48 | // Procure expected pval 49 | expected_pVal = Double.parseDouble(tokens[2]); 50 | 51 | MannWhitneyUTest test = new MannWhitneyUTest(NaNStrategy.FAILED, TiesStrategy.AVERAGE); 52 | pValue = test.mannWhitneyUTest(x, y); 53 | 54 | assertEquals(expected_pVal, pValue, 0.0); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/java/org/baderlab/csplugins/enrichmentmap/StreamUtil.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap; 2 | 3 | import java.io.FileInputStream; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | import java.net.URL; 8 | import java.net.URLConnection; 9 | 10 | public class StreamUtil implements org.cytoscape.io.util.StreamUtil { 11 | 12 | public StreamUtil(){ 13 | 14 | } 15 | 16 | public InputStream getInputStream(String filename) throws FileNotFoundException{ 17 | return new FileInputStream(filename); 18 | } 19 | 20 | public InputStream getInputStream(URL url) throws IOException { 21 | 22 | return new FileInputStream(url.toString()); 23 | } 24 | 25 | public URLConnection getURLConnection(URL arg0) throws IOException { 26 | 27 | return null; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/java/org/baderlab/csplugins/enrichmentmap/model/EnrichmentResultTest.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.model; 2 | 3 | 4 | import static org.junit.Assert.assertEquals; 5 | 6 | import org.junit.Test; 7 | 8 | /* 9 | * An enrichment Result is the Parent class for different types of enrichment results - GSEA or generic results 10 | * An enrichment result (whether it is generic or gsea) needs to minimally have a name, description, pvalue and source 11 | * (source can be none) 12 | */ 13 | //TODO:Need to fork generic result and create additional types BingoResult, DavidResult 14 | 15 | public class EnrichmentResultTest { 16 | 17 | //create empty enrichment results 18 | @Test 19 | public void testCreateEmptyEnrichmentResult(){ 20 | 21 | String name = "APOPTOSIS INDUCED DNA FRAGMENTATION%REACTOME%REACT_1213.4"; 22 | String description = "Apoptosis induced DNA fragmentation"; 23 | double pvalue = (0.01); 24 | 25 | //create a new GeneSet 26 | EnrichmentResult results = new EnrichmentResult(name, description, pvalue, 0); 27 | 28 | assertEquals("APOPTOSIS INDUCED DNA FRAGMENTATION%REACTOME%REACT_1213.4", results.getName()); 29 | assertEquals("Apoptosis induced DNA fragmentation", results.getDescription()); 30 | 31 | assertEquals(0.01, results.getPvalue(), 0.0); 32 | assertEquals("REACTOME", results.getSource().get()); 33 | assertEquals("APOPTOSIS INDUCED DNA FRAGMENTATION%REACTOME%REACT_1213.4\t0.01\n", results.toString()); 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/java/org/baderlab/csplugins/enrichmentmap/util/LinearNumberInterpolatorTest.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.util; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import org.junit.Test; 6 | 7 | public class LinearNumberInterpolatorTest { 8 | 9 | private static void assertDouble(double expected, double actual) { 10 | final double epsilon = 0.001; 11 | assertTrue("expected: " + expected + " actual: " + actual, Math.abs(expected-actual) < epsilon); 12 | } 13 | 14 | @Test 15 | public void testLinearNumberInterpolator() { 16 | LinearNumberInterpolator interpolator = new LinearNumberInterpolator(0.5, 1.0, 0.0, 5.0); 17 | 18 | assertDouble(0.0, interpolator.getRangeValue(0.5)); 19 | assertDouble(1.0, interpolator.getRangeValue(0.6)); 20 | assertDouble(2.0, interpolator.getRangeValue(0.7)); 21 | assertDouble(3.0, interpolator.getRangeValue(0.8)); 22 | assertDouble(4.0, interpolator.getRangeValue(0.9)); 23 | assertDouble(5.0, interpolator.getRangeValue(1.0)); 24 | 25 | // numbers out of range 26 | assertDouble(-1.0, interpolator.getRangeValue(0.4)); 27 | assertDouble(6.0, interpolator.getRangeValue(1.1)); 28 | } 29 | 30 | @Test 31 | public void testLinearNumberInterpolatorWithCutoff() { 32 | LinearNumberInterpolator interpolator = new LinearNumberInterpolator(0.5, 1.0, 0.0, 5.0).withDomainCutoff(-99, 99); 33 | 34 | assertDouble(0.0, interpolator.getRangeValue(0.5)); 35 | assertDouble(1.0, interpolator.getRangeValue(0.6)); 36 | assertDouble(2.0, interpolator.getRangeValue(0.7)); 37 | assertDouble(3.0, interpolator.getRangeValue(0.8)); 38 | assertDouble(4.0, interpolator.getRangeValue(0.9)); 39 | assertDouble(5.0, interpolator.getRangeValue(1.0)); 40 | 41 | // numbers out of range 42 | assertDouble(-99, interpolator.getRangeValue(0.4)); 43 | assertDouble(99, interpolator.getRangeValue(1.1)); 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/java/org/baderlab/csplugins/enrichmentmap/util/NamingUtilTest.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.util; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.Set; 6 | 7 | import org.junit.Test; 8 | import org.mockito.internal.util.collections.Sets; 9 | 10 | public class NamingUtilTest { 11 | 12 | @Test 13 | public void testGetUniqueName() { 14 | Set names = Sets.newSet( 15 | "My Name A", 16 | "My Name B", 17 | "My Name B(1)", 18 | "My Name B(3)", 19 | "My Name C(1)", 20 | "My Name D_1", 21 | "My Name E (1)" 22 | ); 23 | 24 | assertEquals("My Name", NamingUtil.getUniqueName("My Name", names)); 25 | assertEquals("My Name", NamingUtil.getUniqueName(" My Name \t", names)); // Always trim! 26 | assertEquals("My Name a", NamingUtil.getUniqueName("My Name a", names)); // Case sensitive! 27 | assertEquals("My Name A(1)", NamingUtil.getUniqueName("My Name A", names)); 28 | assertEquals("My Name A(1)", NamingUtil.getUniqueName("My Name A(1)", names)); 29 | assertEquals("My Name A(01)", NamingUtil.getUniqueName("My Name A(01)", names)); 30 | assertEquals("My Name A_1", NamingUtil.getUniqueName("My Name A_1", names)); 31 | assertEquals("My Name B(2)", NamingUtil.getUniqueName("My Name B", names)); 32 | assertEquals("My Name B(4)", NamingUtil.getUniqueName("My Name B(3)", names)); 33 | assertEquals("My Name B(2)", NamingUtil.getUniqueName("My Name B(2)", names)); 34 | assertEquals("My Name C(2)", NamingUtil.getUniqueName("My Name C(1)", names)); 35 | assertEquals("My Name D", NamingUtil.getUniqueName("My Name D", names)); 36 | assertEquals("My Name D(1)", NamingUtil.getUniqueName("My Name D(1)", names)); 37 | assertEquals("My Name E (2)", NamingUtil.getUniqueName("My Name E (1)", names)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/java/org/baderlab/csplugins/enrichmentmap/util/PathUtilTest.java: -------------------------------------------------------------------------------- 1 | package org.baderlab.csplugins.enrichmentmap.util; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertNull; 5 | 6 | import java.nio.file.Path; 7 | import java.nio.file.Paths; 8 | import java.util.Arrays; 9 | import java.util.List; 10 | import java.util.stream.Collectors; 11 | 12 | import org.junit.Test; 13 | 14 | public class PathUtilTest { 15 | 16 | @Test 17 | public void testPathUtil() { 18 | { 19 | Path c = PathUtil.commonRoot(plist("/a/b/c", "/a/b/d")); 20 | assertEquals(Paths.get("/a/b"), c); 21 | } 22 | { 23 | Path c = PathUtil.commonRoot(plist("/a/b/c/d/e", "/a/b/c/x/y", "/a/b/q/w")); 24 | assertEquals(Paths.get("/a/b"), c); 25 | } 26 | { 27 | Path c = PathUtil.commonRoot(plist("/x/y/z", "/a/b/d")); 28 | assertEquals(Paths.get("/"), c); 29 | } 30 | { 31 | Path c = PathUtil.commonRoot(plist("/", "/a/b/d")); 32 | assertEquals(Paths.get("/"), c); 33 | } 34 | { 35 | Path c = PathUtil.commonRoot(plist("/x/y/z", "a/b/d")); 36 | assertNull(c); 37 | } 38 | { 39 | Path c = PathUtil.commonRoot(plist("/x/y/z", null)); 40 | assertNull(c); 41 | } 42 | } 43 | 44 | 45 | private static List plist(String ... ps) { 46 | return Arrays.stream(ps) 47 | .map(p -> p == null ? null : Paths.get(p)) 48 | .collect(Collectors.toList()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/ExpressionTestFile.rnk: -------------------------------------------------------------------------------- 1 | Name Score 2 | GLS 0.5418719 3 | PSMA1 0.50985223 4 | RAB7 0.50615764 5 | zp1 0.48029557 6 | ZYX 0.47536945 7 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/ExpressionTestFile_edbrnk.rnk: -------------------------------------------------------------------------------- 1 | GLS 0.5418719 2 | PSMA1 0.50985223 3 | RAB7 0.50615764 4 | zp1 0.48029557 5 | ZYX 0.47536945 6 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/Genesetstestfile.gmt: -------------------------------------------------------------------------------- 1 | Reactome_(1,6)-alpha-glucose residues are removed, as D-glucose, from limit dextrin by debranching enzyme Reactome GYG 2 | Reactome_Oxidative decarboxylation of alpha-ketoglutarate to succinyl CoA by alpha-ketoglutarate dehydrogenase Reactome DLST DLD OGDH 3 | NCI_FOXA transcription factor networks NCI FOXA1 FOXA3 FOXA2 4 | NCI_FOXA1 transcription factor network NCI GCG AR NKX3-1 SOD1 NFIC SCGB1A1 NR2F2 APOB CDKN1B AP1B1 ATP5J FOXA2 NCOA3 JUN TFF1 XBP1 COL18A1 SFTPA1 SP1 NRIP1 EP300 NFIA SFTPD SHH DSCAM PISD FOS FOXA3 NDUFV3 POU2F1 NFIB C4BP-PS1 FOXA1 INS2 CEBPB BRCA1 ESR1 CREBBP VTN 5 | MSigDB_1_2_DICHLOROETHANE_DEGRADATION ALDH1A1 ALDH1A2 ALDH1A3 ALDH1B1 ALDH2 ALDH3A1 ALDH3A2 ALDH9A1 6 | growth hormone receptor activity GO:0004903 GHR 7 | interferon receptor activity GO:0004904 IFNAR1 IFNAR2 8 | type I interferon receptor activity GO:0004905 IFNAR2 9 | INOH_[Negative regulation of (G alpha s GDP-GTP exchange signaling) INOH RGS9 RGS17 RGS1 RGS20 RGS3 RGS6 RGS4 RGS19 RGS8 RGS10 RGS13 RGS5 RGS14 RGS2 RGS11 RGS18 RGS16 RGS7 GNAQ 10 | Test-Geneset with mixed cases TEST zp1 C19orf2 11 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/Human_GO_AllPathways_with_GO_iea_symbol.gmt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/Human_GO_AllPathways_with_GO_iea_symbol.gmt -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/Mouse_GO_AllPathways_with_GO_iea_symbol.gmt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/Mouse_GO_AllPathways_with_GO_iea_symbol.gmt -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/generic_enr_5col.txt: -------------------------------------------------------------------------------- 1 | GO.ID Description p.Val FDR Phenotype 2 | GO:0000346 export complex 0.01 0.02 +1 3 | GO:0030904 retromer complex 0.05 0.10 +1 4 | GO:0008623 chromatin complex 0.05 0.12 -1 5 | GO:0046540 tri-snRNP complex 5.60E-42 0.03 -1 6 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/EMandPA/PA_top8_middle8_bottom8.gmt: -------------------------------------------------------------------------------- 1 | PA_top8_middle8_bottom8 PA_top8_middle8_bottom8 ST3GAL2 ST6GALNAC2 ST3GAL1 ST6GALNAC4 B3GNT5 MUC2 ST6GAL1 GALNT16 GALNT11 GALNT14 GALNT1 MUC21 GALNT2 MUC3A GALNT3 GCNT1 MUCL1 ST3GAL4 GALNT9 B3GNT8 B4GALT5 GCNT3 GALNT6 GCNT4 2 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/EMandPA/fakeEnrichments.txt: -------------------------------------------------------------------------------- 1 | Name Description pvalue fdr 2 | Top8_plus100 Top8_plus100 0.005 0.1 3 | Bottom8_plus100 Bottom8_plus100 0.005 0.1 4 | Middle8_plus100 Middle8_plus100 0.005 0.1 5 | top1_plus100 top1_plus100 0.005 0.1 6 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/EMandPA/gene_sets.gmt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/EMandPA/gene_sets.gmt -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/8w_r9c_vs_wt_SN.cls: -------------------------------------------------------------------------------- 1 | 57 2 1 2 | # R9C_8W WT_8W 3 | R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W 4 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/GSEA_enrichments1.xls: -------------------------------------------------------------------------------- 1 | NAME GS
follow link to MSigDB GS DETAILS SIZE ES NES NOM p-val FDR q-val FWER p-val RANK AT MAX LEADING EDGE 2 | PROTEASOME ACCESSORY COMPLEX%GO%GO:0022624 PROTEASOME ACCESSORY COMPLEX%GO%GO:0022624 Details ... 4 0.7929275 1.493028 0.03198653 0.11452584 0.098 9 tags=75%, list=22%, signal=87% 3 | APOPTOTIC PROCESS%GO%GO:0006915 APOPTOTIC PROCESS%GO%GO:0006915 Details ... 2 0.93566453 1.404455 0.022222223 0.13220647 0.215 1 tags=50%, list=2%, signal=49% 4 | PROTEASOME ASSEMBLY%GO%GO:0043248 PROTEASOME ASSEMBLY%GO%GO:0043248 Details ... 1 0.975 1.2917296 0.045544554 0.2530127 0.502 1 tags=100%, list=2%, signal=100% 5 | PROTEASOME REGULATORY PARTICLE ASSEMBLY%GO%GO:0070682 PROTEASOME REGULATORY PARTICLE ASSEMBLY%GO%GO:0070682 Details ... 1 0.975 1.2816151 0.051975053 0.2079088 0.532 1 tags=100%, list=2%, signal=100% 6 | PROTEASOME BINDING%GO%GO:0070628 PROTEASOME BINDING%GO%GO:0070628 Details ... 1 0.95 1.2517521 0.108510636 0.22193098 0.644 2 tags=100%, list=5%, signal=103% 7 | PROTEASOME REGULATORY PARTICLE%GO%GO:0005838 PROTEASOME REGULATORY PARTICLE%GO%GO:0005838 Details ... 2 0.7948718 1.1982365 0.20142603 0.25609624 0.764 9 tags=100%, list=22%, signal=122% 8 | PROTEASOME ACTIVATOR COMPLEX%GO%GO:0008537 PROTEASOME ACTIVATOR COMPLEX%GO%GO:0008537 Details ... 2 0.78517073 1.1793299 0.22710623 0.24466094 0.804 6 tags=50%, list=15%, signal=56% 9 | DATASETGENES DATASETGENES Details ... 41 1.0 0.9999999 1.0 0.62209535 1.0 40 tags=100%, list=98%, signal=0% 10 | NUCLEAR PROTEASOME COMPLEX%GO%GO:0031595 NUCLEAR PROTEASOME COMPLEX%GO%GO:0031595 Details ... 1 0.675 0.87398034 0.7016129 0.738571 1.0 13 tags=100%, list=32%, signal=143% 11 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/GSEA_enrichments2.xls: -------------------------------------------------------------------------------- 1 | NAME GS
follow link to MSigDB GS DETAILS SIZE ES NES NOM p-val FDR q-val FWER p-val RANK AT MAX LEADING EDGE 2 | PROTEASOME CORE COMPLEX%GO%GO:0005839 PROTEASOME CORE COMPLEX%GO%GO:0005839 Details ... 17 -0.42373782 -1.2992607 0.136 0.6149967 0.508 7 tags=29%, list=17%, signal=21% 3 | REGULATION OF ACTIVATED PAK-2P34 BY PROTEASOME MEDIATED DEGRADATION%REACTOME%REACT_78677.6 REGULATION OF ACTIVATED PAK-2P34 BY PROTEASOME MEDIATED DEGRADATION%REACTOME%REACT_78677.6 Details ... 40 -0.76430213 -1.0385982 0.39426523 1.0 0.934 36 tags=88%, list=88%, signal=18% 4 | PROTEASOME COMPLEX%GO%GO:0000502 PROTEASOME COMPLEX%GO%GO:0000502 Details ... 39 -0.47074077 -0.96956056 0.45454547 0.8649745 0.965 26 tags=64%, list=63%, signal=9% 5 | REGULATION OF APOPTOTIC PROCESS%GO%GO:0042981 REGULATION OF APOPTOTIC PROCESS%GO%GO:0042981 Details ... 1 -0.625 -0.83103424 0.72064775 0.8962528 0.993 17 tags=100%, list=41%, signal=167% 6 | "PROTEASOME CORE COMPLEX, ALPHA-SUBUNIT COMPLEX%GO%GO:0019773" "PROTEASOME CORE COMPLEX, ALPHA-SUBUNIT COMPLEX%GO%GO:0019773" Details ... 7 -0.25985488 -0.6223495 0.9250646 0.96540487 1.0 7 tags=29%, list=17%, signal=29% 7 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/GSEA_example_results/edb/8w_r9c_vs_wt_SN.cls: -------------------------------------------------------------------------------- 1 | 57 2 1 2 | # R9C_8W WT_8W 3 | R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W R9C_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W WT_8W 4 | 5 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/GSEA_example_results/edb/Expressiontestfile.rnk: -------------------------------------------------------------------------------- 1 | PSMD13 0.26562637 2 | PSMD9 0.26073438 3 | PSMD14 0.17928325 4 | PSMD11 0.16896632 5 | PSMB8 0.16619763 6 | PSMB9 0.16447026 7 | PSME1 0.16160278 8 | PSMA7 0.16085777 9 | PSMA2 0.15374435 10 | PSMD8 0.14913896 11 | PSMA1 0.1486926 12 | PSMD12 0.1381393 13 | PSMD7 0.13795282 14 | PSMC5 0.13443784 15 | PSMC2 0.105930366 16 | PSMD5 0.096631646 17 | PSMB2 0.094400354 18 | PSMB3 0.0656073 19 | PSMB1 0.064722374 20 | PSMA3 0.052508228 21 | PSMB7 0.030110395 22 | PSMD2 0.02621734 23 | PSMF1 0.00633944 24 | PSMA6 -0.0028696498 25 | PSMD3 -0.0039766696 26 | PSME3 -0.010495073 27 | PSMB10 -0.011140813 28 | PSMD6 -0.03716836 29 | PSMC4 -0.038085744 30 | PSMA5 -0.03848367 31 | PSMC6 -0.04115016 32 | PSMC3 -0.04977913 33 | PSME4 -0.069023214 34 | PSMC1 -0.09295433 35 | PSMD1 -0.10747342 36 | PSMA4 -0.10782626 37 | PSMB6 -0.12434042 38 | PSMA8 -0.13681504 39 | PSMB4 -0.16421746 40 | PSMD4 -0.27478796 41 | PSMB5 -0.3374272 42 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/LoadDataset/GSEA_example_results/edb/gene_sets.gmt: -------------------------------------------------------------------------------- 1 | PROTEASOME CORE COMPLEX%GO%GO:0005839 proteasome core complex PSMA5 PSMA7 PSMA8 PSMB8 PSMB9 PSMB10 PSMB3 PSMB2 PSMB1 PSMA1 PSMB7 PSMA4 PSMA3 PSMB6 PSMB5 PSMA6 PSMB4 2 | REGULATION OF ACTIVATED PAK-2P34 BY PROTEASOME MEDIATED DEGRADATION%REACTOME%REACT_78677.6 Regulation of activated PAK-2p34 by proteasome mediated degradation PSMC6 PSMC2 PSMC5 PSMC4 PSMC1 PSMC3 PSMD2 PSMD3 PSMD4 PSMD5 PSMD6 PSMD7 PSMD8 PSMB10 PSMD13 PSMD14 PSMD11 PSMD12 PSMB8 PSMA3 PSMA6 PSMA4 PSMA2 PSMA1 PSME3 PSME4 PSMD1 PSMD9 PSME1 PSMA5 PSMB1 PSMB2 PSMB7 PSMA7 PSMB3 PSMA8 PSMF1 PSMB5 PSMB6 PSMB4 3 | PROTEASOME COMPLEX%GO%GO:0000502 proteasome complex PSMC1 PSMC4 PSMC3 PSMD13 PSMC6 PSMC5 PSMC2 PSMD14 PSMB10 PSMB9 PSMD12 PSMD11 PSMA7 PSMB2 PSMB1 PSMB3 PSMA8 PSMD1 PSMD8 PSMA5 PSMD2 PSMB8 PSMD7 PSMD6 PSMD4 PSMD3 PSMB4 PSME4 PSME3 PSMB6 PSMB7 PSMF1 PSMB5 PSMA3 PSMA4 PSME1 PSMA6 PSMA2 PSMA1 4 | REGULATION OF APOPTOTIC PROCESS%GO%GO:0042981 regulation of apoptotic process PSME3 5 | "PROTEASOME CORE COMPLEX, ALPHA-SUBUNIT COMPLEX%GO%GO:0019773" "proteasome core complex, alpha-subunit complex" PSMA3 PSMA4 PSMA5 PSMA6 PSMA7 PSMA1 PSMA8 6 | NUCLEAR PROTEASOME COMPLEX%GO%GO:0031595 nuclear proteasome complex PSMC5 7 | DATASETGENES DatasetGenes PSMA1 PSMA2 PSMA3 PSMA4 PSMA5 PSMA6 PSMA7 PSMA8 PSMB1 PSMB10 PSMB2 PSMB3 PSMB4 PSMB5 PSMB6 PSMB7 PSMB8 PSMB9 PSMC1 PSMC2 PSMC3 PSMC4 PSMC5 PSMC6 PSMD1 PSMD11 PSMD12 PSMD13 PSMD14 PSMD2 PSMD3 PSMD4 PSMD5 PSMD6 PSMD7 PSMD8 PSMD9 PSME1 PSME3 PSME4 PSMF1 8 | PROTEASOME ACTIVATOR COMPLEX%GO%GO:0008537 proteasome activator complex PSME1 PSME3 9 | PROTEASOME REGULATORY PARTICLE%GO%GO:0005838 proteasome regulatory particle PSMD8 PSMD13 10 | PROTEASOME BINDING%GO%GO:0070628 proteasome binding PSMD14 11 | PROTEASOME REGULATORY PARTICLE ASSEMBLY%GO%GO:0070682 proteasome regulatory particle assembly PSMD9 12 | PROTEASOME ASSEMBLY%GO%GO:0043248 proteasome assembly PSMD9 13 | APOPTOTIC PROCESS%GO%GO:0006915 apoptotic process PSMD9 PSME3 14 | PROTEASOME ACCESSORY COMPLEX%GO%GO:0022624 proteasome accessory complex PSMD13 PSME3 PSME1 PSMD8 15 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/gprofiler/Supplementary_Table4_gprofiler_results.txt: -------------------------------------------------------------------------------- 1 | GO.ID Description p.Val FDR Phenotype Genes 2 | REAC:5655302 Signaling by FGFR1 in disease 7.29e-04 7.29e-04 1 PIK3CA,KRAS,PIK3R1,NRAS -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/gprofiler/Supplementary_Table5_hsapiens.pathways.NAME.gmt: -------------------------------------------------------------------------------- 1 | REAC:5655302 Signaling by FGFR1 in disease LRRFIP1 FGF9 HRAS GAB1 PIK3CA SOS1 STAT5B NRAS FGF6 FGFR1 STAT5A FGF2 KRAS FGFR1OP2 FGF8 FGF17 FGF4 CUX1 FRS2 FGF23 FGF1 ZMYM2 PIK3R1 MYO18A STAT1 GAB2 TRIM24 GRB2 CNTRL PLCG1 BAG4 CPSF6 FGF5 FGF20 ERLIN2 FGFR1OP BCR STAT3 2 | -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/tutorial/ES_NT.cls: -------------------------------------------------------------------------------- 1 | 18 6 1 # ES12 NT12 ES24 NT24 ES48 NT48 ES12 ES12 ES12 NT12 NT12 NT12 ES24 ES24 ES24 NT24 NT24 NT24 ES48 ES48 ES48 NT48 NT48 NT48 -------------------------------------------------------------------------------- /EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/tutorial/Human_GO_AllPathways_no_GO_iea_April_15_2013_symbol.gmt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BaderLab/EnrichmentMapApp/bac424dd749d090fb4462906540ae948f3a18a5b/EnrichmentMapPlugin/src/test/resources/org/baderlab/csplugins/enrichmentmap/task/tutorial/Human_GO_AllPathways_no_GO_iea_April_15_2013_symbol.gmt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | EnrichmentMapApp 2 | ================ 3 | 4 | EnrichmentMap Cytoscape App 5 | 6 | 7 | https://apps.cytoscape.org/apps/enrichmentmap 8 | 9 | https://enrichmentmap.readthedocs.io/en/latest/ 10 | --------------------------------------------------------------------------------