Premium Feature — Available with all Premium Editions of LabKey Server. Learn more or contact LabKey.

This topic provides a few example resources that could be included in a file-based module to customize dashboards and queries for working with MS2 data. You can install our demo module, or recreate one or more of these resources in your own file-based module, following the guidance in Tutorial: File Based Module Resources.

Demo Module

Download this demo module and deploy it on your server:

When you add this module to a ms2 folder (via (Admin) > Folder > Management > Folder Type), you will be able to access custom views, queries, and reports it contains.

File Contents of reportDemo

reportDemo │ │ build.gradle └───resources    ├───queries    │ └───ms2    │ │ PeptideCounts.sql (SQL Queries)    │ │ PeptidesWithCounts.sql    │ │    │ └───Peptides    │ High Prob Matches.qview.xml (Custom Grid View)    │    ├───reports    │ └───schemas    │ └───ms2    │ └───PeptidesWithCounts    │ Histogram.r (R Report)    │    └───views        reportdemo.html (Custom UI)        reportdemo.view.xml        reportdemo.webpart.xml

Custom Grid View

The file High Prob Matches.qview.xml will display peptides with high Peptide Prophet scores (greater than or equal to 0.9). It's syntax is:

<customView xmlns="">
<column name="Scan"/>
<column name="Charge"/>
<column name="PeptideProphet"/>
<column name="Fraction/FractionName"/>
<filter column="PeptideProphet" operator="gte" value="0.9"/>
<sort column="PeptideProphet" descending="true"/>
  • The root element of the qview.xml file must be <customView> and you should use the namespace indicated.
  • <columns> specifies which columns are displayed. Lookups columns can be included (e.g., "Fraction/FractionName").
  • <filters> may contain any number of filter definitions. (In this example, we filter for rows where PeptideProphet >= 0.9). (docs: <filter>)
  • <sorts> section will be applied in the order they appear in this section. In this example, we sort descending by the PeptideProphet column. To sort ascending simply omit the descending attribute.

See the View

The directory location of the qview.xml file determines where you can find it. To see the view on the ms2.Peptides table:

  • Go to the Peptides table and click (Grid Views) -- the view High Prob Matches has been added to the list.
    • Select (Admin) > Developer Links > Schema Browser.
    • Open ms2, scroll down to Peptides.
    • Select (Grid Views) > High Prob Matches.

SQL Queries

The example module includes two queries:


COUNT(Peptides.TrimmedPeptide) AS UniqueCount,
Peptides.Fraction.Run AS Run,
Peptides.PeptideProphet >= 0.9


PeptideCounts pc
Peptides p
ON (p.Fraction.Run = pc.Run AND pc.TrimmedPeptide = p.TrimmedPeptide)
WHERE pc.UniqueCount > 1

See the SQL Queries

  • To view your SQL queries, go to the schema browser at (Admin) > Go To Module > Query.
  • On the left side, open the ms2 node and click PeptideCounts.

Using an additional *.query.xml file, you can add metadata including conditional formatting, additional keys, and field formatting. The *.query.xml file should have same root file name as the *.sql file for the query to be modified. Learn more in this topic: Modules: Query Metadata.

Add R Report

The Histogram.r file presents a report on the PeptidesWithCounts query also defined in the module. It has the following contents:


xlab="Fractional Delta Mass",
col = "light blue",
border = "dark blue")

View this R Histogram

  • Go to the Query module's home page ( (Admin) > Go to Module > Query). Note that the home page of the Query module is the Query Browser.
  • Open the ms2 node, and see your two new queries on the list.
  • Click PeptidesWithCounts and then View Data to run the query and view the results.
  • While viewing the results, you can run your R report by selecting (Reports) > Histogram.

Custom User Interface

In the views directory, you can provide HTML pages and define web parts making it easier for your users to directly access the resources you created. Note that HTML files must not contain spaces in the file name.


<a id="pep-report-link"
Peptides With Counts Report</a>

Learn about token replacement for contextPath and containerPath in this topic: Module HTML and Web Parts.


<view xmlns=""
frame="none" title="Report Demo">


<webpart xmlns="" title="Report Demo">
<view name="reportdemo"/>

View the User Interface

Once you have saved all three files, refresh your portal page and enter > Page Admin Mode. You will see a Report Demo web part available on the left side. Add it to the page and you will see your report.

Learn about setting the permissions to view this web part in this topic: Module HTML and Web Parts.

Related Topics

Was this content helpful?

Log in or register an account to provide feedback

expand allcollapse all