changeset 0:bc556481a1fb draft default tip

planemo upload commit e12eb56d1744da8f7af8ca1819e2617c83fb17a8
author estrain
date Fri, 13 Mar 2026 12:01:17 +0000
parents
children
files lissero.xml variant4b.py
diffstat 2 files changed, 107 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lissero.xml	Fri Mar 13 12:01:17 2026 +0000
@@ -0,0 +1,53 @@
+<tool id="lissero" name="lissero" version="1.0.1+galaxy2" python_template_version="3.5" profile="21.05">
+<requirements>
+    <requirement type="package" version="0.4.9">lissero</requirement>
+    
+</requirements>
+    <command detect_errors="exit_code"><![CDATA[
+        lissero 
+        #if $settings.advanced == "advanced"
+          --min_id $settings.min_id
+          --min_cov $settings.min_cov
+        #end if
+        '$input1' > output1;
+        python $__tool_directory__/variant4b.py output1 output2.txt ${input1.element_identifier};   
+    ]]></command>
+    <inputs>
+        <param type="data" name="input1" format="fasta" />
+        <conditional name="settings">
+            <param name="advanced" type="select" label="Specify advanced parameters">
+                <option value="simple" selected="true">No, use program defaults.</option>
+                <option value="advanced">Yes, see full parameter list.</option>
+            </param>
+            <when value="simple">
+            </when>
+            <when value="advanced">
+                <param name="min_id" type="float" label="Minimum percent identity to accept a match" value="95.0" min="0" max="100" /> 
+                <param name="min_cov" type="float" label="Minimum coverage of a gene to accept a match" value="95.0" min="0" max="100" /> 
+            </when>
+        </conditional>
+    </inputs>
+    <outputs>
+      <data format="tabular" name="lissero.tsv" label="${tool.name} on ${on_string}: LisSero" from_work_dir="*.txt"/>
+    </outputs>
+    <help><![CDATA[
+        Usage: lissero [OPTIONS] FASTA...
+
+  In silico serogroup prediction for L. monocytogenes. Alleles: lmo1118,
+  lmo0737, ORF2819, ORF2110, Prs
+
+  References:
+
+  Doumith et al. Differentiation of the major Listeria monocytogenes
+  serovars by multiplex PCR. J Clin Microbiol, 2004; 42:8; 3819-22
+
+Options:
+  -h, --help              Show this message and exit.
+  --min_id FLOAT          Minimum percent identity to accept a match. [0-100][default=95.0]
+  --min_cov FLOAT         Minimum coverage of the gene to accept a match. [0-100][default=95.0]
+
+    ]]></help>
+    <citations>
+      <citation type="doi">10.1128/JCM.42.8.3819-3822.2004</citation> 
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/variant4b.py	Fri Mar 13 12:01:17 2026 +0000
@@ -0,0 +1,54 @@
+import sys
+
+def identify_variants_with_genes(input_file_path, output_file_path, simple_name):
+    # Define the genes of interest
+    genes_of_interest = ['LMO0737', 'ORF2110', 'ORF2819']
+
+    # Open the input file and read its lines
+    with open(input_file_path, 'r') as file:
+        lines = file.readlines()
+
+    # Check if the file has more than just the header
+    if len(lines) <= 1:
+        print("Input file does not contain enough data.")
+        return
+
+    # Extract the column headers and find the indices of the genes of interest
+    headers = lines[0].strip().split('\t')
+    gene_indices = [headers.index(gene) for gene in genes_of_interest]
+    serotype_index = headers.index('SEROTYPE')
+
+    # Modify the header to include the new first column
+    modified_header = f"FileName\t{lines[0]}"
+    
+    # Initialize a list to hold the modified lines, starting with the modified header
+    modified_lines = [modified_header]
+
+    # Process each data line in the input file
+    for line in lines[1:]:
+        data = line.strip().split('\t')
+        # Check if the genes of interest are all present (marked as "FULL")
+        if all(data[index] == 'FULL' for index in gene_indices):
+            # Modify the SEROTYPE column to "4b variant"
+            data[serotype_index] = "4b variant"
+        # Prepend the simple name to the line
+        modified_line = f"{simple_name}\t" + '\t'.join(data) + '\n'
+        # Add the modified line to the list
+        modified_lines.append(modified_line)
+
+    # Write the modified lines to the output file
+    with open(output_file_path, 'w') as file:
+        file.writelines(modified_lines)
+
+    print(f'Results written to {output_file_path}')
+
+if __name__ == "__main__":
+    if len(sys.argv) != 4:
+        print("Usage: python script.py <input_file_path> <output_file_path> <simple_name>")
+        sys.exit(1)
+
+    input_file_path = sys.argv[1]
+    output_file_path = sys.argv[2]
+    simple_name = sys.argv[3]
+    identify_variants_with_genes(input_file_path, output_file_path, simple_name)
+