diff options
author | Peter Amstutz | 2020-07-07 20:41:11 +0000 |
---|---|---|
committer | Peter Amstutz | 2020-07-07 20:41:11 +0000 |
commit | 54e0ce85ef3abafb8870ef5a9244a03f16b5e3f5 (patch) | |
tree | 69373d65f2355e1b1528f94c133ad5df9ed7cf92 | |
parent | 7cf561c1b92a44d488d36dd3d883750b261c6550 (diff) | |
download | bh20-seq-resource-54e0ce85ef3abafb8870ef5a9244a03f16b5e3f5.tar.gz bh20-seq-resource-54e0ce85ef3abafb8870ef5a9244a03f16b5e3f5.tar.lz bh20-seq-resource-54e0ce85ef3abafb8870ef5a9244a03f16b5e3f5.zip |
minimap2 returns nothing when there is no alignment.
-rw-r--r-- | bh20sequploader/qc_fasta.py | 15 | ||||
-rw-r--r-- | scripts/docker/Dockerfile | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/bh20sequploader/qc_fasta.py b/bh20sequploader/qc_fasta.py index b08333e..37eb4e8 100644 --- a/bh20sequploader/qc_fasta.py +++ b/bh20sequploader/qc_fasta.py @@ -70,16 +70,19 @@ def qc_fasta(arg_sequence, check_with_clustalw=True): similarity = 0 try: cmd = ["minimap2", "-c", tmp1.name, tmp2.name] - print("QC checking similarity to reference") - print(" ".join(cmd)) + logging.info("QC checking similarity to reference") + logging.info(" ".join(cmd)) result = subprocess.run(cmd, stdout=subprocess.PIPE) + result.check_returncode() res = result.stdout.decode("utf-8") mm = res.split("\t") - print(mm) - # divide Number of matching bases in the mapping / Target sequence length - similarity = (float(mm[9]) / float(mm[6])) * 100.0 + if len(mm) >= 10: + # divide Number of matching bases in the mapping / Target sequence length + similarity = (float(mm[9]) / float(mm[6])) * 100.0 + else: + similarity = 0 except Exception as e: - logging.warn("QC against reference sequence using 'minimap2': %s", e) + logging.warn("QC against reference sequence using 'minimap2': %s", e, exc_info=e) if similarity and similarity < 70.0: raise ValueError("QC fail: alignment to reference was less than 70%% (was %2.2f%%)" % (similarity)) diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile index 8811927..02829d4 100644 --- a/scripts/docker/Dockerfile +++ b/scripts/docker/Dockerfile @@ -3,7 +3,7 @@ FROM debian:10 RUN apt-get update && \ apt-get -yq --no-install-recommends -o Acquire::Retries=6 install \ python3 python3-pip python3-setuptools python3-dev python-pycurl \ - clustalw python3-biopython libcurl4-openssl-dev build-essential \ + minimap2 python3-biopython libcurl4-openssl-dev build-essential \ libssl-dev libmagic-dev python3-magic && \ apt-get clean |