Skip to content

Commit

Permalink
Fix some mypy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aghozlane committed Nov 26, 2024
1 parent 41e17f1 commit 41b2aae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions meteor/merging.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,11 @@ def execute(self) -> None:
# with h5py.File(output_name.with_suffix(".biom"), "w") as f:
# table.to_hdf5(f, generated_by="Meteor", compress=True)
elif my_pattern == "modules":
module_path = (
importlib.resources.files("meteor")
/ "data/modules_definition.feather"
module_path = Path(
str(
importlib.resources.files("meteor")
/ "data/modules_definition.feather"
)
)
annotation = self.load_data(module_path)
annotation = annotation[annotation["id"].isin(filtered_df["mod_id"])]
Expand Down
3 changes: 2 additions & 1 deletion meteor/phylogeny.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from cogent3.evolve.models import GTR
from cogent3.cluster.UPGMA import upgma
from concurrent.futures import ProcessPoolExecutor, as_completed
from typing import Union


@dataclass
Expand All @@ -61,7 +62,7 @@ def compute_site_info(self, sequences: Iterable[str]) -> list[float]:

def clean_sites(
self, msp_file: Path, output: tempfile._TemporaryFileWrapper
) -> Tuple[dict[str, str], int]:
) -> Tuple[dict[Union[int, str, None]], int]:
"""Clean msp sequence according to a certain level of gap at each sites.
:param msp_file: (Path) Fasta file
:param output_file: (Path) Output cleaned fasta file
Expand Down
7 changes: 3 additions & 4 deletions meteor/variantcalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ def count_reads_in_gene(
multiple_iterators=False,
):
read_count = sum(
1
True
for pileupread in pileupcolumn.pileups
if not pileupread.is_del and not pileupread.is_refskip
)
reads_dict[pileupcolumn.reference_pos] = read_count

return reads_dict

def merge_vcf_files(self, vcf_file_list, output_vcf):
def merge_vcf_files(self, vcf_file_list, output_vcf) -> None:
"""Merge variant records (handling the same positions in multiple VCFs)."""
variant_dict = defaultdict(list)

Expand Down Expand Up @@ -332,8 +332,7 @@ def filter_low_cov_sites(
self,
cram_file: Path,
reference_file: Path,
# temp_low_cov_sites: tempfile._TemporaryFileWrapper,
) -> None:
) -> tuple[pd.DataFrame]:
"""Create a bed file reporting a list of positions below coverage threshold
:param cram_file: Path to the input cram file
Expand Down

0 comments on commit 41b2aae

Please sign in to comment.