Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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 resources/queries/protein/Sequences.query.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<query xmlns="http://labkey.org/data/xml/query">
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="Sequences" tableDbType="TABLE">
<columns>
<column columnName="ProtSequence">
<displayWidth>200</displayWidth>
</column>
</columns>
</table>
</tables>
</metadata>
</query>
16 changes: 16 additions & 0 deletions resources/queries/targetedms/Protein/.qview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
label="Proteins" canOverride="true">
<columns>
<column name="Label" />
<column name="Description" />
<column name="Accession" />
<column name="PreferredName" />
<column name="Gene" />
<column name="Species" />

<column name="SequenceId/ProtSequence" />
<column name="Note" />

</columns>

</customView>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ALTER TABLE targetedms.Runs ADD COLUMN ProteinCount INT;

UPDATE targetedms.Runs r
SET ProteinCount = (
SELECT COUNT(*)
FROM targetedms.Protein p
JOIN targetedms.PeptideGroup pg ON p.PeptideGroupId = pg.Id
WHERE pg.RunId = r.Id
);

-- Redefine PeptideGroupCount: groups containing at least one peptide
UPDATE targetedms.Runs r
SET PeptideGroupCount = (
SELECT COUNT(DISTINCT pg.Id)
FROM targetedms.PeptideGroup pg
JOIN targetedms.GeneralMolecule gm ON gm.PeptideGroupId = pg.Id
JOIN targetedms.Peptide p ON p.Id = gm.Id
WHERE pg.RunId = r.Id
);

ALTER TABLE targetedms.Runs ADD COLUMN MoleculeGroupCount INT;

UPDATE targetedms.Runs r
SET MoleculeGroupCount = (
SELECT COUNT(DISTINCT pg.Id)
FROM targetedms.PeptideGroup pg
JOIN targetedms.GeneralMolecule gm ON gm.PeptideGroupId = pg.Id
JOIN targetedms.Molecule m ON m.Id = gm.Id
WHERE pg.RunId = r.Id
);

ALTER TABLE targetedms.Runs ALTER COLUMN MoleculeGroupCount SET NOT NULL;
ALTER TABLE targetedms.Runs ALTER COLUMN PeptideGroupCount SET NOT NULL;
ALTER TABLE targetedms.Runs ALTER COLUMN ProteinCount SET NOT NULL;
14 changes: 11 additions & 3 deletions resources/schemas/targetedms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,23 @@
<column columnName="DocumentGUID"/>
<column columnName="PeptideGroupCount">
<formatString>#,###</formatString>
<url>/targetedms-showPrecursorList.view?id=${Id}</url>
<url>/targetedms-showPeptideGroupList.view?id=${Id}</url>
</column>
<column columnName="MoleculeGroupCount">
<formatString>#,###</formatString>
<url>/targetedms-showMoleculeGroupList.view?id=${Id}</url>
</column>
<column columnName="ProteinCount">
<formatString>#,###</formatString>
<url>/targetedms-showProteinList.view?id=${Id}</url>
</column>
<column columnName="PeptideCount">
<formatString>#,###</formatString>
<url>/targetedms-showPrecursorList.view?id=${Id}</url>
<url>/targetedms-showPeptideList.view?id=${Id}</url>
</column>
<column columnName="SmallMoleculeCount">
<formatString>#,###</formatString>
<url>/targetedms-showPrecursorList.view?id=${Id}</url>
<url>/targetedms-showMoleculeList.view?id=${Id}</url>
</column>
<column columnName="PrecursorCount">
<formatString>#,###</formatString>
Expand Down
10 changes: 9 additions & 1 deletion src/org/labkey/targetedms/SkylineDocImporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public class SkylineDocImporter
protected static final Logger _systemLog = LogHelper.getLogger(SkylineDocImporter.class, "Imports Skyline documents");
protected final XarContext _context;
private int blankLabelIndex;
private int _importedPeptideGroupCount = 0;
private int _importedMoleculeGroupCount = 0;
private int _importedProteinCount = 0;

