[med-svn] [qcumber] 02/04: New upstream version 1.0.11+dfsg

Andreas Tille tille at debian.org
Tue Mar 14 10:04:06 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 3697eb3fec6b086d9c7b6bd76b8eaff0a5144fe3
Author: Andreas Tille <tille at debian.org>
Date:   Tue Mar 14 11:03:27 2017 +0100

    New upstream version 1.0.11+dfsg
---
 QCumber.py | 75 ++++++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 49 insertions(+), 26 deletions(-)

diff --git a/QCumber.py b/QCumber.py
index fe7cfdb..e426531 100755
--- a/QCumber.py
+++ b/QCumber.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 __author__ = 'LieuV'
-__version__ = "1.0.10"
+__version__ = "1.0.11"
 
 from classes import *
 from helper import *
@@ -34,45 +34,68 @@ global lane_pattern
 
 def get_illumina_reads(tmp):
 	readsets = []
-
-	# split by lanes
-	for lane in sorted(set([re.search(lane_pattern, x).group() for x in arguments["r1"]])):
-		# concat same lanes
-		r1_reads = [x for x in arguments["r1"] if lane in x]
-		readname = re.sub(r1_pattern + ".*", "", os.path.basename(r1_reads[0]))
+	if not all([re.search(lane_pattern, x) for x in arguments["r1"]]):
+		readname = re.sub(r1_pattern + ".*", "", os.path.basename(arguments["r1"][0]))
 		if len(arguments["r1"]) != 1:
-			r1 = FastQFile(join_reads(r1_reads, tmp, readname + "_R1"), [toLatex(os.path.basename(x)) for x in r1_reads]  )
+			r1 = FastQFile(join_reads(arguments["r1"], tmp, readname + "_R1"),
+			               [toLatex(os.path.basename(x)) for x in arguments["r1"]])
 		else:
-			r1 = FastQFile(r1_reads[0])
+			r1 = FastQFile(arguments["r1"][0])
 		if arguments["r2"]:
-			r2_reads = [x for x in arguments["r2"] if lane in x]
-
-			if len(r2_reads) != 1:
-				r2 = FastQFile(join_reads(r2_reads, tmp, readname + "_R2"),[toLatex(os.path.basename(x)) for x in r2_reads] )
+			if len(arguments["r2"]) != 1:
+				r2 = FastQFile(join_reads(arguments["r2"], tmp, readname + "_R2"),
+				               [toLatex(os.path.basename(x)) for x in arguments["r2"]])
 			else:
-				r2 = FastQFile(r2_reads[0])
-			readsets.append(ReadSet(r1,r2))
+				r2 = FastQFile(arguments["r2"][0])
+			readsets.append(ReadSet(r1, r2))
 		else:
 			readsets.append(ReadSet(r1))
-	return readsets
 
-def get_input():
+	else:
+		# split by lanes
+		for lane in sorted(set([re.search(lane_pattern, x).group() for x in arguments["r1"]])):
+			# concat same lanes
+			r1_reads = [x for x in arguments["r1"] if lane in x]
+			readname = re.sub(r1_pattern + ".*", "", os.path.basename(r1_reads[0]))
+			if len(arguments["r1"]) != 1:
+				r1 = FastQFile(join_reads(r1_reads, tmp, readname + "_R1"), [toLatex(os.path.basename(x)) for x in r1_reads]  )
+			else:
+				r1 = FastQFile(r1_reads[0])
+			if arguments["r2"]:
+				r2_reads = [x for x in arguments["r2"] if lane in x]
 
-	if arguments["r1"]:
-		if arguments["r2"]:
-			return [arguments["r1"], arguments["r2"]]
-		else:
-			return [arguments["r1"]]
+				if len(r2_reads) != 1:
+					r2 = FastQFile(join_reads(r2_reads, tmp, readname + "_R2"),[toLatex(os.path.basename(x)) for x in r2_reads] )
+				else:
+					r2 = FastQFile(r2_reads[0])
+				readsets.append(ReadSet(r1,r2))
+			else:
+				readsets.append(ReadSet(r1))
+	return readsets
 
+def get_input():
 	all_files = []
 	bam_ext = [x.strip(" ") for x in parameter["Fileextension"]["bam"].split(",")]
 	fastq_ext = [x.strip(" ") for x in parameter["Fileextension"]["fastq"].split(",")]
+
 	if arguments["technology"]:
 		if arguments["technology"]=="IonTorrent":
 			fastq_ext = []
 		else:
 			bam_ext = []
 
+	if arguments["r1"]:
+		if not arguments["technology"]:
+			if any([arguments["r1"].endswith(ext) for ext in bam_ext]):
+				arguments["technology"] = "IonTorrent"
+			else:
+				arguments["technology"] = "Illumina"
+		if arguments["r2"]:
+			return [[[arguments["r1"]], [arguments["r2"]]]]
+		else:
+			return [[[arguments["r1"]]]]
+
+
 	for root, dirs, files in os.walk(arguments["input"]):
 		for file in files:
 			if any([file.endswith(ext) for ext in fastq_ext + bam_ext ]):
@@ -110,7 +133,7 @@ def get_input():
 					paired_reads.append(r1_reads)
 		return paired_reads
 	else: # treat each file as sample
-		return [[x] for x in all_files ]
+		return [[[x]] for x in all_files ]
 
 
 def getSetname():
@@ -262,11 +285,11 @@ def check_input_validity():
 		if not os.path.exists(arguments["input"]):
 			sys.exit(arguments["input"] + " does not exist.")
 	else:
-		if not os.path.exists(arguments["r1"]):
-			sys.exit(arguments["r1"] + " does not exist.Input file required. Use option -input or -1 / -2")
+		if not os.path.isfile(arguments["r1"]):
+			sys.exit(arguments["r1"] + " does not exist. Input file required. Use option -input or -1 / -2.")
 
 		if arguments["r2"]:
-			if not os.path.exists(arguments["r2"]):
+			if not os.path.isfile(arguments["r2"]):
 				sys.exit(arguments["r2"] + " does not exist.")
 
 def get_defaults():

-- 
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