changeset 1:e3a7995dce75 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sarscov2formatter commit 1bd215457a39296c069caa6be30939f4f1bdadeb"
author iuc
date Fri, 20 Nov 2020 18:21:33 +0000
parents 1c664ff29354
children 2e993ff8e7dc
files sarscov2formatter.xml test-data/dups.json test-data/meta.json test-data/test.py test-data/test.tsv
diffstat 5 files changed, 160 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/sarscov2formatter.xml	Mon May 04 05:39:35 2020 -0400
+++ b/sarscov2formatter.xml	Fri Nov 20 18:21:33 2020 +0000
@@ -1,10 +1,10 @@
-<tool id="sarscov2formatter" name="sarscov2formatter" version="0.1" profile="18.01">
+<tool id="sarscov2formatter" name="sarscov2formatter" version="0.5.3+galaxy1" profile="18.01">
     <requirements>
-        <requirement type="package" version="0.5.2">sarscov2formatter</requirement>
+        <requirement type="package" version="0.5.3">sarscov2formatter</requirement>
     </requirements>
     <command><![CDATA[
 sarscov2formatter
--a $align
+-a '$align'
 #if $source.source_choice == 'ncbi':
     -m ncbi
 #else:
@@ -20,7 +20,7 @@
             </param>
             <when value="ncbi" />
             <when value="other" >
-                 <param name="meta" type="data" format='tabular' label="Metadata source" help="Tabular file with metadata with the correct columns (see below)" />
+                 <param name="meta" type="data" format="tabular" label="Metadata source" help="Tabular file with metadata with the correct columns (see below)" />
             </when>
         </conditional>
     </inputs>
@@ -30,13 +30,42 @@
         <data name="outmeta" format="json" from_work_dir="meta.json" label="${tool.name}: Metadata" />
     </outputs>
     <tests>
+        <!-- note: test with ncbi yields unstable results for meta -> assert contents.
+             also needs a surprising amount memory (1.7G) which might
+             become impractival in the future -->
         <test>
             <param name="align" ftype="fasta" value="align.fasta" />
             <param name="source_choice" value="ncbi" />
             <output name="msa" ftype="fasta" compare="diff" value="msa.fasta" />
             <output name="dups" ftype="json" compare="diff" value="dups.json" />
-            <output name="outmeta" ftype="json" compare="diff" value="meta.json" />
+            <output name="outmeta" ftype="json">
+                <assert_contents>
+                    <has_line_matching expression="\{"/>
+                    <has_line_matching expression="\}"/>
+                    <has_text_matching expression='"LR757995": \{'/>
+                    <has_text_matching expression='"collected": '/>
+                    <has_text_matching expression='"collected": '/>
+                    <has_text_matching expression='"location": '/>
+                    <has_text_matching expression='"country": '/>
+                    <has_text_matching expression='"locality": '/>
+                    <has_text_matching expression='"state": '/>
+                    <has_text_matching expression='"subregion": '/>
+                </assert_contents>
+            </output>
         </test>
+        <!-- TODO test with tabular input, does not work yet
+             test.tsv has been generated with test.py
+             https://github.com/nickeener/sarscov2formatter/issues/2 -->
+<!--        <test>-->
+<!--            <param name="align" ftype="fasta" value="align.fasta" />-->
+<!--            <conditional name="source" >-->
+<!--                <param name="source_choice" value="other" />-->
+<!--                <param name="meta" ftype="tabular" value="test.tsv" />-->
+<!--            </conditional>-->
+<!--            <output name="msa" ftype="fasta" compare="diff" value="msa-other.fasta" />-->
+<!--            <output name="dups" ftype="json" compare="diff" value="dups-other.json" />-->
+<!--            <output name="outmeta" ftype="json" compare="diff" value="meta-other.json" />-->
+<!--        </test>-->
     </tests>
         <help><![CDATA[
 
--- a/test-data/dups.json	Mon May 04 05:39:35 2020 -0400
+++ b/test-data/dups.json	Fri Nov 20 18:21:33 2020 +0000
@@ -1,1 +1,68 @@
-{"MultiSeq0_24": {"1": "MT019530", "2": "MT027062", "3": "MT159705", "4": "MT159710", "5": "MT192773", "6": "MT240479", "7": "MT246472", "8": "MT253699", "9": "MT259275", "10": "MT262910", "11": "MT262912", "12": "MT263399", "13": "MT263435", "14": "MT263451", "15": "MT304482", "16": "MT304483", "17": "MT326151", "18": "MT325578", "19": "MT325609", "20": "MT334533", "21": "MT334534", "22": "MT350276"}, "MultiSeq1_15": {"1": "MT276327", "2": "MT293173", "3": "MT293195", "4": "MT326113", "5": "MT326162", "6": "MT326189", "7": "MT325626", "8": "MT345825", "9": "MT345827", "10": "MT345834", "11": "MT345835", "12": "MT345857", "13": "MT344957"}, "MT350282": {"0": "MT350282"}, "MT345866": {"0": "MT345866"}, "MT293207": {"0": "MT293207"}, "MT292573": {"0": "MT292573"}, "MT292570": {"0": "MT292570"}, "MT263469": {"0": "MT263469"}, "MT263450": {"0": "MT263450"}, "MT263436": {"0": "MT263436"}, "MN988713": {"0": "MN988713"}}
\ No newline at end of file
+{
+ "MN988713": {
+  "0": "MN988713"
+ },
+ "MT263436": {
+  "0": "MT263436"
+ },
+ "MT263450": {
+  "0": "MT263450"
+ },
+ "MT263469": {
+  "0": "MT263469"
+ },
+ "MT292570": {
+  "0": "MT292570"
+ },
+ "MT292573": {
+  "0": "MT292573"
+ },
+ "MT293207": {
+  "0": "MT293207"
+ },
+ "MT345866": {
+  "0": "MT345866"
+ },
+ "MT350282": {
+  "0": "MT350282"
+ },
+ "MultiSeq0_24": {
+  "1": "MT019530",
+  "10": "MT262910",
+  "11": "MT262912",
+  "12": "MT263399",
+  "13": "MT263435",
+  "14": "MT263451",
+  "15": "MT304482",
+  "16": "MT304483",
+  "17": "MT326151",
+  "18": "MT325578",
+  "19": "MT325609",
+  "2": "MT027062",
+  "20": "MT334533",
+  "21": "MT334534",
+  "22": "MT350276",
+  "3": "MT159705",
+  "4": "MT159710",
+  "5": "MT192773",
+  "6": "MT240479",
+  "7": "MT246472",
+  "8": "MT253699",
+  "9": "MT259275"
+ },
+ "MultiSeq1_15": {
+  "1": "MT276327",
+  "10": "MT345834",
+  "11": "MT345835",
+  "12": "MT345857",
+  "13": "MT344957",
+  "2": "MT293173",
+  "3": "MT293195",
+  "4": "MT326113",
+  "5": "MT326162",
+  "6": "MT326189",
+  "7": "MT325626",
+  "8": "MT345825",
+  "9": "MT345827"
+ }
+}
\ No newline at end of file
--- a/test-data/meta.json	Mon May 04 05:39:35 2020 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-{"NC_045512": {"collected": "20200117", "location": {"subregion": "Asia", "country": "China", "state": null, "locality": null}}, "MT350282": {"collected": "20200318", "location": {"subregion": "South America", "country": "Brazil", "state": null, "locality": null}}, "MT350276": {"collected": "20200319", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT345866": {"collected": "20200323", "location": {"subregion": "North America", "country": "USA", "state": "ID", "locality": null}}, "MT345857": {"collected": "20200324", "location": {"subregion": "North America", "country": "USA", "state": "ID", "locality": null}}, "MT345835": {"collected": "20200325", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT345834": {"collected": "20200326", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT345827": {"collected": "20200325", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT345825": {"collected": "20200325", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT344957": {"collected": "20200307", "location": {"subregion": "North America", "country": "USA", "state": "PA", "locality": null}}, "MT334534": {"collected": "20200313", "location": {"subregion": "North America", "country": "USA", "state": "UT", "locality": null}}, "MT334533": {"collected": "20200313", "location": {"subregion": "North America", "country": "USA", "state": "UT", "locality": null}}, "MT326189": {"collected": "20200318", "location": {"subregion": "North America", "country": "USA", "state": null, "locality": null}}, "MT326162": {"collected": "20200321", "location": {"subregion": "North America", "country": "USA", "state": null, "locality": null}}, "MT326151": {"collected": "20200321", "location": {"subregion": "North America", "country": "USA", "state": null, "locality": null}}, "MT326113": {"collected": "20200320", "location": {"subregion": "North America", "country": "USA", "state": null, "locality": null}}, "MT325626": {"collected": "20200305", "location": {"subregion": "North America", "country": "USA", "state": "SC", "locality": null}}, "MT325609": {"collected": "20200305", "location": {"subregion": "North America", "country": "USA", "state": "UT", "locality": null}}, "MT325578": {"collected": "20200307", "location": {"subregion": "North America", "country": "USA", "state": "IL", "locality": null}}, "MT304483": {"collected": "20200301", "location": {"subregion": "North America", "country": "USA", "state": "IL", "locality": null}}, "MT304482": {"collected": "20200301", "location": {"subregion": "North America", "country": "USA", "state": "IL", "locality": null}}, "MT293207": {"collected": "20200319", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT293195": {"collected": "20200328", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT293173": {"collected": "20200330", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT292573": {"collected": "20200309", "location": {"subregion": "Europe", "country": "Spain", "state": null, "locality": null}}, "MT292570": {"collected": "20200310", "location": {"subregion": "Europe", "country": "Spain", "state": null, "locality": null}}, "MT276327": {"collected": "20200229", "location": {"subregion": "North America", "country": "USA", "state": "GA", "locality": null}}, "MT263469": {"collected": "20200315", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT263467": {"collected": "20200316", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT263451": {"collected": "20200316", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT263450": {"collected": "20200324", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT263436": {"collected": "20200324", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT263435": {"collected": "20200324", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT263399": {"collected": "20200324", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT262912": {"collected": "20200313", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT262910": {"collected": "20200313", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT259275": {"collected": "20200314", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT253699": {"collected": "20200124", "location": {"subregion": "Asia", "country": "China", "state": "Zhejiang", "locality": "Hangzhou"}}, "MT246472": {"collected": "20200312", "location": {"subregion": "North America", "country": "USA", "state": "WA", "locality": null}}, "MT240479": {"collected": "20200304", "location": {"subregion": "Asia", "country": "Pakistan", "state": "Gilgit", "locality": null}}, "MT192773": {"collected": "20200122", "location": {"subregion": "Asia", "country": "Vietnam", "state": "Ho Chi Minh city", "locality": null}}, "MT159710": {"collected": "20200217", "location": {"subregion": "North America", "country": "USA", "state": null, "locality": null}}, "MT159705": {"collected": "20200217", "location": {"subregion": "North America", "country": "USA", "state": null, "locality": null}}, "MT027062": {"collected": "20200129", "location": {"subregion": "North America", "country": "USA", "state": "CA", "locality": null}}, "MT019530": {"collected": "20191230", "location": {"subregion": "Asia", "country": "China", "state": "Hubei", "locality": "Wuhan"}}, "MN988713": {"collected": "20200121", "location": {"subregion": "North America", "country": "USA", "state": "Illinois", "locality": null}}, "LR757995": {"collected": "20191226", "location": {"subregion": "Asia", "country": "China", "state": "uhan", "locality": null}}}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.py	Fri Nov 20 18:21:33 2020 +0000
@@ -0,0 +1,10 @@
+import json
+
+with open("meta.json") as jh:
+    data = json.load(jh)
+
+print("ID\tcollection_date\tcountry\tstate\tlocality")
+for k in data:
+    collection_date = data[k]['collected']
+    location = data[k]['location']
+    print("%s\t%s\t%s\t%s\t%s" % (k, collection_date, location['country'], location['state'], location['locality']))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.tsv	Fri Nov 20 18:21:33 2020 +0000
@@ -0,0 +1,48 @@
+ID	collection_date	country	state	locality
+LR757995	20191226	China	uhan	None
+MT027062	20200129	USA	CA	None
+MT325626	20200305	USA	SC	None
+MT325609	20200305	USA	UT	None
+MT263436	20200324	USA	WA	None
+MT263435	20200324	USA	WA	None
+MT326162	20200321	USA	None	None
+MT159710	20200217	USA	None	None
+MT259275	20200314	USA	WA	None
+MT325578	20200307	USA	IL	None
+MT276327	20200229	USA	GA	None
+MT345866	20200323	USA	ID	None
+MT345857	20200324	USA	ID	None
+MT192773	20200122	Vietnam	Ho Chi Minh city	None
+MT304482	20200301	USA	IL	None
+MT304483	20200301	USA	IL	None
+MT292573	20200309	Spain	None	None
+MT246472	20200312	USA	WA	None
+MT345835	20200325	USA	WA	None
+MT293195	20200328	USA	WA	None
+MT345827	20200325	USA	WA	None
+MT344957	20200307	USA	PA	None
+MT293173	20200330	USA	WA	None
+NC_045512	20200117	China	None	None
+MT263467	20200316	USA	WA	None
+MT345825	20200325	USA	WA	None
+MT350282	20200318	Brazil	None	None
+MT263469	20200315	USA	WA	None
+MT263399	20200324	USA	WA	None
+MT326113	20200320	USA	None	None
+MT159705	20200217	USA	None	None
+MT326151	20200321	USA	None	None
+MN988713	20200121	USA	Illinois	None
+MT019530	20191230	China	Hubei	Wuhan
+MT350276	20200319	USA	WA	None
+MT240479	20200304	Pakistan	Gilgit	None
+MT253699	20200124	China	Zhejiang	Hangzhou
+MT292570	20200310	Spain	None	None
+MT345834	20200326	USA	WA	None
+MT293207	20200319	USA	WA	None
+MT262912	20200313	USA	WA	None
+MT326189	20200318	USA	None	None
+MT262910	20200313	USA	WA	None
+MT334534	20200313	USA	UT	None
+MT263451	20200316	USA	WA	None
+MT263450	20200324	USA	WA	None
+MT334533	20200313	USA	UT	None