[med-svn] [Git][med-team/unicycler][upstream] New upstream version 0.5.1+dfsg
Michael R. Crusoe (@crusoe)
gitlab at salsa.debian.org
Mon Nov 25 13:14:30 GMT 2024
Michael R. Crusoe pushed to branch upstream at Debian Med / unicycler
Commits:
0ab543f9 by Michael R. Crusoe at 2024-11-25T13:55:23+01:00
New upstream version 0.5.1+dfsg
- - - - -
8 changed files:
- test/test_assembly_graph_copy_depth.py
- test/test_misc.py
- test/test_spades_func.py
- unicycler/assembly_graph_copy_depth.py
- unicycler/misc.py
- unicycler/spades_func.py
- unicycler/unicycler.py
- unicycler/version.py
Changes:
=====================================
test/test_assembly_graph_copy_depth.py
=====================================
@@ -48,7 +48,6 @@ class TestCopyDepth(unittest.TestCase):
"""
Tests a particular part of the graph with merging and splitting.
"""
- print(self.graph.copy_depths)
self.assertEqual(len(self.graph.copy_depths[67]), 1)
self.assertEqual(len(self.graph.copy_depths[165]), 1)
self.assertEqual(len(self.graph.copy_depths[174]), 1)
=====================================
test/test_misc.py
=====================================
@@ -381,4 +381,7 @@ class TestMiscFunctions(unittest.TestCase):
self.assertEqual(unicycler.misc.spades_status_from_version('3.15.3'), 'good')
def test_spades_version_status_13(self):
- self.assertEqual(unicycler.misc.spades_status_from_version('4.0.0'), 'too new')
+ self.assertEqual(unicycler.misc.spades_status_from_version('4.0.0'), 'good')
+
+ def test_spades_version_status_14(self):
+ self.assertEqual(unicycler.misc.spades_status_from_version('5.0.0'), 'too new')
=====================================
test/test_spades_func.py
=====================================
@@ -49,43 +49,50 @@ class TestSPAdesFunc(unittest.TestCase):
def test_build_spades_command_1(self):
command = unicycler.spades_func.build_spades_command('spades.py', 'out', 16, [21, 31, 41],
0, '1.fq.gz', '2.fq.gz', None, True,
- False, None)
+ False, None, '3.15.5')
self.assertEqual(command, ['spades.py', '-o', 'out', '-k', '21', '--threads', '16',
'--isolate', '-1', '1.fq.gz', '-2', '2.fq.gz', '-m', '1024'])
def test_build_spades_command_2(self):
command = unicycler.spades_func.build_spades_command('spades.py', 'out', 16, [21, 31, 41],
1, '1.fq.gz', '2.fq.gz', None, True,
- False, None)
+ False, None, '3.15.5')
self.assertEqual(command, ['spades.py', '-o', 'out', '-k', '21,31', '--threads', '16',
'--restart-from', 'k21', '-m', '1024'])
def test_build_spades_command_3(self):
command = unicycler.spades_func.build_spades_command('spades.py', 'out', 16, [21, 31, 41],
2, '1.fq.gz', '2.fq.gz', None, True,
- False, None)
+ False, None, '3.15.5')
self.assertEqual(command, ['spades.py', '-o', 'out', '-k', '21,31,41', '--threads', '16',
'--restart-from', 'k31', '-m', '1024'])
def test_build_spades_command_4(self):
command = unicycler.spades_func.build_spades_command('spades.py', 'out', 16, [21, 31, 41],
0, None, None, 's.fq.gz', False, True,
- None)
+ None, '3.15.5')
self.assertEqual(command, ['spades.py', '-o', 'out', '-k', '21', '--threads', '16',
'--isolate', '-s', 's.fq.gz', '-m', '1024'])
def test_build_spades_command_5(self):
command = unicycler.spades_func.build_spades_command('spades.py', 'out', 16, [21, 31, 41],
0, '1.fq.gz', '2.fq.gz', None, True,
- False, '-m 123')
+ False, '-m 123', '3.15.5')
self.assertEqual(command, ['spades.py', '-o', 'out', '-k', '21', '--threads', '16',
'--isolate', '-1', '1.fq.gz', '-2', '2.fq.gz', '-m', '123'])
def test_build_spades_command_6(self):
command = unicycler.spades_func.build_spades_command('spades.py', 'out', 16, [21, 31, 41],
0, '1.fq.gz', '2.fq.gz', None, True,
- False, '--tmp-dir abc')
+ False, '--tmp-dir abc', '3.15.5')
self.assertEqual(command, ['spades.py', '-o', 'out', '-k', '21', '--threads', '16',
'--isolate', '-1', '1.fq.gz', '-2', '2.fq.gz', '--tmp-dir',
'abc', '-m', '1024'])
+ def test_build_spades_command_7(self):
+ command = unicycler.spades_func.build_spades_command('spades.py', 'out', 16, [21, 31, 41],
+ 0, '1.fq.gz', '2.fq.gz', None, True,
+ False, None, '4.0.0')
+ self.assertEqual(command, ['spades.py', '-o', 'out', '-k', '21', '--threads', '16',
+ '--gfa11', '--isolate', '-1', '1.fq.gz', '-2', '2.fq.gz',
+ '-m', '1024'])
=====================================
unicycler/assembly_graph_copy_depth.py
=====================================
@@ -101,7 +101,10 @@ def determine_copy_depth_part_2(graph, tolerance, copy_depth_table):
if log.logger.stdout_verbosity_level >= 3:
copy_depth_table.append(['SPLITTING MULTIPLICITY', '', ''])
if redistribute_copy_depths(graph, tolerance, copy_depth_table):
- determine_copy_depth_part_2(graph, tolerance, copy_depth_table)
+ try:
+ determine_copy_depth_part_2(graph, tolerance, copy_depth_table)
+ except RecursionError:
+ pass
def assign_single_copy_depth(graph, min_single_copy_length, copy_depth_table):
=====================================
unicycler/misc.py
=====================================
@@ -638,7 +638,7 @@ def print_table(table, alignments='', max_col_width=30, col_separation=3, indent
for text, colour_name in sub_colour.items():
row_str = row_str.replace(text, colour(text, colour_name))
if j < row_rows - 1 and UNDERLINE in row_str:
- row_str = re.sub('\033\[4m', '', row_str)
+ row_str = re.sub('\033\\[4m', '', row_str)
if return_str:
full_table_str += indenter + row_str + '\n'
else:
@@ -740,8 +740,8 @@ def remove_formatting(text):
def get_ascii_art():
ascii_art = (bold_red(" __\n") +
- bold_red(" \ \___\n") +
- bold_red(" \ ___\\\n") +
+ bold_red(" \\ \\___\n") +
+ bold_red(" \\ ___\\\n") +
bold_red(" //\n") +
bold_red(" ____// ") +
bold_yellow("_ _ _ _\n") +
@@ -750,11 +750,11 @@ def get_ascii_art():
bold_red("// \\// \\\\ ") +
bold_yellow("| | | | _ __ _ ___ _ _ ___ | | ___ _ __\n") +
bold_red("|| (O) || ") +
- bold_yellow("| | | || '_ \ | | / __|| | | | / __|| | / _ \| '__|\n") +
- bold_red("\\\\ \_ // ") +
+ bold_yellow("| | | || '_ \\ | | / __|| | | | / __|| | / _ \\| '__|\n") +
+ bold_red("\\\\ \\_ // ") +
bold_yellow("| |__| || | | || || (__ | |_| || (__ | || __/| |\n") +
bold_red(" \\\\_____// ") +
- bold_yellow("\____/ |_| |_||_| \___| \__, | \___||_| \___||_|\n") +
+ bold_yellow("\\____/ |_| |_||_| \\___| \\__, | \\___||_| \\___||_|\n") +
bold_yellow(" __/ |\n") +
bold_yellow(" |___/"))
return ascii_art
@@ -812,7 +812,7 @@ def spades_path_and_version(spades_path):
if 'python version' in out and 'is not supported' in out:
return found_spades_path, '', 'Python problem'
- # Make sure SPAdes is 3.13.1 or later
+ # Make sure SPAdes is 3.14.0 or later
try:
status = spades_status_from_version(version)
except (ValueError, IndexError):
@@ -844,15 +844,15 @@ def spades_status_from_version(version):
major_version = int(version.split('.')[0])
if major_version < 3:
return 'too old'
- if major_version >= 4:
+ if major_version >= 5:
return 'too new'
- assert major_version == 3
+ assert major_version == 3 or major_version == 4
- minor_version = int(version.split('.')[1])
- if minor_version < 14:
- return 'too old'
- else:
- return 'good'
+ if major_version == 3:
+ minor_version = int(version.split('.')[1])
+ if minor_version < 14:
+ return 'too old'
+ return 'good'
def racon_path_and_version(racon_path):
=====================================
unicycler/spades_func.py
=====================================
@@ -32,7 +32,7 @@ class BadFastq(Exception):
def get_best_spades_graph(short1, short2, short_unpaired, out_dir, read_depth_filter, verbosity,
spades_path, threads, keep, kmer_count, min_k_frac, max_k_frac, kmers,
expected_linear_seqs, largest_component, spades_graph_prefix,
- spades_options):
+ spades_options, spades_version):
"""
This function tries a SPAdes assembly at different k-mers and returns the best one.
"""
@@ -62,7 +62,7 @@ def get_best_spades_graph(short1, short2, short_unpaired, out_dir, read_depth_fi
graph_files, insert_size_mean, insert_size_deviation = \
run_spades_all_kmers(reads, spades_dir, kmer_range, threads, spades_path,
- spades_graph_prefix, spades_options)
+ spades_graph_prefix, spades_options, spades_version)
existing_graph_files = [x for x in graph_files if x is not None]
if not existing_graph_files:
@@ -162,7 +162,7 @@ def get_best_spades_graph(short1, short2, short_unpaired, out_dir, read_depth_fi
def run_spades_all_kmers(read_files, spades_dir, kmers, threads, spades_path, spades_graph_prefix,
- spades_options):
+ spades_options, spades_version):
"""
SPAdes is run with all k-mers up to the top one. For example:
* round 1: 25
@@ -183,7 +183,7 @@ def run_spades_all_kmers(read_files, spades_dir, kmers, threads, spades_path, sp
biggest_kmer = kmers[i]
command = build_spades_command(spades_path, spades_dir, threads, kmers, i, short1, short2,
unpaired, using_paired_reads, using_unpaired_reads,
- spades_options)
+ spades_options, spades_version)
log.log(' '.join(command))
graph_file, insert_size_mean, insert_size_deviation = \
run_spades_one_kmer(command, spades_dir, biggest_kmer)
@@ -218,10 +218,12 @@ def run_spades_all_kmers(read_files, spades_dir, kmers, threads, spades_path, sp
def build_spades_command(spades_path, spades_dir, threads, kmers, i, short1, short2, unpaired,
- using_paired_reads, using_unpaired_reads, spades_options):
+ using_paired_reads, using_unpaired_reads, spades_options, spades_version):
kmer_string = ','.join([str(x) for x in kmers[:i+1]])
command = [spades_path, '-o', spades_dir, '-k', kmer_string, '--threads', str(threads)]
+ if spades_version.startswith("4."):
+ command += ['--gfa11']
if i == 0: # first k-mer
command += ['--isolate']
if using_paired_reads:
=====================================
unicycler/unicycler.py
=====================================
@@ -59,7 +59,7 @@ def main():
check_input_files(args)
print_intro_message(args, full_command, out_dir_message)
- check_dependencies(args, short_reads_available, long_reads_available)
+ spades_version = check_dependencies(args, short_reads_available, long_reads_available)
counter = itertools.count(start=1) # Files are numbered in chronological order.
bridges = []
@@ -78,7 +78,7 @@ def main():
args.spades_path, args.threads, args.keep,
args.kmer_count, args.min_kmer_frac, args.max_kmer_frac,
args.kmers, args.linear_seqs, args.largest_component,
- spades_graph_prefix, args.spades_options)
+ spades_graph_prefix, args.spades_options, spades_version)
determine_copy_depth(graph)
if args.keep > 0 and not os.path.isfile(best_spades_graph):
graph.save_to_gfa(best_spades_graph, save_copy_depth_info=True, newline=True,
@@ -715,6 +715,7 @@ def check_dependencies(args, short_reads_available, long_reads_available):
quit_if_dependency_problem(spades_status, racon_status, makeblastdb_status, tblastn_status,
args)
+ return spades_version
def quit_if_dependency_problem(spades_status, racon_status, makeblastdb_status, tblastn_status,
@@ -727,7 +728,7 @@ def quit_if_dependency_problem(spades_status, racon_status, makeblastdb_status,
if spades_status == 'not found':
quit_with_error('could not find SPAdes at ' + args.spades_path)
if spades_status == 'too old' or spades_status == 'too new':
- quit_with_error('Unicycler requires SPAdes v3.13.1 or later')
+ quit_with_error('Unicycler requires SPAdes v3.14.0 or later')
if spades_status == 'Python problem':
quit_with_error('SPAdes cannot run due to an incompatible Python version')
if spades_status == 'bad':
=====================================
unicycler/version.py
=====================================
@@ -13,4 +13,4 @@ details. You should have received a copy of the GNU General Public License along
not, see <http://www.gnu.org/licenses/>.
"""
-__version__ = '0.5.0'
+__version__ = '0.5.1'
View it on GitLab: https://salsa.debian.org/med-team/unicycler/-/commit/0ab543f9602925640cc6d91d174c711487dca56c
--
View it on GitLab: https://salsa.debian.org/med-team/unicycler/-/commit/0ab543f9602925640cc6d91d174c711487dca56c
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/20241125/5a3c2ad0/attachment-0001.htm>
More information about the debian-med-commit
mailing list