-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from akikuno/develop-v0.3.1
Develop v0.3.1
- Loading branch information
Showing
76 changed files
with
2,614 additions
and
2,032 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
include requirements.txt | ||
include src/DAJIN2/template_igvjs.html | ||
|
||
graft src/DAJIN2/templates | ||
graft src/DAJIN2/static | ||
graft src/DAJIN2/utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
numpy >= 1.20.0 | ||
scipy >= 1.6.0 | ||
pandas >= 1.0.0 | ||
openpyxl >= 3.0.0 | ||
rapidfuzz >=3.0.0 | ||
statsmodels >= 0.13.5 | ||
scikit-learn >= 1.0.0 | ||
|
||
mappy >= 2.24 | ||
pysam >= 0.19.0 | ||
openpyxl >= 3.0.0 | ||
|
||
Flask >= 2.2.0 | ||
waitress >= 2.1.0 | ||
Jinja2 >= 3.1.0 | ||
|
||
plotly >= 5.0.0 | ||
kaleido >= 0.2.0 | ||
|
||
cstag == 0.4.1 | ||
midsv >= 0.10.1 | ||
wslPath >=0.3.0 | ||
rapidfuzz >=3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
|
||
setuptools.setup( | ||
name="DAJIN2", | ||
version="0.3.0", | ||
version="0.3.1b4", | ||
author="Akihiro Kuno", | ||
author_email="[email protected]", | ||
description="One-step genotyping tools for targeted long-read sequencing", | ||
|
@@ -24,7 +24,8 @@ | |
entry_points={"console_scripts": ["DAJIN2=DAJIN2.main:execute"]}, | ||
include_package_data=True, | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Development Status :: 4 - Beta", | ||
"Environment :: Console", | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: POSIX", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from DAJIN2.core.classification.classify import classify_alleles | ||
from DAJIN2.core.classification.classifier import classify_alleles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from __future__ import annotations | ||
|
||
import midsv | ||
from pathlib import Path | ||
from itertools import groupby | ||
|
||
|
||
def _calc_match(CSSPLIT: str) -> float: | ||
match_score = CSSPLIT.count("=") | ||
match_score -= CSSPLIT.count("+") # insertion | ||
match_score -= sum(cs.islower() for cs in CSSPLIT) # inversion | ||
cssplit = CSSPLIT.split(",") | ||
|
||
return match_score / len(cssplit) | ||
|
||
|
||
def _score_allele(TEMPDIR: Path, allele: str, SAMPLE_NAME: str) -> list[dict]: | ||
midsv_sample = midsv.read_jsonl(Path(TEMPDIR, SAMPLE_NAME, "midsv", f"{allele}.json")) | ||
scored_alleles = [] | ||
|
||
for dict_midsv in midsv_sample: | ||
score = _calc_match(dict_midsv["CSSPLIT"]) | ||
dict_midsv.update({"SCORE": score, "ALLELE": allele}) | ||
scored_alleles.append(dict_midsv) | ||
|
||
return scored_alleles | ||
|
||
|
||
def _extract_alleles_with_max_score(score_of_each_alleles: list[dict]) -> list[dict]: | ||
alleles_with_max_score = [] | ||
score_of_each_alleles.sort(key=lambda x: x["QNAME"]) | ||
for _, group in groupby(score_of_each_alleles, key=lambda x: x["QNAME"]): | ||
max_read = max(group, key=lambda x: x["SCORE"]) | ||
del max_read["SCORE"] | ||
alleles_with_max_score.append(max_read) | ||
return alleles_with_max_score | ||
|
||
|
||
########################################################## | ||
# main | ||
########################################################## | ||
|
||
|
||
def classify_alleles(TEMPDIR: Path, FASTA_ALLELES: dict, SAMPLE_NAME: str) -> list[dict]: | ||
score_of_each_alleles = [] | ||
for allele in FASTA_ALLELES: | ||
score_of_each_alleles.extend(_score_allele(TEMPDIR, allele, SAMPLE_NAME)) | ||
|
||
return _extract_alleles_with_max_score(score_of_each_alleles) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
from DAJIN2.core.consensus.consensus import call_consensus | ||
from DAJIN2.core.consensus.consensus import call_allele_name | ||
from DAJIN2.core.consensus.consensus import update_key_by_allele_name | ||
from DAJIN2.core.consensus.consensus import add_key_by_allele_name | ||
from DAJIN2.core.consensus.subset import subset_clust | ||
from DAJIN2.core.consensus.extract_mutation_loci_by_labels import extract_mutation_loci_by_labels | ||
from DAJIN2.core.consensus.name_handler import call_allele_name | ||
from DAJIN2.core.consensus.name_handler import update_key_by_allele_name | ||
from DAJIN2.core.consensus.name_handler import add_key_by_allele_name | ||
from DAJIN2.core.consensus.clust_subsetter import subset_clust |
File renamed without changes.
Oops, something went wrong.