changeset 31:3071750405c9 draft

"planemo upload commit b306c715d8284c097220bc5c8461399fdc05eac7-dirty"
author guerler
date Tue, 24 Nov 2020 17:12:07 +0000
parents b0e195a47df7
children 11b3fc8b5b48
files out.png spring_roc.py spring_roc.xml
diffstat 3 files changed, 28 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
Binary file out.png has changed
--- a/spring_roc.py	Tue Nov 24 14:02:08 2020 +0000
+++ b/spring_roc.py	Tue Nov 24 17:12:07 2020 +0000
@@ -210,6 +210,9 @@
     # get subcellular locations from UniProt export
     locations = dict()
     if isfile(args.locations):
+        regions = list()
+        if args.regions:
+            regions = args.regions.split(",")
         with open(args.locations) as locFile:
             for line in locFile:
                 searchKey = "SUBCELLULAR LOCATION"
@@ -218,9 +221,11 @@
                     uniId = line.split()[0]
                     locStart = searchPos + len(searchKey) + 1
                     locId = line[locStart:].split()[0]
-                    if locId in ["Nucleus", "Membrane", "Cytoplasm"]:
-                        if uniId in filterA and uniId in filterB:
-                            locations[uniId] = locId
+                    if regions:
+                        if locId not in regions:
+                            continue
+                    if uniId in filterA or uniId in filterB:
+                        locations[uniId] = locId
         print("Found %d subcellular locations." % (len(list(locations.keys()))))
 
     # estimate background noise
@@ -269,6 +274,7 @@
     parser.add_argument('-i', '--input', help='Input prediction file.', required=True)
     parser.add_argument('-b', '--biogrid', help='BioGRID interaction database file', required=True)
     parser.add_argument('-l', '--locations', help='UniProt export table with subcellular locations', required=False)
+    parser.add_argument('-r', '--regions', help='Comma-separated regions', required=False)
     parser.add_argument('-e', '--experiment', help='Type (physical/genetic)', default="", required=False)
     parser.add_argument('-t', '--throughput', help='Throughput (low/high)', default="", required=False)
     parser.add_argument('-m', '--method', help='Method e.g. Two-hybrid', default="", required=False)
--- a/spring_roc.xml	Tue Nov 24 14:02:08 2020 +0000
+++ b/spring_roc.xml	Tue Nov 24 17:12:07 2020 +0000
@@ -4,12 +4,27 @@
         <requirement type="package" version="3.3.3">matplotlib</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
-        python3 '$__tool_directory__/spring_roc.py' -i '$input' -b '$database' -e '$experiment.type' -m '$experiment.method' -t '$throughput' -l '$locations' -o '$rocplot'
+        python3 '$__tool_directory__/spring_roc.py' -i '$input' -b '$database' -e '$experiment.type' -m '$experiment.method' -t '$throughput' -l '$sampling.locations' -r '$sampling.regions' -o '$rocplot'
     ]]></command>
     <inputs>
-        <param format="tabular" name="input" type="data" label="Interactions" help="Prediction Input Table with 2-columns containing UniProt Accession codes."/>
-        <param format="tabular" name="database" type="data" label="BioGRID Database" help="BioGRID Database in TAB 3.0 format."/>
-        <param format="tabular" name="locations" type="data" label="UniProt Localization" help="UniProt tabular export with localization column to sample non-interacting pairs." optional="True" />
+        <param name="input" type="data" format="tabular" label="Interactions" help="Prediction Input Table with 2-columns containing UniProt Accession codes."/>
+        <param name="database" type="data" format="tabular" label="BioGRID Database" help="BioGRID Database in TAB 3.0 format."/>
+        <conditional name="sampling">
+            <param name="type" type="boolean" label="Use UniProt Localization" />
+            <when value="true">
+                <param name="locations" type="data" format="tabular" label="UniProt Localization" help="UniProt tabular export with localization column to sample non-interacting pairs." optional="True" />
+                <param name="regions" type="select" multiple="True" label="Choose Subcelluar Locations">
+                    <option value="Membrane" selected="True">Membrane</option>
+                    <option value="Mitochondrion" selected="True">Mitochondrion</option>
+                    <option value="Nucleus">Nucleus</option>
+                    <option value="Secreted">Secreted</option>
+                 </param>
+            </when>
+            <when value="false">
+                <param name="locations" type="hidden" value="" />
+                <param name="regions" type="hidden" value="" />
+            </when>
+        </conditional>
         <conditional name="experiment">
             <param name="type" type="select" label="Experimental Type" display="radio" help="Choose a specific experimental system type.">
                 <option value="">Any</option>