use of org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterParameters in project EnrichmentMapApp by BaderLab.
the class CreateDiseaseSignatureNetworkTask method passesCutoff.
/**
* Why not put this in CreateDiseaseSignatureTaskParallel... don't even create the GenesetSimilarity object if it fails!!!
* @param similarityKey
* @return
*/
private boolean passesCutoff(SimilarityKey similarityKey, EMSignatureDataSet sigDataSet) {
GenesetSimilarity similarity = geneSetSimilarities.get(similarityKey);
PostAnalysisFilterParameters filterParams = params.getRankTestParameters();
switch(filterParams.getType()) {
case HYPERGEOM:
return similarity.getHypergeomPValue() <= filterParams.getValue();
case MANN_WHIT_TWO_SIDED:
return !similarity.isMannWhitMissingRanks() && similarity.getMannWhitPValueTwoSided() <= filterParams.getValue();
case MANN_WHIT_GREATER:
return !similarity.isMannWhitMissingRanks() && similarity.getMannWhitPValueGreater() <= filterParams.getValue();
case MANN_WHIT_LESS:
return !similarity.isMannWhitMissingRanks() && similarity.getMannWhitPValueLess() <= filterParams.getValue();
case NUMBER:
return similarity.getSizeOfOverlap() >= filterParams.getValue();
case PERCENT:
EMDataSet dataSet = map.getDataSet(similarityKey.getName());
String enrGeneSetName = similarity.getGeneset2Name();
GeneSet enrGeneset = dataSet.getGeneSetsOfInterest().getGeneSetByName(enrGeneSetName);
int enrGenesetSize = enrGeneset.getGenes().size();
double relative_per = (double) similarity.getSizeOfOverlap() / (double) enrGenesetSize;
return relative_per >= filterParams.getValue() / 100.0;
case SPECIFIC:
String hubName = similarity.getGeneset1Name();
GeneSet sigGeneSet = sigDataSet.getGeneSetsOfInterest().getGeneSetByName(hubName);
int sigGeneSetSize = sigGeneSet.getGenes().size();
double relativePer2 = (double) similarity.getSizeOfOverlap() / (double) sigGeneSetSize;
return relativePer2 >= filterParams.getValue() / 100.0;
default:
return false;
}
}
use of org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterParameters in project EnrichmentMapApp by BaderLab.
the class PostAnalysisTaskTest method test_2_PostAnalysisMannWhitney.
/**
* Run post-analysis with the default mann-whitney test.
* Uses the network that was created by the previous test method.
*/
@Test
public void test_2_PostAnalysisMannWhitney(@Continuous VisualMappingFunctionFactory cmFactory) throws Exception {
mockContinuousMappingFactory(cmFactory);
PostAnalysisParameters.Builder builder = new PostAnalysisParameters.Builder();
builder.setAnalysisType(AnalysisType.KNOWN_SIGNATURE);
builder.setUniverseType(UniverseType.USER_DEFINED);
builder.setUserDefinedUniverseSize(11445);
builder.setSignatureGMTFileName(PATH + "PA_top8_middle8_bottom8.gmt");
builder.setAttributePrefix("EM1_");
builder.addDataSetToRankFile(LegacySupport.DATASET1, LegacySupport.DATASET1);
PostAnalysisFilterParameters rankTest = new PostAnalysisFilterParameters(PostAnalysisFilterType.MANN_WHIT_TWO_SIDED);
builder.setRankTestParameters(rankTest);
runPostAnalysis(emNetwork, builder, LegacySupport.DATASET1);
// Assert that post-analysis created the new nodes correctly
Map<String, CyNode> nodes = TestUtils.getNodes(emNetwork);
assertEquals(5, nodes.size());
assertTrue(nodes.containsKey("PA_TOP8_MIDDLE8_BOTTOM8"));
EdgeSimilarities edges = TestUtils.getEdgeSimilarities(emNetwork);
assertEquals(8, edges.size());
CyEdge edge1 = edges.getEdge("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) TOP8_PLUS100");
assertNotNull(edge1);
assertEquals(1.40E-6, emNetwork.getRow(edge1).get("EM1_Overlap_Mann_Whit_pVal", Double.class), 0.001);
assertEquals(PostAnalysisFilterType.MANN_WHIT_TWO_SIDED.toString(), emNetwork.getRow(edge1).get("EM1_Overlap_cutoff", String.class));
CyEdge edge2 = edges.getEdge("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) BOTTOM8_PLUS100");
assertNotNull(edge2);
assertEquals(1.40E-6, emNetwork.getRow(edge2).get("EM1_Overlap_Mann_Whit_pVal", Double.class), 0.001);
assertEquals(PostAnalysisFilterType.MANN_WHIT_TWO_SIDED.toString(), emNetwork.getRow(edge2).get("EM1_Overlap_cutoff", String.class));
}
use of org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterParameters in project EnrichmentMapApp by BaderLab.
the class PostAnalysisCutoffTest method test_1_FilterType_Number.
@Test
public void test_1_FilterType_Number(@Continuous VisualMappingFunctionFactory cmFactory) throws Exception {
mockContinuousMappingFactory(cmFactory);
PostAnalysisParameters.Builder builder = getBuilder();
PostAnalysisFilterParameters rankTest = new PostAnalysisFilterParameters(PostAnalysisFilterType.NUMBER, 5);
builder.setRankTestParameters(rankTest);
runPostAnalysis(emNetwork, builder, LegacySupport.DATASET1);
Map<String, CyEdge> edges = TestUtils.getEdges(emNetwork);
assertEquals(9, edges.size());
CyEdge edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) MIDDLE8_PLUS100");
assertNotNull(edge);
assertEquals(8, emNetwork.getRow(edge).get("EM1_k_intersection", Integer.class).intValue());
assertEquals(PostAnalysisFilterType.NUMBER.toString(), emNetwork.getRow(edge).get("EM1_Overlap_cutoff", String.class));
edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) BOTTOM8_PLUS100");
assertNotNull(edge);
assertEquals(8, emNetwork.getRow(edge).get("EM1_k_intersection", Integer.class).intValue());
assertEquals(PostAnalysisFilterType.NUMBER.toString(), emNetwork.getRow(edge).get("EM1_Overlap_cutoff", String.class));
edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) TOP8_PLUS100");
assertNotNull(edge);
assertEquals(8, emNetwork.getRow(edge).get("EM1_k_intersection", Integer.class).intValue());
assertEquals(PostAnalysisFilterType.NUMBER.toString(), emNetwork.getRow(edge).get("EM1_Overlap_cutoff", String.class));
edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) TOP1_PLUS100");
assertNull(edge);
}
use of org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterParameters in project EnrichmentMapApp by BaderLab.
the class PostAnalysisCutoffTest method test_2_FilterType_Percent.
@Test
public void test_2_FilterType_Percent(@Continuous VisualMappingFunctionFactory cmFactory) throws Exception {
mockContinuousMappingFactory(cmFactory);
PostAnalysisParameters.Builder builder = getBuilder();
PostAnalysisFilterParameters rankTest = new PostAnalysisFilterParameters(PostAnalysisFilterType.PERCENT, 7);
builder.setRankTestParameters(rankTest);
runPostAnalysis(emNetwork, builder, LegacySupport.DATASET1);
assertEquals(12, emNetwork.getEdgeCount());
Map<String, CyEdge> edges = TestUtils.getSignatureEdges(emNetwork, "EM1_", "PA_top8_middle8_bottom8(1)");
assertEquals(3, edges.size());
CyEdge edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) MIDDLE8_PLUS100");
assertNotNull(edge);
assertEquals(8, emNetwork.getRow(edge).get("EM1_k_intersection", Integer.class).intValue());
assertEquals(PostAnalysisFilterType.PERCENT.toString(), emNetwork.getRow(edge).get("EM1_Overlap_cutoff", String.class));
edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) BOTTOM8_PLUS100");
assertNotNull(edge);
assertEquals(8, emNetwork.getRow(edge).get("EM1_k_intersection", Integer.class).intValue());
assertEquals(PostAnalysisFilterType.PERCENT.toString(), emNetwork.getRow(edge).get("EM1_Overlap_cutoff", String.class));
edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) TOP8_PLUS100");
assertNotNull(edge);
assertEquals(8, emNetwork.getRow(edge).get("EM1_k_intersection", Integer.class).intValue());
assertEquals(PostAnalysisFilterType.PERCENT.toString(), emNetwork.getRow(edge).get("EM1_Overlap_cutoff", String.class));
edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) TOP1_PLUS100");
assertNull(edge);
}
use of org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterParameters in project EnrichmentMapApp by BaderLab.
the class PostAnalysisCutoffTest method test_3_FilterType_Specific.
@Test
public void test_3_FilterType_Specific(@Continuous VisualMappingFunctionFactory cmFactory) throws Exception {
mockContinuousMappingFactory(cmFactory);
PostAnalysisParameters.Builder builder = getBuilder();
PostAnalysisFilterParameters rankTest = new PostAnalysisFilterParameters(PostAnalysisFilterType.SPECIFIC, 25);
builder.setRankTestParameters(rankTest);
runPostAnalysis(emNetwork, builder, LegacySupport.DATASET1);
assertEquals(15, emNetwork.getEdgeCount());
Map<String, CyEdge> edges = TestUtils.getSignatureEdges(emNetwork, "EM1_", "PA_top8_middle8_bottom8(2)");
assertEquals(3, edges.size());
CyEdge edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) MIDDLE8_PLUS100");
assertNotNull(edge);
assertEquals(8, emNetwork.getRow(edge).get("EM1_k_intersection", Integer.class).intValue());
assertEquals(PostAnalysisFilterType.SPECIFIC.toString(), emNetwork.getRow(edge).get("EM1_Overlap_cutoff", String.class));
edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) BOTTOM8_PLUS100");
assertNotNull(edge);
assertEquals(8, emNetwork.getRow(edge).get("EM1_k_intersection", Integer.class).intValue());
assertEquals(PostAnalysisFilterType.SPECIFIC.toString(), emNetwork.getRow(edge).get("EM1_Overlap_cutoff", String.class));
edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) TOP8_PLUS100");
assertNotNull(edge);
assertEquals(8, emNetwork.getRow(edge).get("EM1_k_intersection", Integer.class).intValue());
assertEquals(PostAnalysisFilterType.SPECIFIC.toString(), emNetwork.getRow(edge).get("EM1_Overlap_cutoff", String.class));
edge = edges.get("PA_TOP8_MIDDLE8_BOTTOM8 (sig_Dataset 1) TOP1_PLUS100");
assertNull(edge);
}
Aggregations