Skip to content

Commit

Permalink
Fix autosome count check which was counting Unlocs
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrg committed Nov 26, 2024
1 parent 6a86a06 commit fb5c4ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/tola/assembly/assembly_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ def check_consistent_autosome_count(
) -> str | None:
chr_counts = {}
for hap, asm in hap_asm.items():
if autosomes := [x for x in asm.scaffolds if x.rank == 1]:
ranked_names_lengths = self.get_assembly_scaffold_lengths(hap, asm)
if autosomes := ranked_names_lengths.get(1):
chr_counts[hap if hap else "Primary"] = len(autosomes)

if len(chr_counts) > 1:
distinct_counts = set(chr_counts.values())
if len(distinct_counts) > 1:
Expand All @@ -252,7 +254,7 @@ def check_for_large_haplotigs(
if hap == "Haplotig":
continue
ranked_names_lengths = self.get_assembly_scaffold_lengths(hap, asm)
for rank in (1,2):
for rank in (1, 2):
if names_lengths := ranked_names_lengths.get(rank):
for frags_len in names_lengths.values():
if shortest and frags_len > shortest:
Expand Down
2 changes: 1 addition & 1 deletion tests/data/bChlMac1_3/bChlMac1_3-pretext-to-tpf.log
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ bChlMac1_3-pretext-to-tpf.haplotigs
4,748,144 bp total

Curation made 1 cut in a contig, 15 breaks at gaps and 29 joins
Mismatch in autosome count between Hap1 = 38 and Hap2 = 37
Mismatch in autosome count between Hap1 = 36 and Hap2 = 35
Haplotig H_1 (Scaffold_75) is 4,560,100 bp which is longer than the shortest chromosome (292,585 bp)

0 comments on commit fb5c4ae

Please sign in to comment.