Skip to content

Commit

Permalink
use abspath for prior coassemblies
Browse files Browse the repository at this point in the history
  • Loading branch information
AroneyS committed Oct 11, 2024
1 parent fbcf8e6 commit 4a4cf0f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions binchicken/binchicken.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions test/data/prior_assembly.tsv
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/data/prior_coassembly.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name assembly
coassembly_0 coassembly_0.fasta
coassembly_0 test/data/coassembly_0.fasta
6 changes: 3 additions & 3 deletions test/data/prior_extra.tsv
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/data/prior_missing.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name assembly
sample_1 coassembly_0.fasta
sample_1 test/data/coassembly_0.fasta

0 comments on commit 4a4cf0f

Please sign in to comment.