Skip to content

Commit

Permalink
ci/style: Ignore files that won't be type checked
Browse files Browse the repository at this point in the history
Solution was to use `# mypy: ignore-errors` on individual files.

Adds the option `warn_unused_ignores = true` so that as individual type hints get corrected we can remove the specific
ignore statements that were added.
  • Loading branch information
ns-rse committed Dec 4, 2024
1 parent 0d9ce48 commit ffa951a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ repos:
hooks:
- id: mypy
files: isoslam
args: []
args:
[
"--exclude='^all_introns_counts_and_info\\.py$'",
"--exclude='^pipeline_slam_3UIs\\.py$'",
]

# @ns-rse (2024-11-27) Currently fails due to `fastjsonschema` not covering `tool.ruff.lint` see
# https://github.com/abravalheri/validate-pyproject/issues/180
Expand Down
2 changes: 2 additions & 0 deletions isoslam/all_introns_counts_and_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
about it's event assignment, number of conversions, coverage etc.
"""

# mypy: ignore-errors

from argparse import ArgumentParser
import sys

Expand Down
3 changes: 3 additions & 0 deletions isoslam/pipeline_slam_3UIs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
of 4sU-linked nucleotide conversions (T>C or A>G), exclusing SNPs.
"""

# mypy: ignore-errors

import os
import sys

import ruffus
from cgatcore import pipeline as P


# Read in pipeline.yml
PARAMS = P.get_parameters(
[
Expand Down
11 changes: 5 additions & 6 deletions isoslam/pipeline_slam_3UIs/all_introns_counts_and_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
all_introns_counts_and_info.py
====================
Takes in the sorted and feature assigned `.bam` file from previous steps and passes them to a
python script that uses pysam (python wrapper for htslib). This script iterates over the `.bam`
python script that uses pysam (python wrapper for htslib). This script iterates over the `.bam`
file pair-by-pair (representing the sequencing insert), determines whether the read-pair shows
evidence of intron splicing/retention and assigns these to specific events by referencing the
`.gtf` and `.bed` files, and XT tag from featureCountsReadAssignments. Next, the script uses the
XS tag from featureCountsReadAssignment to assign each read in the pair as the forward or reverse
read, relative to the direction of transcription. Finally, it looks for T>C in FW read, A>G in RV
read, checks these are not present in the SNP VCF file, and outputs metadata on each read-pair
about it's event assignment, number of conversions, coverage etc.
about it's event assignment, number of conversions, coverage etc.
"""

# mypy: ignore-errors

import sys
from collections import defaultdict

Expand Down Expand Up @@ -52,7 +54,7 @@ def main(argv=None):
"--out",
dest="outfile_tsv",
type=str,
help="""Supply a path to the output file. This file will contain
help="""Supply a path to the output file. This file will contain
conversions per pair, accounting for stranding""",
)

Expand Down Expand Up @@ -108,7 +110,6 @@ def main(argv=None):
conversion_dict = defaultdict(int)

def fragment_iterator(read_iterator):

read_list = list()
last_read = None

Expand Down Expand Up @@ -137,7 +138,6 @@ def fragment_iterator(read_iterator):
)

for pair in fragment_iterator(bamfile.fetch(until_eof=True)):

# if i_total_progress >= 2000000:
## print("length break")
# break
Expand Down Expand Up @@ -461,7 +461,6 @@ def fragment_iterator(read_iterator):
converted_position.add(genome_pos)

for base in reverse_read.get_aligned_pairs(with_seq=True):

read_pos, genome_pos, genome_seq = base
if None in base:
continue
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ python_version = "3.10"
strict = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true
warn_unused_ignores = true
exclude = [
'^all_introns_counts_and_info\.py$',
'^pipeline_slam_3UIs\.py$',
Expand Down

0 comments on commit ffa951a

Please sign in to comment.