aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreaGuarracino2021-01-06 14:09:59 +0100
committerAndreaGuarracino2021-01-06 14:09:59 +0100
commit430090a65786b0b9dde9e1319a740f95579d0275 (patch)
tree0d59bcb0e4ca0986b42cda966fec60df02ab8686
parente9f73388c810c678a69ce23c925d7914ba99a251 (diff)
downloadbh20-seq-resource-430090a65786b0b9dde9e1319a740f95579d0275.tar.gz
bh20-seq-resource-430090a65786b0b9dde9e1319a740f95579d0275.tar.lz
bh20-seq-resource-430090a65786b0b9dde9e1319a740f95579d0275.zip
avoided using resource_stream, now check_format.py works in CWL
-rw-r--r--workflows/yamlfa2ttl/check_format.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/workflows/yamlfa2ttl/check_format.py b/workflows/yamlfa2ttl/check_format.py
index a1b1f14..4472b18 100644
--- a/workflows/yamlfa2ttl/check_format.py
+++ b/workflows/yamlfa2ttl/check_format.py
@@ -1,22 +1,18 @@
import gzip
import tempfile
-import pkg_resources
import magic
import io
-
import sys
path_fasta = sys.argv[1]
format_to_check = sys.argv[2]
path_valid_formats = sys.argv[3]
-
-# ../../bh20sequploader/validation/formats
-
-schema_resource = pkg_resources.resource_stream(__name__, path_valid_formats)
with tempfile.NamedTemporaryFile() as tmp:
- tmp.write(schema_resource.read())
+ with open(path_valid_formats, 'rb') as f:
+ tmp.write(f.read())
tmp.flush()
+
check_format = magic.Magic(magic_file=tmp.name, uncompress=False, mime=True)
with open(path_fasta, "rb") as f: