From 4a4cf0fd7fcef568d7f1e6e433d85e4453f19ffc Mon Sep 17 00:00:00 2001 From: AroneyS Date: Fri, 11 Oct 2024 13:45:50 +1000 Subject: [PATCH] use abspath for prior coassemblies --- binchicken/binchicken.py | 8 ++++---- test/data/prior_assembly.tsv | 4 ++-- test/data/prior_coassembly.tsv | 2 +- test/data/prior_extra.tsv | 6 +++--- test/data/prior_missing.tsv | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/binchicken/binchicken.py b/binchicken/binchicken.py index 588c7df2..e8f700fa 100755 --- a/binchicken/binchicken.py +++ b/binchicken/binchicken.py @@ -368,7 +368,7 @@ def evaluate_bins(aviary_outputs, checkm_version, min_completeness, max_contamin else: return {"-".join([c, str(i)]): os.path.join(recovered_bins[c], b + ".fna") for c in coassembly_bins for i, b in enumerate(coassembly_bins[c])} -def check_prior_assemblies(prior_assemblies, inputs, prior_dir): +def check_prior_assemblies(prior_assemblies, inputs): mismatched_groups = ( prior_assemblies .join(pl.DataFrame({"name": inputs}), on="name", how="full", suffix="_input") @@ -383,7 +383,7 @@ def check_prior_assemblies(prior_assemblies, inputs, prior_dir): extra_assemblies = " ".join(extra_assemblies.sort("name").get_column("name").to_list()) raise ValueError(f"Extra assemblies not matching any samples/coassemblies in prior assemblies: {extra_assemblies}") - return {row[0]: os.path.join(os.path.dirname(prior_dir), row[1]) for row in prior_assemblies.iter_rows()} + return {row[0]: os.path.abspath(row[1]) for row in prior_assemblies.iter_rows()} def coassemble(args): logging.info("Loading sample info") @@ -495,7 +495,7 @@ def coassemble(args): prior_assemblies = pl.read_csv(args.prior_assemblies, separator="\t") input_samples = args.coassembly_samples if args.coassembly_samples else forward_reads.keys() - prior_assemblies = check_prior_assemblies(prior_assemblies, input_samples, args.prior_assemblies) + prior_assemblies = check_prior_assemblies(prior_assemblies, input_samples) else: prior_assemblies = args.prior_assemblies @@ -757,7 +757,7 @@ def update(args): prior_assemblies = pl.read_csv(args.prior_assemblies, separator="\t") input_coassemblies = args.coassemblies if args.coassemblies else elusive_clusters.get_column("coassembly").to_list() - prior_assemblies = check_prior_assemblies(prior_assemblies, input_coassemblies, args.prior_assemblies) + prior_assemblies = check_prior_assemblies(prior_assemblies, input_coassemblies) args.prior_assemblies = prior_assemblies else: raise ValueError("Prior assemblies require elusive clusters") diff --git a/test/data/prior_assembly.tsv b/test/data/prior_assembly.tsv index e55187cb..8510de59 100644 --- a/test/data/prior_assembly.tsv +++ b/test/data/prior_assembly.tsv @@ -1,3 +1,3 @@ name assembly -sample_1 coassembly_0.fasta -sample_2 coassembly_1.fasta +sample_1 test/data/coassembly_0.fasta +sample_2 test/data/coassembly_1.fasta diff --git a/test/data/prior_coassembly.tsv b/test/data/prior_coassembly.tsv index f6d51a78..6f9f8a26 100644 --- a/test/data/prior_coassembly.tsv +++ b/test/data/prior_coassembly.tsv @@ -1,2 +1,2 @@ name assembly -coassembly_0 coassembly_0.fasta +coassembly_0 test/data/coassembly_0.fasta diff --git a/test/data/prior_extra.tsv b/test/data/prior_extra.tsv index b9e6cd1d..e01eb25a 100644 --- a/test/data/prior_extra.tsv +++ b/test/data/prior_extra.tsv @@ -1,4 +1,4 @@ name assembly -sample_1 coassembly_0.fasta -sample_2 coassembly_1.fasta -sample_3 coassembly_1.fasta +sample_1 test/data/coassembly_0.fasta +sample_2 test/data/coassembly_1.fasta +sample_3 test/data/coassembly_1.fasta diff --git a/test/data/prior_missing.tsv b/test/data/prior_missing.tsv index 2b7e1cb8..fc7028b2 100644 --- a/test/data/prior_missing.tsv +++ b/test/data/prior_missing.tsv @@ -1,2 +1,2 @@ name assembly -sample_1 coassembly_0.fasta +sample_1 test/data/coassembly_0.fasta