changeset 0:ddcab0f11473 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/psm_validation commit 896365c9d6b9fcdcbb9c36e0c81db78c8a4e8dab"
author galaxyp
date Thu, 15 Oct 2020 07:45:17 +0000
parents
children b71c651e7950
files application.py macros.xml psm_validation.xml test-data/test-peptides.txt test-data/test.db
diffstat 5 files changed, 139 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/application.py	Thu Oct 15 07:45:17 2020 +0000
@@ -0,0 +1,66 @@
+import argparse
+
+import psmfragmentation.psmfragmentation as pf
+
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(description="Run PSM Validator")
+    parser.add_argument(
+        "-d",
+        "--dbname",
+        help="Path to mzsqlite db",
+    )
+    parser.add_argument(
+        "-p",
+        "--peptides",
+        help="Path to peptide sequence file",
+    )
+    parser.add_argument(
+        "-n",
+        "--neutral",
+        action="store_true",
+        default=False,
+        help="Calculate netutral loss",
+    )
+    parser.add_argument(
+        "-i",
+        "--internal",
+        action="store_true",
+        default=False,
+        help="Calculate internals",
+    )
+    parser.add_argument(
+        "-e", "--epsilon", type=float
+    )
+    parser.add_argument(
+        "-b",
+        "--b_run",
+        type=int,
+        default=2,
+        help="Number of consecutive b-ions"
+    )
+    parser.add_argument(
+        "-y",
+        "--y_run",
+        type=int,
+        default=2,
+        help="Number of consecutive y-ions"
+    )
+
+    parser.add_argument(
+        "-t",
+        "--test",
+        action="store_true",
+        default=False
+    )
+
+    args = parser.parse_args()
+
+    itypes = ['b', 'y']
+    if args.neutral:
+        itypes.extend(['b-H2O', 'b-NH3', 'y-H2O', 'y-NH3'])
+
+    if args.internal:
+        itypes.append('M')
+
+    pf.score_psms(args.dbname, args.peptides, ion_types=itypes, epsilon=args.epsilon, maxcharge=1, b_run=args.b_run, y_run=args.y_run, a_test=args.test)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Thu Oct 15 07:45:17 2020 +0000
@@ -0,0 +1,15 @@
+<macros>
+    <token name="@VERSION@">1.0.3</token>
+    <xml name="help-text">
+        <help>
+            <![CDATA[                
+                PSMValidator filters and validates PSMs against a supplied list of peptide sequences.
+            ]]>
+        </help>
+    </xml>
+    <xml name="pkg_requirement">
+        <requirements>
+            <requirement type="package" version="@VERSION@">psm_fragments</requirement>
+        </requirements>
+    </xml>
+</macros>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/psm_validation.xml	Thu Oct 15 07:45:17 2020 +0000
@@ -0,0 +1,56 @@
+    <tool id="psmvalidator" name="PSM-Fragment Validator" version="@VERSION@">
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <description>Validate PSMs against Ion Fragmentation</description>
+    <expand macro="pkg_requirement" />
+    <command detect_errors="exit_code">
+        <![CDATA[
+        python '$__tool_directory__/application.py' 
+            -d '$mz_db_name'
+            -p '$peptide_sequences'
+            #if $neutral_loss_ions:
+                -n
+            #end if
+            #if $internal_ions:
+                -i
+            #end if
+            -b $b_ion_run
+            -y $y_ion_run
+            -e $epsilon
+            #if $b_ion_run < 0:
+                --test
+            #end if
+        ]]>
+    </command>
+    <inputs>
+        <param name="mz_db_name" type="data" format="mz.sqlite" label="MZSQLite DB" />
+        <param name="peptide_sequences" type="data" format="tabular" label="Peptide Sequence List" />
+        <param name="b_ion_run" type="integer" value="2" label="Consecutive B-Ions" />
+        <param name="y_ion_run" type="integer" value="2" label="Consecutive Y-Ions" />
+        <param name="neutral_loss_ions" type="boolean" checked="True" label="Use Neutral Loss" />
+        <param name="internal_ions" type="boolean" checked="True" label="Use Internals" />
+        <param name="epsilon" type="float" value="0.5" label="Epsilon" />
+    </inputs>
+    <outputs>
+        <data name="html_output" format="html" from_work_dir="index.html" label="PSM Ion Fragementation Report" />
+        <data name="text_output" format="tabular" from_work_dir="results.tab" label="Tabular Results" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="mz_db_name" value="test.db" />
+            <param name="peptide_sequences" value="test-peptides.txt" />
+            <param name="b_ion_run" value="-99" />
+            <param name="y_ion_run" value="-99" />
+            <param name="neutral_loss_ions" value="True" />
+            <param name="internal_ions" value="True" />
+            <param name="epsilon" value="0.5" />
+            <output name="html_output">
+                <assert_contents>
+                    <has_text text="success" />
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+    <expand macro="help-text" />
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test-peptides.txt	Thu Oct 15 07:45:17 2020 +0000
@@ -0,0 +1,1 @@
+test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.db	Thu Oct 15 07:45:17 2020 +0000
@@ -0,0 +1,1 @@
+test
\ No newline at end of file