private final LocalDirectory _localDirectory;
private final PipeRoot _pipeRoot;
Expand Down Expand Up @@ -450,7 +453,9 @@ private void importSkylineDoc(TargetedMSRun run, File f) throws XMLStreamExcepti
int auditLogEntriesCount = importer.importAuditLogFile(_user, _auditLogFile, parser.getDocumentGUID(), run);

run.setAuditLogEntriesCount(auditLogEntriesCount);
run.setPeptideGroupCount(parser.getPeptideGroupCount());
run.setPeptideGroupCount(_importedPeptideGroupCount);
run.setMoleculeGroupCount(_importedMoleculeGroupCount);
run.setProteinCount(_importedProteinCount);
run.setPeptideCount(parser.getPeptideCount());
run.setSmallMoleculeCount(parser.getSmallMoleculeCount());
run.setPrecursorCount(parser.getPrecursorCount());
Expand Down Expand Up @@ -1357,10 +1362,12 @@ else if(!pepGroup.isDecoy())
if(peptideCount > 0)
{
_log.debug(String.format("Total peptides inserted: %d", peptideCount));
_importedPeptideGroupCount++;
}
if(moleculeCount > 0)
{
_log.debug(String.format("Total molecules inserted: %d", moleculeCount));
_importedMoleculeGroupCount++;
}
}

Expand All @@ -1381,6 +1388,7 @@ private void insertProtein(Protein protein)
proteinService.ensureIdentifiers(seqId, identifierMap);
}
Table.insert(null, TargetedMSManager.getTableInfoProtein(), protein);
_importedProteinCount++;
}

