Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/org/labkey/targetedms/TargetedMSController.java
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ public static class LeveyJenningsPlotOptions
private Integer _trailingRuns;
private Integer _calendarMonthsToShow;
private String _heatmapDataSource;
private String _hiddenSeries;

public Map<String, String> getAsMapOfStrings()
{
Expand Down Expand Up @@ -906,6 +907,8 @@ public Map<String, String> getAsMapOfStrings()
valueMap.put("calendarMonthsToShow", Integer.toString(_calendarMonthsToShow));
if (_heatmapDataSource != null)
valueMap.put("heatMapDataSource", _heatmapDataSource);
if (_hiddenSeries != null)
valueMap.put("hiddenSeries", _hiddenSeries);
// note: start and end date handled separately since they can be null and we want to persist that
return valueMap;
}
Expand Down Expand Up @@ -1034,6 +1037,16 @@ public void setHeatmapDataSource(String heatmapDataSource)
{
_heatmapDataSource = heatmapDataSource;
}

public String getHiddenSeries()
{
return _hiddenSeries;
}

public void setHiddenSeries(String hiddenSeries)
{
_hiddenSeries = hiddenSeries;
}
}

@RequiresPermission(ReadPermission.class)
Expand Down
44 changes: 44 additions & 0 deletions src/org/labkey/targetedms/model/QCPlotFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public class QCPlotFragment
private List<GuideSetStats> guideSetStats;
@Nullable
private Color _seriesColor;
@Nullable
private Long precursorRowId;
@Nullable
private Long peptideGroupId;
@Nullable
private String peptideGroupLabel;

public String getSeriesLabel()
{
Expand Down Expand Up @@ -77,6 +83,11 @@ public JSONObject toJSON(boolean includeLJ, boolean includeMR, boolean includeMe
JSONObject jsonObject = new JSONObject();
jsonObject.put("DataType", getDataType());
jsonObject.put("SeriesLabel", getSeriesLabel());
if (peptideGroupId != null)
{
jsonObject.put("PeptideGroupId", peptideGroupId);
jsonObject.put("PeptideGroupLabel", peptideGroupLabel != null ? peptideGroupLabel : "");
}
if (_seriesColor != null)
{
jsonObject.put("SeriesColor", "#" + Integer.toHexString(_seriesColor.getRGB()).substring(2).toUpperCase());
Expand Down Expand Up @@ -205,4 +216,37 @@ public Color getSeriesColor()
{
return _seriesColor;
}

@Nullable
public Long getPrecursorRowId()
{
return precursorRowId;
}

public void setPrecursorRowId(Long precursorRowId)
{
this.precursorRowId = precursorRowId;
}

@Nullable
public Long getPeptideGroupId()
{
return peptideGroupId;
}

public void setPeptideGroupId(Long peptideGroupId)
{
this.peptideGroupId = peptideGroupId;
}

@Nullable
public String getPeptideGroupLabel()
{
return peptideGroupLabel;
}

public void setPeptideGroupLabel(String peptideGroupLabel)
{
this.peptideGroupLabel = peptideGroupLabel;
}
}
21 changes: 19 additions & 2 deletions src/org/labkey/targetedms/outliers/OutlierGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@
import org.labkey.targetedms.model.SampleFileQCMetadata;
import org.labkey.targetedms.parser.GeneralMolecule;
import org.labkey.targetedms.parser.GeneralPrecursor;
import org.labkey.targetedms.parser.PeptideGroup;
import org.labkey.targetedms.parser.SampleFile;
import org.labkey.targetedms.query.MoleculeManager;
import org.labkey.targetedms.query.MoleculePrecursorManager;
import org.labkey.targetedms.query.PeptideGroupManager;
import org.labkey.targetedms.query.PeptideManager;
import org.labkey.targetedms.query.PrecursorManager;

Expand Down Expand Up @@ -539,7 +541,11 @@ public List<QCPlotFragment> getQCPlotFragment(List<RawMetricDataSet> rawMetricDa
Optional<RawMetricDataSet> bestPrecursorIdRow = entry.getValue().stream().filter(x -> x.getPrecursorId() != null).min(Comparator.comparing(RawMetricDataSet::getPrecursorId));

// Remember the precursor ID so that we can assign a series color based on Skyline's algorithm
bestPrecursorIdRow.ifPresent(rawMetricDataSet -> fragmentsByPrecursorId.put(rawMetricDataSet.getPrecursorId(), qcPlotFragment));
// and to sort by Skyline document order (row ID) instead of alphabetically
bestPrecursorIdRow.ifPresent(rawMetricDataSet -> {
fragmentsByPrecursorId.put(rawMetricDataSet.getPrecursorId(), qcPlotFragment);
qcPlotFragment.setPrecursorRowId(rawMetricDataSet.getPrecursorId());
});

qcPlotFragment.setSeriesLabel(entry.getKey());
qcPlotFragment.setQcPlotData(entry.getValue());
Expand Down Expand Up @@ -588,10 +594,21 @@ public List<QCPlotFragment> getQCPlotFragment(List<RawMetricDataSet> rawMetricDa
Color color = ColorGenerator.getColor(molecule.getTextId(), seriesColors);
entry.getValue().setSeriesColor(color);
seriesColors.add(color);

// set the peptide group (protein / molecule list) for the combined plot tree legend
PeptideGroup peptideGroup = PeptideGroupManager.getPeptideGroup(c, molecule.getPeptideGroupId());
if (peptideGroup != null)
{
entry.getValue().setPeptideGroupId(peptideGroup.getId());
entry.getValue().setPeptideGroupLabel(peptideGroup.getLabel());
}
}
}

qcPlotFragments.sort(Comparator.comparing(QCPlotFragment::getSeriesLabel));
// Sort by precursor row ID to preserve Skyline document order. Fragments with no precursor ID
// (e.g. trace metrics) fall back to alphabetical order after all precursor-scoped series.
qcPlotFragments.sort(Comparator.comparing(QCPlotFragment::getPrecursorRowId, Comparator.nullsLast(Comparator.naturalOrder()))
.thenComparing(QCPlotFragment::getSeriesLabel));
return qcPlotFragments;
}

Expand Down
13 changes: 13 additions & 0 deletions webapp/TargetedMS/css/qcTrendPlotReport.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,17 @@

.x4-panel-header-text-container-default {
font-weight: normal;
}

.qc-combined-tree-legend {
background: white;
line-height: 1.4;
}

.qc-combined-tree-legend .qc-tree-group label:hover {
background-color: #f0f0f0;
}

.qc-combined-tree-legend .qc-tree-precursor:hover {
background-color: #f0f0f0;
}
4 changes: 4 additions & 0 deletions webapp/TargetedMS/js/QCPlotHelperBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,11 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperBase", {
}

