Skip to content

Commit 357090c

Browse files
authored
build: update to latest agct (#442)
The `0.2.0` agct release includes some minor API breaking changes. This PR resolves them. It also enables liftover by interval, not just position. I think this would be good to adopt at some point -- it strikes me as potentially problematic to just lift over by start and end separately, but coolseqtool is a little hairy so I left it alone for now.
1 parent 6c8cbad commit 357090c

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ license = {file = "LICENSE"}
2626
dependencies = [
2727
"asyncpg",
2828
"boto3",
29-
"agct >= 0.1.0-dev1",
29+
"agct >= 0.2.0rc1",
3030
"polars ~= 1.0",
3131
"biocommons.seqrepo",
3232
"pydantic >=2.0,<3.0",

src/cool_seq_tool/mappers/liftover.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import logging
77
from os import environ
88

9-
from agct import Converter, Genome
9+
from agct import Assembly as AgctAssembly
10+
from agct import Converter
1011

1112
from cool_seq_tool.schemas import Assembly
1213
from cool_seq_tool.utils import process_chromosome_input
@@ -43,13 +44,13 @@ def __init__(
4344
"""
4445
self.from_37_to_38 = Converter(
4546
chainfile=chain_file_37_to_38 or LIFTOVER_CHAIN_37_TO_38,
46-
from_db=Genome.HG19,
47-
to_db=Genome.HG38,
47+
from_assembly=AgctAssembly.HG19,
48+
to_assembly=AgctAssembly.HG38,
4849
)
4950
self.from_38_to_37 = Converter(
5051
chainfile=chain_file_38_to_37 or LIFTOVER_CHAIN_38_TO_37,
51-
from_db=Genome.HG38,
52-
to_db=Genome.HG19,
52+
from_assembly=AgctAssembly.HG38,
53+
to_assembly=AgctAssembly.HG19,
5354
)
5455

5556
def get_liftover(
@@ -77,9 +78,9 @@ def get_liftover(
7778
"""
7879
chromosome = process_chromosome_input(chromosome, "LiftOver.get_liftover()")
7980
if liftover_to_assembly == Assembly.GRCH38:
80-
liftover = self.from_37_to_38.convert_coordinate(chromosome, pos)
81+
liftover = self.from_37_to_38.convert_coordinate(chromosome, pos, pos)
8182
elif liftover_to_assembly == Assembly.GRCH37:
82-
liftover = self.from_38_to_37.convert_coordinate(chromosome, pos)
83+
liftover = self.from_38_to_37.convert_coordinate(chromosome, pos, pos)
8384
else:
8485
_logger.warning("%s assembly not supported", liftover_to_assembly)
8586
liftover = None

src/cool_seq_tool/resources/status.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ async def check_status(
114114
chain_file_38_to_37=chain_file_38_to_37,
115115
)
116116
except (FileNotFoundError, ChainfileError):
117-
_logger.exception("agct converter setup failed")
117+
_logger.exception("`agct` converter setup failed")
118118
except Exception as e:
119-
_logger.critical("Encountered unexpected error setting up agct: %s", e)
119+
_logger.critical("Encountered unexpected error setting up `agct`: %s", e)
120120
else:
121121
status["liftover"] = True
122122

0 commit comments

Comments
 (0)