Skip to content

Commit

Permalink
Merge pull request #65 from akikuno/patch-v0.5.5
Browse files Browse the repository at this point in the history
Patch v0.5.5 (Version Bump to v0.5.5.1)
  • Loading branch information
akikuno authored Oct 28, 2024
2 parents cc52415 + c93aad4 commit d7df84e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "DAJIN2"
version = "0.5.5"
version = "0.5.5.1"
description = "One-step genotyping tools for targeted long-read sequencing"
authors = ["Akihiro Kuno <[email protected]>"]
readme = "README.md"
Expand Down
8 changes: 3 additions & 5 deletions src/DAJIN2/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,22 @@ def execute_sample(arguments: dict):
preprocess.cache_mutation_loci(ARGS, is_control=False)

# ============================================================
# Detect and mapping SV (insertion/inversion) alleles
# Detect and mapping SV alleles
# ============================================================
paths_predefined_fasta: set[str] = {
str(Path(ARGS.tempdir, ARGS.sample_name, "fasta", f"{allele}.fasta")) for allele in ARGS.fasta_alleles.keys()
}

preprocess.detect_insertions(ARGS.tempdir, ARGS.sample_name, ARGS.control_name, ARGS.fasta_alleles)
preprocess.detect_inversions(ARGS.tempdir, ARGS.sample_name, ARGS.control_name, ARGS.fasta_alleles)

paths_sv_fasta = {str(p) for p in Path(ARGS.tempdir, ARGS.sample_name, "fasta").glob("insertion*.fasta")}
paths_sv_fasta |= {str(p) for p in Path(ARGS.tempdir, ARGS.sample_name, "fasta").glob("inversion*.fasta")}
paths_sv_fasta -= paths_predefined_fasta

if paths_sv_fasta:
# mapping to SV (insertion/inversion) alleles
# mapping to SV alleles
preprocess.generate_sam(ARGS, paths_sv_fasta, is_control=True, is_sv=True)
preprocess.generate_sam(ARGS, paths_sv_fasta, is_control=False, is_sv=True)
# add SV (insertion/inversion) alleles to ARGS.fasta_alleles
# add SV alleles to ARGS.fasta_alleles
for path_fasta_sv in paths_sv_fasta:
allele, seq = Path(path_fasta_sv).read_text().strip().split("\n")
allele = allele.replace(">", "")
Expand Down
6 changes: 2 additions & 4 deletions src/DAJIN2/core/preprocess/sv_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def _check_duplicates_of_sets(set1: set[str], set2: set[str]) -> bool:
return len(union_set) != total_elements


def add_unique_allele_keys(
fasta_sv_alleles: dict[str, str], FASTA_ALLELES: dict[str, set], key: str
) -> dict[str, str]:
def add_unique_allele_keys(fasta_sv_alleles: dict[str, str], FASTA_ALLELES: dict[str, set], key: str) -> dict[str, str]:
"""
Update keys to avoid duplicating user-specified alleles.
If the allele 'insertion1' exists in FASTA_ALLELES, increment the digits.
Expand All @@ -56,7 +54,7 @@ def add_unique_allele_keys(
user_defined_alleles = set(FASTA_ALLELES)
key_duplicated_alleles = {allele for allele in user_defined_alleles if key in allele}
if key_duplicated_alleles == set():
return {f"inversion{i+1}": value for i, value in enumerate(fasta_sv_alleles.values())}
return {f"{key}{i+1}": value for i, value in enumerate(fasta_sv_alleles.values())}

key_candidate_alleles = set()
digits = 2
Expand Down
2 changes: 1 addition & 1 deletion src/DAJIN2/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from sklearn.exceptions import ConvergenceWarning

DAJIN_VERSION = "0.5.5"
DAJIN_VERSION = "0.5.5.1"
DAJIN_RESULTS_DIR = Path("DAJIN_Results")
TEMP_ROOT_DIR = Path(DAJIN_RESULTS_DIR, ".tempdir")

Expand Down
1 change: 1 addition & 0 deletions src/DAJIN2/utils/cssplits_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def find_n_boundaries(cssplits: list[str]) -> tuple[int, int]:

return left_idx_n - 1, right_idx_n + 1


# ToDo: 点変異が扱えていない。convert_cssplits_to_cstagをinversion検出用に改変すれば、必要なくなる。
def convert_cssplit_to_dna(cssplit: str) -> str:
"""Convert a cssplit to a plain DNA sequence."""
Expand Down

0 comments on commit d7df84e

Please sign in to comment.