if (this.singlePlot && this.getMetricPropsById(this.metric).precursorScoped) {
this.peptideGroups = this.buildPeptideGroups();
addedPlot = this.addCombinedPeptideSinglePlot(metricProps);
}
else {
this.peptideGroups = null;
addedPlot = this.addIndividualPrecursorPlots(metricProps);
}

Expand Down Expand Up @@ -822,6 +824,8 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperBase", {
const plot = LABKEY.vis.TrendingLinePlot(plotConfig);
plot.render();

this.attachCombinedLegendClickHandlers();

this.addAnnotationsToPlot(plot, combinePlotData);

this.addGuideSetTrainingRangeToPlot(plot, combinePlotData);
Expand Down
11 changes: 11 additions & 0 deletions webapp/TargetedMS/js/QCPlotHelperWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperWrapper", {
}

this.setPlotBrushingDisplayStyle();

if (this.hasPeptideGroupTree()) {
this.renderCombinedTreeLegend(id, legendMargin);
}

return true;
},

Expand Down Expand Up @@ -295,6 +300,12 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperWrapper", {
this.fragmentPlotData[fragment] = this.getInitFragmentPlotData(fragment, dataType, mz, color);
}

// Store peptide group info (protein / molecule list) for the combined plot tree legend
if (this.fragmentPlotData[fragment].peptideGroupId == null && plotDataRow['PeptideGroupId'] != null) {
this.fragmentPlotData[fragment].peptideGroupId = plotDataRow['PeptideGroupId'];
this.fragmentPlotData[fragment].peptideGroupLabel = plotDataRow['PeptideGroupLabel'];
}

var metricId = row['MetricId'];
const metricProp = metricProps[metricId];

Expand Down
Loading
Loading