use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class HeatMapTableModel method getPhenotype.
public Optional<String> getPhenotype(int col) {
if (transform.isCompress())
return Optional.empty();
EMDataSet dataset = getDataSet(col);
int index = getIndexInDataSet(col);
String[] classes = dataset.getExpressionSets().getPhenotypes();
if (classes != null && index < classes.length) {
return Optional.ofNullable(classes[index]);
}
return Optional.empty();
}
use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class HeatMapTableModel method getValueAt.
@Override
public Object getValueAt(int row, int col) {
if (row < 0)
// Why is it passing -1?
return null;
if (col == RANK_COL)
return getRankValue(row);
String gene = genes.get(row);
if (col == GENE_COL)
return gene;
int geneID = map.getHashFromGene(gene);
if (col == DESC_COL)
return getDescription(geneID);
EMDataSet dataset = getDataSet(col);
if (transform.isCompress()) {
return getCompressedExpression(dataset, geneID, transform);
} else {
double[] vals = getExpression(dataset, geneID, transform);
return vals == null ? Double.NaN : vals[getIndexInDataSet(col)];
}
}
use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class CreationParametersPanel method getInfoText.
/**
* Get the files and parameters corresponding to the current enrichment map
*/
private String getInfoText() {
EMCreationParameters params = map.getParams();
StringWriter writer = new StringWriter();
new Html(writer) {
{
bind("bold", "font-weight: bold;");
bind("code", "font-family: Courier,monospaced;");
html().body().style("font-family: Helvetica,Arial,sans-serif; font-size: 1em;");
ol();
addTitle("Cut-Off Values");
ul();
addCutOffItem("P-value", params.getPvalue());
addCutOffItem("FDR Q-value", params.getQvalue());
if (params.getSimilarityMetric() == SimilarityMetric.JACCARD)
addCutOffItem("Jaccard", params.getSimilarityCutoff(), "Jaccard Index");
else if (params.getSimilarityMetric() == SimilarityMetric.OVERLAP)
addCutOffItem("Overlap", params.getSimilarityCutoff(), "Overlap Index");
else if (params.getSimilarityMetric() == SimilarityMetric.COMBINED)
addCutOffItem("Jaccard Overlap Combined", params.getSimilarityCutoff(), "Jaccard Overlap Combined Index (k constant = " + params.getCombinedConstant() + ")");
end();
addTitle("Data Sets");
ol();
for (EMDataSet ds : map.getDataSetList()) addDataSet(ds);
end();
end();
endAll();
done();
}
Html addTitle(String s) {
return li().style("${bold} font-size: 1.1em;").text(s + ": ").end();
}
Html addCutOffItem(String k, Object v) {
return addCutOffItem(k, v, null);
}
Html addCutOffItem(String k, Object v, String test) {
li().b().text(k + ": ").end().span().style("${code}").text("" + v).end();
if (test != null)
br().span().style("${padding}").text("Test used: ").i().text(test).end().end();
return end();
}
Html addDataSet(EMDataSet ds) {
li().b().text(ds.getName()).end();
ul();
li().text("Gene Sets File: ").span().style("${code}").text(shortenPathname(ds.getDataSetFiles().getGMTFileName())).end().end();
String ef1 = ds.getDataSetFiles().getEnrichmentFileName1();
String ef2 = ds.getDataSetFiles().getEnrichmentFileName2();
if (ef1 != null || ef2 != null) {
li().text("Data Files:");
if (ef1 != null)
br().span().style("${code}").raw(INDENT).text(shortenPathname(ef1)).end();
if (ef2 != null)
br().span().style("${code}").raw(INDENT).text(shortenPathname(ef2)).end();
end();
}
if (ds.getDataSetFiles().getExpressionFileName() != null) {
li().text("Expression File: ").span().style("${code}").text(shortenPathname(ds.getDataSetFiles().getExpressionFileName())).end().end();
}
if (ds.getDataSetFiles().getGseaHtmlReportFile() != null) {
li().text("GSEA Report: ").span().style("${code}").text(shortenPathname(ds.getDataSetFiles().getGseaHtmlReportFile())).end().end();
}
end();
return end();
}
};
return writer.getBuffer().toString();
}
use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class ColumnHeaderVerticalRenderer method getTableCellRendererComponent.
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
HeatMapTableModel model = (HeatMapTableModel) table.getModel();
EMDataSet dataset = model.getDataSet(col);
String labelText = SwingUtil.abbreviate(value.toString(), 40);
JLabel verticalLabel = createVerticalLabel(labelText);
JPanel panel = new JPanel(new BorderLayout());
panel.add(verticalLabel, BorderLayout.CENTER);
Color barColor = dataset.getColor();
if (barColor != null) {
JPanel barPanel = new JPanel();
barPanel.setPreferredSize(new Dimension(verticalLabel.getWidth(), 5));
barPanel.setBackground(barColor);
panel.add(barPanel, BorderLayout.NORTH);
}
if (labelBackgroundColor.isPresent()) {
panel.setBackground(labelBackgroundColor.get());
}
panel.setToolTipText(value.toString());
return panel;
}
use of org.baderlab.csplugins.enrichmentmap.model.EMDataSet in project EnrichmentMapApp by BaderLab.
the class PAKnownSignatureCommandTask method processMannWhitneyArgs.
private void processMannWhitneyArgs(EnrichmentMap map, PostAnalysisParameters.Builder builder) {
if (mannWhitRanks.isEmpty() && map.isSingleRanksPerDataset()) {
for (EMDataSet dataset : map.getDataSetList()) {
String ranksName = dataset.getExpressionSets().getAllRanksNames().iterator().next();
builder.addDataSetToRankFile(dataset.getName(), ranksName);
}
} else {
if (mannWhitRanks.isEmpty()) {
throw new IllegalArgumentException("At least one of the data sets you have specified has more than one ranks file. " + "You must use the 'mannWhitRanks' parameter to specify which ranking to use for each data set.");
}
List<EMDataSet> dataSetList = isBatch() ? map.getDataSetList() : Arrays.asList(map.getDataSet(dataSetName));
for (EMDataSet dataSet : dataSetList) {
String dsName = dataSet.getName();
String rankFile = mannWhitRanks.getRankFile(dsName);
Set<String> ranksNames = dataSet.getExpressionSets().getAllRanksNames();
if (ranksNames.size() > 1) {
if (rankFile == null)
throw new IllegalArgumentException("The data set '" + dsName + "' has more than one ranks file, you must specify the rank file using the 'mannWhatRanks' parameter.");
if (!ranksNames.contains(rankFile))
throw new IllegalArgumentException("The data set '" + dsName + "' does not contain the rank file '" + rankFile + "'.");
}
if (rankFile == null && ranksNames.size() == 1) {
builder.addDataSetToRankFile(dsName, ranksNames.iterator().next());
} else {
builder.addDataSetToRankFile(dsName, rankFile);
}
}
}
}
Aggregations