Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(codebase): added utils folder from TRTools to core #6

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ba87d82
Added utils folder from TRTools
Apr 8, 2024
47e5b5c
Moved TRTools utils files into core
Apr 13, 2024
b26d5ae
Added tests from TRTools into tests folder of core
Apr 13, 2024
1fd1cca
Deleted separate utils folder
Apr 13, 2024
76f3d04
Updated imports for TRTools test files
Apr 15, 2024
42e02f7
Changed relative paths for imports
aarushi03 Apr 29, 2024
c72ac85
Added fixture file and modified toml
aarushi03 Apr 29, 2024
1513039
Removed unnecessary functions
aarushi03 Apr 29, 2024
ceef4f1
Changed fixture and data file paths
aarushi03 Apr 29, 2024
9a358a3
Added required testing data files
aarushi03 Apr 29, 2024
eb9ab08
Merge branch 'main' into trtools_export
aarushi03 Apr 29, 2024
f40c1ab
Linting the code
aarushi03 Apr 29, 2024
dc53b9f
remove tr_harmonizer from list of ignored coverage files
aryarm May 3, 2024
bfcb38f
add first 1400 lines of test gangstr file
aryarm Aug 26, 2024
1edb59a
add first 1300 lines of test hipstr file
aryarm Aug 27, 2024
d57852b
copy changes to devcontainer file from panct and trtools
aryarm Aug 27, 2024
ca2383b
copy over some additional test data files
aryarm Aug 27, 2024
5ef51d5
decrease code coverage a tiny bit
aryarm Aug 27, 2024
b7e269c
disable vscode type checking in trtools files
aryarm Aug 27, 2024
1acb50b
oops refmt for black
aryarm Aug 27, 2024
bb16e9b
make pgenlib lowercase
aryarm Sep 2, 2024
c847267
downgrade to lowest versions of all dependencies in pyproject
aryarm Sep 2, 2024
6708454
sync with trtools ae3ca15e
aryarm Sep 4, 2024
53c1e44
mv all beagle files back into a beagle folder
aryarm Sep 4, 2024
ba8c135
cp haptools logging and remove trtools common messaging
aryarm Sep 4, 2024
815de21
rm mergeutils since it isnt imported by tr_harmonizer
aryarm Sep 4, 2024
ed6fe5e
rm unnecessary imports in utils
aryarm Sep 4, 2024
17d9363
sort imports and rm unnecessary code
aryarm Sep 4, 2024
77b2155
refmt with black
aryarm Sep 5, 2024
3b86461
fix broken macos test
aryarm Sep 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,32 @@
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "mamba env create -n core -f dev-env.yml && conda run -n core poetry install",
"postCreateCommand": "mamba env create -n core -f dev-env.yml && conda run -n core poetry config virtualenvs.in-project true && conda run -n core poetry install",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": ["ms-python.python"],
"extensions": [
"ms-python.python",
"ms-vscode.live-server",
"ms-python.black-formatter"
],
"settings": {
"python.analysis.typeCheckingMode": "strict",
"python.condaPath": "/opt/conda/condabin/conda",
"python.defaultInterpreterPath": "/opt/conda/envs/core/bin/python",
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true,
"python.venvFolders": ["/home/vscode/.cache/pypoetry/virtualenvs"],
"python.venvPath": "/workspaces/core/.venv",
"python.defaultInterpreterPath": "/workspaces/core/.venv/bin/python",
"python.testing.pytestArgs": [
"tests"
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"terminal.integrated.environmentChangesRelaunch": true,
"terminal.integrated.hideOnStartup": "always"
"editor.defaultFormatter": "ms-python.black-formatter",
"terminal.integrated.hideOnStartup": "always",
"files.eol": "\n"
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.12", os: "ubuntu-latest", session: "tests" }
# - { python: "3.11", os: "windows-latest", session: "tests" }
- { python: "3.8", os: "macos-latest", session: "tests" }
- { python: "3.9", os: "macos-13", session: "tests" }
- { python: "3.11", os: "macos-latest", session: "tests" }
- { python: "3.8", os: "ubuntu-latest", session: "size" }
- { python: "3.8", os: "ubuntu-latest", session: "coverage" }

Expand Down Expand Up @@ -86,7 +87,7 @@ jobs:
run: |
export NOXSESSION=tests
# check that code coverage is not lower than specific percent
nox --verbose --python=${{ matrix.python }} -- --cov=. --cov-report=term-missing --cov-fail-under=93
nox --verbose --python=${{ matrix.python }} -- --cov-fail-under=92.5

- name: Run tests with nox
if: matrix.session == 'tests' || matrix.session == 'lint'
Expand Down
6 changes: 1 addition & 5 deletions core/genotypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@
from pysam import VariantFile
from cyvcf2 import VCF, Variant

try:
import trtools.utils.tr_harmonizer as trh
except ModuleNotFoundError:
from . import tr_harmonizer as trh

from .data import Data
from . import tr_harmonizer as trh


class Genotypes(Data):
Expand Down
46 changes: 46 additions & 0 deletions core/logging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from __future__ import annotations
import logging


def getLogger(name: str = None, level: str = "ERROR", exact_time=False):
"""
Retrieve a Logger object

Parameters
----------
name : str, optional
The name of the logging object
level : str, optional
The level of verbosity for the logger
"""
if name is None:
name = ""
else:
name = "." + name

# create logger
logger = logging.getLogger("core" + name)
logger.setLevel(level)

# create console handler and set level to debug
ch = logging.StreamHandler()
ch.setLevel(level)

# create formatter
db_time = (
("|%(asctime)s" + (".%(msecs)03d" if exact_time else ""))
if level == "DEBUG"
else ""
)
formatter = logging.Formatter(
fmt="[%(levelname)8s" + db_time + "] %(message)s (%(filename)s:%(lineno)s)",
datefmt="%H:%M:%S",
)

# add formatter to ch
ch.setFormatter(formatter)

# add ch to logger
logger.addHandler(ch)

return logger
Loading
Loading