[med-svn] [qcumber] 01/01: check whether reference file is a valid fasta file
Andreas Tille
tille at debian.org
Thu Feb 23 15:09:59 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository qcumber.
commit 56a71c870c2d3903805b78fe77b8969f49f07c6a
Author: Andreas Tille <tille at debian.org>
Date: Thu Feb 23 16:02:01 2017 +0100
check whether reference file is a valid fasta file
---
debian/changelog | 6 ++++++
debian/patches/check_fasta.patch | 38 ++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 45 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 0167d28..e523759 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+qcumber (1.0.5+dfsg-2) UNRELEASED; urgency=medium
+
+ * Check reference file for valid fasta
+
+ -- Andreas Tille <tille at debian.org> Thu, 23 Feb 2017 14:59:46 +0100
+
qcumber (1.0.5+dfsg-1) unstable; urgency=medium
* Initial release (Closes: #855211)
diff --git a/debian/patches/check_fasta.patch b/debian/patches/check_fasta.patch
new file mode 100644
index 0000000..cd807ee
--- /dev/null
+++ b/debian/patches/check_fasta.patch
@@ -0,0 +1,38 @@
+--- a/QCumber.py
++++ b/QCumber.py
+@@ -29,6 +29,24 @@ r1_pattern = parameter["Pattern"]["R1"]
+ r2_pattern = parameter["Pattern"]["R2"]
+ lane_pattern = parameter["Pattern"]["lane"]
+
++from sys import stderr
++from Bio import SeqIO
++
++def check_fasta(fastafile, filetype='File'):
++ seq_record = SeqIO.parse(fastafile, "fasta")
++ try:
++ for seq in seq_record:
++ break # break after first sequence
++ except FileNotFoundError as err:
++ print("%s %s does not exist" % (filetype, fastafile), file=stderr)
++ return False
++ try:
++ s=str(seq) # we somehow need to touch the sequence element to trigger an error or not
++ return True
++ except:
++ print('%s %s does not contain valid fasta data' % (filetype, fastafile), file=stderr)
++ return False
++
+ def get_illumina_reads( output, tmp):
+ ## Add readsets to sample
+ readsets = []
+@@ -271,8 +289,8 @@ def main(arguments):
+ if not arguments["reference"]:
+ sys.exit("Mapping needs a reference.")
+ else:
+- if not os.path.exists(arguments["reference"]):
+- sys.exit("Reference does not exist.")
++ if not check_fasta(arguments["reference"],"Reference"):
++ sys.exit(1)
+
+ if not arguments["nokraken"]:
+ if not os.path.exists(arguments["db"]):
diff --git a/debian/patches/series b/debian/patches/series
index 56c9d55..e06dd47 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
set_absolute_path_to_tex_template.patch
adapt_config.patch
+check_fasta.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/qcumber.git
More information about the debian-med-commit
mailing list