Skip to content

Commit

Permalink
Remove unused helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
TJBIII committed Sep 24, 2023
1 parent 905e560 commit 59200e3
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 46 deletions.
1 change: 0 additions & 1 deletion clipkit/clipkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
create_msa,
get_seq_type,
get_gap_chars,
trim_and_get_stats,
write_msa,
write_complement,
SeqType,
Expand Down
44 changes: 0 additions & 44 deletions clipkit/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,13 @@ def get_seq_type(alignment: MultipleSeqAlignment) -> SeqType:
return sequence_type


def get_alignment_column(alignment: MultipleSeqAlignment, index: int) -> str:
alignment_column = ""
alignment_column += alignment[:, index]
return alignment_column.upper()


def get_gap_chars(seq_type: SeqType) -> list[str]:
if seq_type == SeqType.nt:
return DEFAULT_NT_GAP_CHARS
else:
return DEFAULT_AA_GAP_CHARS


def report_column_features(
alignment: MultipleSeqAlignment, index: int, gap_chars: list
) -> tuple[str, float]:
"""
Count the occurence of each character at a given position
in an alignment. This information is used to determine
if the alignment is parsimony informative or not. When
counting characters, gaps are excluded.
"""
alignment_column = get_alignment_column(alignment, index)

column_length = len(alignment_column)

number_of_gaps = sum([alignment_column.count(char) for char in gap_chars])
gappyness = number_of_gaps / column_length

return alignment_column, gappyness


def create_msa(alignment: MultipleSeqAlignment, gap_chars: list[str]=None) -> MSA:
"""
Create MSA class
Expand Down Expand Up @@ -103,23 +78,4 @@ def write_complement(msa: MSA, out_file: str, out_file_format: FileFormat) -> No
elif out_file_format.value == "phylip_sequential":
SeqIO.write(output_msa, out_file, "phylip-sequential")
SeqIO.write(output_msa, completmentOut, out_file_format.value)


def trim_and_get_stats(
alignment: MultipleSeqAlignment,
gaps: float,
mode: TrimmingMode,
use_log: bool,
out_file_name: str,
complement: bool,
gap_chars: list,
quiet: bool,
) -> tuple["TrimRun", "TrimmingStats"]:
"""
Determines positions to keep or trim and saves these positions on the MSA classes.
"""
msa = create_msa(alignment)
msa.trim(mode, gap_threshold=gaps)

return trim_run, stats

1 change: 0 additions & 1 deletion clipkit/smart_gap_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import numpy as np
from tqdm import tqdm

from .helpers import report_column_features
from .logger import logger


Expand Down

0 comments on commit 59200e3

Please sign in to comment.