Skip to content

Commit

Permalink
Removed code for downloading resources via schug
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiara Rasi committed Feb 18, 2025
1 parent 5fc1747 commit 6ce527b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- To avoid timeout errors, update genes, transcripts exons only from pre-downloaded files from schug
- Documentation on how to update genes, transcripts and exons database tables
- Renamed Pydantic `orm_mode` config param to `model_config`
### Removed
- Code for downloading resources from Ensembl using the schug library

## [3.1]
### Changed
Expand Down
15 changes: 0 additions & 15 deletions src/chanjo2/meta/handle_load_intervals.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import logging
from typing import Iterator, List, Optional, Union

import requests
from schug.load.biomart import EnsemblBiomartClient
from schug.models.common import Build as SchugBuild
from sqlalchemy.orm import Session

from chanjo2.constants import (
ENSEMBL_RESOURCE_CLIENT,
EXONS_FILE_HEADER,
GENES_FILE_HEADER,
TRANSCRIPTS_FILE_HEADER,
Expand All @@ -32,17 +28,6 @@
END_OF_PARSED_FILE: str = "[success]"


def read_resource_lines(build: Builds, interval_type: IntervalType) -> Iterator[str]:
"""Returns lines of a remote Ensembl Biomart resource (genes, transcripts or exons) in a given genome build."""

shug_client: EnsemblBiomartClient = ENSEMBL_RESOURCE_CLIENT[interval_type](
build=SchugBuild(build)
)
url: str = shug_client.build_url(xml=shug_client.xml)
response: requests.models.responses = requests.get(url, stream=True)
return response.iter_lines(decode_unicode=True)


def _replace_empty_cols(line: str, nr_expected_columns: int) -> List[Union[str, None]]:
"""Split line into columns, replacing empty columns with None values."""
cols = [
Expand Down
2 changes: 0 additions & 2 deletions tests/src/chanjo2/endpoints/test_intervals.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
BUILD_TRANSCRIPTS_RESOURCE,
)

MOCKED_FILE_PARSER = "chanjo2.meta.handle_load_intervals.read_resource_lines"


@pytest.mark.parametrize("build, path", BUILD_GENES_RESOURCE)
def test_load_genes(
Expand Down

0 comments on commit 6ce527b

Please sign in to comment.