[med-svn] [Git][med-team/spades][master] Refactored patch for bwa which()
Lance Lin (@linqigang)
gitlab at salsa.debian.org
Tue May 10 14:20:40 BST 2022
Lance Lin pushed to branch master at Debian Med / spades
Commits:
28eac96c by Lance Lin at 2022-05-10T20:20:05+07:00
Refactored patch for bwa which()
- - - - -
2 changed files:
- debian/changelog
- debian/patches/0003_accept-system-bwa.patch
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+spades (3.15.4+dfsg-2) UNRELEASED; urgency=medium
+
+ [ Lance Lin ]
+ * d/patches/0003_accept-system-bwa.patch - refactored 'which'
+ Closes: #1010788
+
+ -- Lance Lin <LQi254 at protonmail.com> Tue, 10 May 2022 20:15:40 +0700
+
spades (3.15.4+dfsg-1) unstable; urgency=medium
[ Michael R. Crusoe ]
=====================================
debian/patches/0003_accept-system-bwa.patch
=====================================
@@ -54,31 +54,6 @@ Description: Enable using Debian packaged bwa instead of bwa-spades
def check_file_existence(input_filename, message="", log=None):
---- a/assembler/spades.py
-+++ b/assembler/spades.py
-@@ -163,6 +163,22 @@ def print_used_values(cfg, log):
- print_value(cfg, "common", "max_memory", "Memory limit (in Gb)", " ")
- log.info("")
-
-+def which(program):
-+ def is_exe(fpath):
-+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
-+
-+ fpath, fname = os.path.split(program)
-+ if fpath:
-+ if is_exe(program):
-+ return program
-+ else:
-+ for path in os.environ["PATH"].split(os.pathsep):
-+ path = path.strip('"')
-+ exe_file = os.path.join(path, program)
-+ if is_exe(exe_file):
-+ return exe_file
-+
-+ return None
-
- def create_logger():
- log = logging.getLogger("spades")
--- a/assembler/src/spades_pipeline/options_parser.py
+++ b/assembler/src/spades_pipeline/options_parser.py
@@ -992,7 +992,10 @@ def add_to_cfg(cfg, log, bin_home, spade
@@ -86,47 +61,24 @@ Description: Enable using Debian packaged bwa instead of bwa-spades
cfg["mismatch_corrector"] = empty_config()
cfg["mismatch_corrector"].__dict__["skip-masked"] = None
- cfg["mismatch_corrector"].__dict__["bwa"] = os.path.join(bin_home, "spades-bwa")
-+ if which("bwa-spades"):
++ if support.which("bwa-spades"):
+ cfg["mismatch_corrector"].__dict__["bwa"] = os.path.join(bin_home, "bwa-spades")
+ else:
-+ cfg["mismatch_corrector"].__dict__["bwa"] = which("bwa")
++ cfg["mismatch_corrector"].__dict__["bwa"] = support.which("bwa")
cfg["mismatch_corrector"].__dict__["threads"] = args.threads
cfg["mismatch_corrector"].__dict__["output-dir"] = args.output_dir
cfg["run_truseq_postprocessing"] = options_storage.run_truseq_postprocessing
--- a/assembler/src/spades_pipeline/scripts/postprocessing_script.py
+++ b/assembler/src/spades_pipeline/scripts/postprocessing_script.py
-@@ -45,6 +45,22 @@ def parse_args():
- action="store")
- return parser.parse_args()
-
-+def which(program):
-+ def is_exe(fpath):
-+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
-+
-+ fpath, fname = os.path.split(program)
-+ if fpath:
-+ if is_exe(program):
-+ return program
-+ else:
-+ for path in os.environ["PATH"].split(os.pathsep):
-+ path = path.strip('"')
-+ exe_file = os.path.join(path, program)
-+ if is_exe(exe_file):
-+ return exe_file
-+
-+ return None
-
- def main():
- args = parse_args()
@@ -78,7 +94,10 @@ def main():
# run command
if isfile(args.result_scaffolds_filename):
shutil.move(args.result_scaffolds_filename, args.assembled_scaffolds_filename)
- alignment_bin = os.path.join(args.bin_home, "spades-bwa")
-+ if which("bwa-spades"):
-+ alignment_bin = which("bwa-spades")
++ if support.which("bwa-spades"):
++ alignment_bin = support.which("bwa-spades")
+ else:
-+ alignment_bin = which("bwa")
++ alignment_bin = support.which("bwa")
alignment_dir = os.path.join(args.output_dir, "alignment")
sam_files = alignment.align_bwa(alignment_bin, args.assembled_scaffolds_filename,
dataset_data, alignment_dir, log, args.threads)
View it on GitLab: https://salsa.debian.org/med-team/spades/-/commit/28eac96c2c84b580ae48da1085bb1df159f73bc8
--
View it on GitLab: https://salsa.debian.org/med-team/spades/-/commit/28eac96c2c84b580ae48da1085bb1df159f73bc8
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220510/b3a588fe/attachment-0001.htm>
More information about the debian-med-commit
mailing list