changeset 120:af482048ca1a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 59fe39774d791bc684811b6ce03e13ef093d074e
author fubar
date Tue, 24 Sep 2024 03:57:09 +0000
parents 2fff478aca4b
children 478ee3e780de
files __pycache__/jbrowse2.cpython-312.pyc foo foo.tbi jbrowse2.py test-data/vcf/merlin.vcf.2 test-data/vcf/merlinold.vcf
diffstat 6 files changed, 52 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
Binary file __pycache__/jbrowse2.cpython-312.pyc has changed
Binary file foo has changed
Binary file foo.tbi has changed
--- a/jbrowse2.py	Sat Sep 21 06:13:01 2024 +0000
+++ b/jbrowse2.py	Tue Sep 24 03:57:09 2024 +0000
@@ -10,6 +10,7 @@
 import re
 import shutil
 import ssl
+import string
 import struct
 import subprocess
 import tempfile
@@ -1600,7 +1601,8 @@
     args = parser.parse_args()
     tree = ET.parse(args.xml)
     root = tree.getroot()
-
+    removeMe = string.punctuation.replace('.','').replace('/','').replace('-','')
+    nopunct = str.maketrans(dict.fromkeys(removeMe))
     # This should be done ASAP
     GALAXY_INFRASTRUCTURE_URL = root.find("metadata/galaxyUrl").text
     # Sometimes this comes as `localhost` without a protocol
@@ -1617,7 +1619,7 @@
         genomes = [
             {
                 "path": x.attrib["path"],
-                "label": x.attrib["label"].split(" ")[0].replace(",", ""),
+                "label": x.attrib["label"].split(" ")[0].translate(nopunct),
                 "useuri": x.attrib["useuri"],
                 "meta": metadata_from_node(x.find("metadata")),
             }
@@ -1655,7 +1657,7 @@
                     if x.attrib['ext'] == "bed":
                         isBed = True
                     track_conf["label"] = "%s_%d" % (
-                        x.attrib["label"].replace(" ", "_").replace(",", "_").replace("/", "_"),
+                        x.attrib["label"].translate(nopunct),
                         trackI,
                     )
                     trackI += 1
@@ -1663,7 +1665,7 @@
                     if is_multi_bigwig:
                         multi_bigwig_paths.append(
                             (
-                                track_conf["label"],
+                                track_conf["label"].translate(nopunct),
                                 track_conf["useuri"],
                                 os.path.realpath(x.attrib["path"]),
                             )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/vcf/merlin.vcf.2	Tue Sep 24 03:57:09 2024 +0000
@@ -0,0 +1,23 @@
+##fileformat=VCFv4.0
+##fileDate=20090805
+##source=myImputationProgramV3.1
+##reference=1000GenomesPilot-NCBI36
+##phasing=partial
+##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AF,Number=.,Type=Float,Description="Allele Frequency">
+##INFO=<ID=AA,Number=1,Type=String,Description="Ancestral Allele">
+##INFO=<ID=DB,Number=0,Type=Flag,Description="dbSNP membership, build 129">
+##INFO=<ID=H2,Number=0,Type=Flag,Description="HapMap2 membership">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=s50,Description="Less than 50% of samples have data">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=HQ,Number=2,Type=Integer,Description="Haplotype Quality">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+Merlin	14370	rs6054257	G	A	29	PASS	NS=3;DP=14;AF=0.5;DB;H2	GT:GQ:DP:HQ	0|0:48:1:51,51	1|0:48:8:51,51	1/1:43:5:.,.
+Merlin	17330	.	T	A	3	q10	NS=3;DP=11;AF=0.017	GT:GQ:DP:HQ	0|0:49:3:58,50	0|1:3:5:65,3	0/0:41:3
+Merlin	1110696	rs6040355	A	G,T	67	PASS	NS=2;DP=10;AF=0.333,0.667;AA=T;DB	GT:GQ:DP:HQ	1|2:21:6:23,27	2|1:2:0:18,2	2/2:35:4
+Merlin	1230237	.	T	.	47	PASS	NS=3;DP=13;AA=T	GT:GQ:DP:HQ	0|0:54:7:56,60	0|0:48:4:51,51	0/0:61:2
+Merlin	1234567	microsat1	GTCT	G,GTACT	50	PASS	NS=3;DP=9;AA=G	GT:GQ:DP	0/1:35:4	0/2:17:2	1/1:40:3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/vcf/merlinold.vcf	Tue Sep 24 03:57:09 2024 +0000
@@ -0,0 +1,23 @@
+##fileformat=VCFv4.0
+##fileDate=20090805
+##source=myImputationProgramV3.1
+##reference=1000GenomesPilot-NCBI36
+##phasing=partial
+##INFO=<ID=NS,Number=1,Type=Integer,Description="Number	of	Samples	With	Data">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total	Depth">
+##INFO=<ID=AF,Number=.,Type=Float,Description="Allele	Frequency">
+##INFO=<ID=AA,Number=1,Type=String,Description="Ancestral	Allele">
+##INFO=<ID=DB,Number=0,Type=Flag,Description="dbSNP	membership,	build	129">
+##INFO=<ID=H2,Number=0,Type=Flag,Description="HapMap2	membership">
+##FILTER=<ID=q10,Description="Quality	below	10">
+##FILTER=<ID=s50,Description="Less	than	50%	of	samples	have	data">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype	Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read	Depth">
+##FORMAT=<ID=HQ,Number=2,Type=Integer,Description="Haplotype	Quality">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+Merlin	61	rs6054257	G	A	29	PASS	NS=3;DP=14;AF=0.5;DB;H2	GT:GQ:DP:HQ	0|0:48:1:51,51	1|0:48:8:51,51	1/1:43:5:.,.
+Merlin	122	.	T	A	3	q10	NS=3;DP=11;AF=0.017	GT:GQ:DP:HQ	0|0:49:3:58,50	0|1:3:5:65,3	0/0:41:3
+Merlin	488	rs6040355	A	G,T	67	PASS	NS=2;DP=10;AF=0.333,0.667;AA=T;DB	GT:GQ:DP:HQ	1|2:21:6:23,27	2|1:2:0:18,2	2/2:35:4
+Merlin	549	.	T	.	47	PASS	NS=3;DP=13;AA=T	GT:GQ:DP:HQ	0|0:54:7:56,60	0|0:48:4:51,51	0/0:61:2
+Merlin	1098	microsat1		G,GTACT	50	PASS	NS=3;DP=9;AA=G	GT:GQ:DP	0/1:35:4	0/2:17:2	1/1:40:3