private static final String SKYLINE_IDENT_TYPE = "Skyline";
Expand Down
117 changes: 109 additions & 8 deletions src/org/labkey/targetedms/TargetedMSController.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,11 @@
import org.labkey.targetedms.view.CalibrationCurvesView;
import org.labkey.targetedms.view.ChromatogramGridView;
import org.labkey.targetedms.view.ChromatogramsDataRegion;
import org.labkey.targetedms.view.DocumentGeneralMoleculesView;
import org.labkey.targetedms.view.DocumentPeptideGroupView;
import org.labkey.targetedms.view.DocumentProteinView;
import org.labkey.targetedms.view.DocumentPrecursorsView;
import org.labkey.targetedms.view.DocumentTransitionsView;
import org.labkey.targetedms.view.DocumentView;
import org.labkey.targetedms.view.FiguresOfMeritView;
import org.labkey.targetedms.view.GroupComparisonView;
import org.labkey.targetedms.view.InstrumentSummaryWebPart;
Expand Down Expand Up @@ -4377,7 +4379,7 @@ public void addNavTrail(NavTree root, TargetedMSRun run)
// Action to display a document's transition or precursor list, with both proteomics and small molecule views
// ------------------------------------------------------------------------
@RequiresPermission(ReadPermission.class)
public abstract class ShowRunSplitDetailsAction<VIEWTYPE extends DocumentView> extends AbstractShowRunDetailsAction<RunDetailsForm, VIEWTYPE>
public abstract class ShowRunSplitDetailsAction<VIEWTYPE extends QueryView> extends AbstractShowRunDetailsAction<RunDetailsForm, VIEWTYPE>
{
public ShowRunSplitDetailsAction()
{
Expand Down Expand Up @@ -4496,16 +4498,16 @@ public ShowPrecursorListAction(ViewContext ctx)
@Override
protected DocumentPrecursorsView createQueryView(RunDetailsForm form, BindException errors, boolean forExport, String dataRegion)
{
DocumentPrecursorsView view;
if(PeptidePrecursorsView.DATAREGION_NAME.equals(dataRegion))
DocumentPrecursorsView view = null;
if (PeptidePrecursorsView.DATAREGION_NAME.equals(dataRegion))
{
view = new PeptidePrecursorsView(getViewContext(),
new TargetedMSSchema(getUser(), getContainer()),
TargetedMSSchema.TABLE_EXPERIMENT_PRECURSOR,
form.getId(),
forExport);
}
else
else if (SmallMoleculePrecursorsView.DATAREGION_NAME.equals(dataRegion))
{
view = new SmallMoleculePrecursorsView(getViewContext(),
new TargetedMSSchema(getUser(), getContainer()),
Expand All @@ -4514,9 +4516,12 @@ protected DocumentPrecursorsView createQueryView(RunDetailsForm form, BindExcept
forExport);
}

view.setShowExportButtons(true);
view.setShowDetailsColumn(false);
view.setButtonBarPosition(DataRegion.ButtonBarPosition.BOTH);
if (view != null)
{
view.setShowExportButtons(true);
view.setShowDetailsColumn(false);
view.setButtonBarPosition(DataRegion.ButtonBarPosition.BOTH);
}

return view;
}
Expand All @@ -4534,6 +4539,102 @@ public String getDataRegionNameSmallMolecule()
}
}

@RequiresPermission(ReadPermission.class)
public class ShowPeptideGroupListAction extends ShowRunSingleDetailsAction<RunDetailsForm>
{
public ShowPeptideGroupListAction()
{
super(RunDetailsForm.class, "Peptide Groups", TargetedMSSchema.TABLE_PEPTIDE_GROUP);
}

@Override
protected QueryView createQueryView(RunDetailsForm form, BindException errors, boolean forExport, String dataRegion)
{
TargetedMSSchema schema = new TargetedMSSchema(getUser(), getContainer());
DocumentPeptideGroupView view = new DocumentPeptideGroupView(getViewContext(), schema, form.getId(),
TargetedMSSchema.TABLE_PEPTIDE_GROUP, "Protein Groups");
view.setShowDetailsColumn(false);
view.setShowFilterDescription(false);
return view;
}
}

@RequiresPermission(ReadPermission.class)
public class ShowMoleculeGroupListAction extends ShowRunSingleDetailsAction<RunDetailsForm>
{
public ShowMoleculeGroupListAction()
{
super(RunDetailsForm.class, "Molecule Lists", TargetedMSSchema.TABLE_MOLECULE_GROUP);
}

@Override
protected QueryView createQueryView(RunDetailsForm form, BindException errors, boolean forExport, String dataRegion)
{
TargetedMSSchema schema = new TargetedMSSchema(getUser(), getContainer());
DocumentPeptideGroupView view = new DocumentPeptideGroupView(getViewContext(), schema, form.getId(),
TargetedMSSchema.TABLE_MOLECULE_GROUP, "Molecule Lists");
view.setShowDetailsColumn(false);
view.setShowFilterDescription(false);
return view;
}
}

@RequiresPermission(ReadPermission.class)
public class ShowProteinListAction extends ShowRunSingleDetailsAction<RunDetailsForm>
{
public ShowProteinListAction()
{
super(RunDetailsForm.class, "Proteins", TargetedMSSchema.TABLE_PROTEIN);
}

@Override
protected QueryView createQueryView(RunDetailsForm form, BindException errors, boolean forExport, String dataRegion)
{
TargetedMSSchema schema = new TargetedMSSchema(getUser(), getContainer());
DocumentProteinView view = new DocumentProteinView(getViewContext(), schema, form.getId());
view.setShowDetailsColumn(false);
return view;
}
}

@RequiresPermission(ReadPermission.class)
public class ShowPeptideListAction extends ShowRunSingleDetailsAction<RunDetailsForm>
{
public ShowPeptideListAction()
{
super(RunDetailsForm.class, "Peptides", TargetedMSSchema.TABLE_PEPTIDE);
}

@Override
protected QueryView createQueryView(RunDetailsForm form, BindException errors, boolean forExport, String dataRegion)
{
TargetedMSSchema schema = new TargetedMSSchema(getUser(), getContainer());
DocumentGeneralMoleculesView view = new DocumentGeneralMoleculesView(getViewContext(), schema, form.getId(),
TargetedMSSchema.TABLE_PEPTIDE, "Peptides");
view.setShowDetailsColumn(false);
return view;
}
}

@RequiresPermission(ReadPermission.class)
public class ShowMoleculeListAction extends ShowRunSingleDetailsAction<RunDetailsForm>
{
public ShowMoleculeListAction()
{
super(RunDetailsForm.class, "Small Molecules", TargetedMSSchema.TABLE_MOLECULE);
}

@Override
protected QueryView createQueryView(RunDetailsForm form, BindException errors, boolean forExport, String dataRegion)
{
TargetedMSSchema schema = new TargetedMSSchema(getUser(), getContainer());
DocumentGeneralMoleculesView view = new DocumentGeneralMoleculesView(getViewContext(), schema, form.getId(),
TargetedMSSchema.TABLE_MOLECULE, "Small Molecules");
view.setShowDetailsColumn(false);
return view;
}
}

@RequiresPermission(ReadPermission.class)
public class ShowGroupComparisonAction extends ShowRunSplitDetailsAction<GroupComparisonView>
{
Expand Down
10 changes: 10 additions & 0 deletions src/org/labkey/targetedms/TargetedMSManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2660,6 +2660,16 @@ public static boolean containerHasPeptides(Container container)
return new SqlSelector(TargetedMSManager.getSchema(), new SQLFragment("SELECT Id FROM ", container, false).append(TargetedMSManager.getTableInfoRuns(), "r").append(" WHERE PeptideCount > 0 AND Container = ? AND Deleted = ?")).exists();
}

public static boolean containerHasMoleculeGroups(Container container)
{
return new SqlSelector(TargetedMSManager.getSchema(), new SQLFragment("SELECT Id FROM ", container, false).append(TargetedMSManager.getTableInfoRuns(), "r").append(" WHERE MoleculeGroupCount > 0 AND Container = ? AND Deleted = ?")).exists();
}

public static boolean containerHasProteins(Container container)
{
return new SqlSelector(TargetedMSManager.getSchema(), new SQLFragment("SELECT Id FROM ", container, false).append(TargetedMSManager.getTableInfoRuns(), "r").append(" WHERE ProteinCount > 0 AND Container = ? AND Deleted = ?")).exists();
}

public static boolean containerHasCalibrationCurves(Container container)
{
return new SqlSelector(TargetedMSManager.getSchema(), new SQLFragment("SELECT Id FROM ", container, false).append(TargetedMSManager.getTableInfoRuns(), "r").append(" WHERE CalibrationCurveCount > 0 AND Container = ? AND Deleted = ?")).exists();
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/targetedms/TargetedMSModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public String getName()
@Override
public Double getSchemaVersion()
{
return 26.006;
return 26.007;
}

@Override
Expand Down
22 changes: 22 additions & 0 deletions src/org/labkey/targetedms/TargetedMSRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public class TargetedMSRun implements Serializable, ITargetedMSRun
protected RunRepresentativeDataState _representativeDataState = NotRepresentative;

protected int _peptideGroupCount;
protected int _moleculeGroupCount;
protected int _proteinCount;
protected int _peptideCount;
protected int _smallMoleculeCount;
protected int _precursorCount;
Expand Down Expand Up @@ -249,6 +251,26 @@ public void setPeptideGroupCount(int peptideGroupCount)
_peptideGroupCount = peptideGroupCount;
}

public int getMoleculeGroupCount()
{
return _moleculeGroupCount;
}

public void setMoleculeGroupCount(int moleculeGroupCount)
{
_moleculeGroupCount = moleculeGroupCount;
}

public int getProteinCount()
{
return _proteinCount;
}

public void setProteinCount(int proteinCount)
{
_proteinCount = proteinCount;
}

public int getPeptideCount()
{
return _peptideCount;
Expand Down
Loading
Loading