use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class ColorRenderer method getTableCellRendererComponent.
public JLabel getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
JLabel label = new JLabel();
//MUST do this for background to show up.
label.setOpaque(true);
HeatMapTableModel model = (HeatMapTableModel) table.getModel();
EMDataSet dataset = model.getDataSet(col);
Transform transform = model.getTransform();
DataSetColorRange range = getRange(dataset, transform);
if (value instanceof Double) {
Color color = getColor(range.getTheme(), range.getRange(), (Double) value);
label.setBackground(color);
Border border = BorderFactory.createMatteBorder(1, 1, 1, 1, isSelected ? table.getSelectionForeground() : color);
label.setBorder(border);
if (Double.isFinite((Double) value))
label.setToolTipText(value.toString());
}
return label;
}
use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class MannWhitneyRanksDialog method createDataSetPanel.
private JPanel createDataSetPanel() {
JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(LookAndFeelUtil.createTitledBorder("Select ranks to use for each data set."));
int y = 0;
List<EMDataSet> dataSets = getDataSets();
for (EMDataSet dataset : dataSets) {
final String dataSetName = dataset.getName();
JLabel label = new JLabel(dataSetName + ":");
JComboBox<String> combo = new JComboBox<>();
for (String ranksName : dataset.getExpressionSets().getAllRanksNames()) {
combo.addItem(ranksName);
}
SwingUtil.makeSmall(label, combo);
if (combo.getItemCount() <= 1) {
combo.setEnabled(false);
}
combo.addActionListener(e -> {
String ranks = combo.getSelectedItem().toString();
results.put(dataSetName, ranks);
});
results.put(dataSetName, combo.getSelectedItem().toString());
panel.add(label, GBCFactory.grid(0, y).weightx(.5).anchor(EAST).fill(NONE).get());
panel.add(combo, GBCFactory.grid(1, y).weightx(.5).get());
y++;
}
return panel;
}
use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class HeatMapTableModel method getColumnName.
@Override
public String getColumnName(int col) {
if (col == GENE_COL)
return "Gene";
if (col == DESC_COL)
return "Description";
if (col == RANK_COL)
return ranksColName;
EMDataSet dataset = getDataSet(col);
if (transform.isCompress()) {
return dataset.getName();
} else {
int index = getIndexInDataSet(col) + 2;
String[] columns = dataset.getExpressionSets().getColumnNames();
return columns[index];
}
}
use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class LegendPanel method updateNodeColorPanel.
private void updateNodeColorPanel(Collection<EMDataSet> dataSets, EnrichmentMap map) {
JPanel p = getNodeColorPanel();
p.removeAll();
if (dataSets != null && dataSets.size() == 1) {
EMDataSet ds = dataSets.iterator().next();
ColorLegendPanel clp = new ColorLegendPanel(Colors.MAX_PHENOTYPE_1, Colors.MAX_PHENOTYPE_2, ds.getEnrichments().getPhenotype1(), ds.getEnrichments().getPhenotype2());
GroupLayout layout = (GroupLayout) p.getLayout();
layout.setHorizontalGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(clp, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(clp));
p.setVisible(true);
} else {
p.setVisible(false);
}
}
use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class LoadGMTFileOnlyTest method testGMTOnly.
@Test
public void testGMTOnly() throws Exception {
//for a dataset we require genesets, an expression file (optional), enrichment results
String testGmtFileName = "src/test/resources/org/baderlab/csplugins/enrichmentmap/task/genesets_subset.gmt";
DataSetFiles files = new DataSetFiles();
files.setGMTFileName(testGmtFileName);
//create an new enrichment Map
double similarityCutoff = 0.5;
double pvalue = 1.0;
double qvalue = 1.0;
EMCreationParameters params = new EMCreationParameters("EM1_", pvalue, qvalue, NESFilter.ALL, Optional.empty(), SimilarityMetric.JACCARD, similarityCutoff, 0.5);
EnrichmentMap em = new EnrichmentMap(params, serviceRegistrar);
//Load data set
//create a dataset
EMDataSet dataset = em.createDataSet(LegacySupport.DATASET1, Method.GSEA, files);
//create a DatasetTask
//set up task
GMTFileReaderTask task = new GMTFileReaderTask(dataset);
task.run(taskMonitor);
dataset.setGeneSetsOfInterest(dataset.getSetOfGeneSets());
//create dummy expression
CreateDummyExpressionTask dummyExpressionTask = new CreateDummyExpressionTask(dataset);
dummyExpressionTask.run(taskMonitor);
em.filterGenesets();
InitializeGenesetsOfInterestTask genesets_init = new InitializeGenesetsOfInterestTask(em);
genesets_init.run(taskMonitor);
Baton<Map<SimilarityKey, GenesetSimilarity>> baton = new Baton<>();
ComputeSimilarityTaskParallel similarities = new ComputeSimilarityTaskParallel(em, baton.consumer());
similarities.run(taskMonitor);
//check to see if the dataset loaded - there should be 36 genesets
assertEquals(36, dataset.getSetOfGeneSets().getGeneSets().size());
//there should be (36 * 35)/2 edges (geneset similarities)
assertEquals(18, baton.supplier().get().size());
//there should be 523 genes
assertEquals(523, em.getNumberOfGenes());
assertEquals(523, dataset.getExpressionSets().getNumGenes());
assertEquals(523, dataset.getDataSetGenes().size());
assertEquals(3, dataset.getExpressionSets().getNumConditions());
}
Aggregations