changeset 5:0e556a3f85d6 draft

planemo upload for repository https://github.com/pvanheus/polio_report commit a99e10fec2fac5aae70974c977eb3b362a1a8429-dirty
author sanbi-uwc
date Wed, 14 Sep 2022 09:21:44 +0000
parents 1897677e107c
children ca5b3e9740b9
files assess_alignment.py assess_poliovirus_alignment.xml
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/assess_alignment.py	Fri Jul 22 09:55:46 2022 +0000
+++ b/assess_alignment.py	Wed Sep 14 09:21:44 2022 +0000
@@ -145,11 +145,13 @@
 if __name__ == "__main__":
     parser = argparse.ArgumentParser()
     parser.add_argument("--output_filename", help="Path to output file")
+    parser.add_argument("--consensus_output_filename", help="Path to output file for best consensus")
     parser.add_argument("--sample_name", help="Name of sample being analysed")
     parser.add_argument(
         "--dataset_names", type=comma_split, help="Comma separated names for datasets"
     )
     parser.add_argument("--datasets", nargs="+")
+    parser.add_argument("--consensi", nargs="+")
     args = parser.parse_args()
 
     offsets = {
@@ -182,6 +184,7 @@
             best_match_mismatch_list = mismatch_list
             best_match_quality = quality
             best_match_reference = dataset_name
+            best_consensus = args.consensi[file_index]
             percent_mismatches = round(min_mismatches / lengths[best_match_reference] * 100, 2)
 
     info = {
@@ -190,6 +193,8 @@
         "mismatches": min_mismatches,
         "mismatch_list": best_match_mismatch_list,
         "quality": best_match_quality,
-        "perc_mismatches": percent_mismatches
+        "perc_mismatches": percent_mismatches,
     }
     json.dump(info, open(args.output_filename, "w"))
+
+    open(args.consensus_output_filename, "w").write(best_consensus)
--- a/assess_poliovirus_alignment.xml	Fri Jul 22 09:55:46 2022 +0000
+++ b/assess_poliovirus_alignment.xml	Wed Sep 14 09:21:44 2022 +0000
@@ -1,4 +1,4 @@
-<tool id="assess_poliovirus_alignment" name="Assess poliovirus alignment" version="0.3.0+galaxy0" profile="21.05">
+<tool id="assess_poliovirus_alignment" name="Assess poliovirus alignment" version="0.4.0+galaxy0" profile="21.05">
     <requirements>
         <requirement type="package" version="3.9">python</requirement>
     </requirements>
@@ -7,11 +7,16 @@
         python $__tool_directory__/assess_alignment.py 
             --dataset_names '$dataset_names'
             --output_filename '$output1'
+            --consensus_output_filename '$output_consensus'
             --sample_name '$tracy_results.name'
             --datasets
         #for $dataset in $tracy_results
              '$dataset' 
         #end for
+            --consensi
+        #for $consensus in $tracy_consensus_results
+            '$consensus'
+        #end for
 
     ]]></command>
     <inputs>
@@ -20,9 +25,10 @@
     </inputs>
     <outputs>
         <data name="output1" format="json" label="Poliovirus alignment assessment on ${on_string}" />
+        <data name="output_consensus" format="fasta" label="Poliovirus best consensus on ${on_string}" />
     </outputs>
     <tests>
-        <test expect_num_outputs="1">
+        <test expect_num_outputs="2">
             <param name="tracy_results" ftype="json">
                 <collection type="list">
                     <element name="poliovirus1sabin" value="sample1/poliovirus1sabin.json" />