Skip to content

Commit

Permalink
update black version and re-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rxu17 committed Feb 6, 2024
1 parent 8501a62 commit 664bde7
Show file tree
Hide file tree
Showing 25 changed files with 61 additions and 25 deletions.
1 change: 1 addition & 0 deletions genie/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration to obtain registry classes"""

import importlib
import logging

Expand Down
1 change: 1 addition & 0 deletions genie/create_case_lists.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Creates case lists per cancer type
"""

from collections import defaultdict
import csv
import os
Expand Down
15 changes: 9 additions & 6 deletions genie/dashboard_table_updater.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Updates dashboard tables"""

import argparse
import datetime
import logging
Expand Down Expand Up @@ -347,9 +348,11 @@ def update_oncotree_code_tables(syn, database_mappingdf):
oncotree_mapping = process_functions.get_oncotree_code_mappings(oncotree_link)

clinicaldf["PRIMARY_CODES"] = [
oncotree_mapping[i.upper()]["ONCOTREE_PRIMARY_NODE"]
if i.upper() in oncotree_mapping.keys()
else "DEPRECATED_CODE"
(
oncotree_mapping[i.upper()]["ONCOTREE_PRIMARY_NODE"]
if i.upper() in oncotree_mapping.keys()
else "DEPRECATED_CODE"
)
for i in clinicaldf.ONCOTREE_CODE
]

Expand Down Expand Up @@ -457,9 +460,9 @@ def update_sample_difference_table(syn, database_mappingdf):
.applymap(int)
)

diff_between_releasesdf[
["Clinical", "Mutation", "CNV", "SEG", "Fusions"]
] = new_values
diff_between_releasesdf[["Clinical", "Mutation", "CNV", "SEG", "Fusions"]] = (
new_values
)

load._update_table(
syn,
Expand Down
44 changes: 26 additions & 18 deletions genie/database_to_staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ def remove_maf_samples(mafdf: pd.DataFrame, keep_samples: list) -> pd.DataFrame:
"""
keep_maf = mafdf["Tumor_Sample_Barcode"].isin(keep_samples)
mafdf = mafdf.loc[
keep_maf,
]
mafdf = mafdf.loc[keep_maf,]
return mafdf


Expand Down Expand Up @@ -1054,30 +1052,38 @@ def store_clinical_files(
}

clinicaldf["CANCER_TYPE"] = [
oncotree_dict[code.upper()]["CANCER_TYPE"]
if code.upper() in oncotree_dict.keys()
else float("nan")
(
oncotree_dict[code.upper()]["CANCER_TYPE"]
if code.upper() in oncotree_dict.keys()
else float("nan")
)
for code in clinicaldf["ONCOTREE_CODE"]
]

clinicaldf["CANCER_TYPE_DETAILED"] = [
oncotree_dict[code.upper()]["CANCER_TYPE_DETAILED"]
if code.upper() in oncotree_dict.keys()
else float("nan")
(
oncotree_dict[code.upper()]["CANCER_TYPE_DETAILED"]
if code.upper() in oncotree_dict.keys()
else float("nan")
)
for code in clinicaldf["ONCOTREE_CODE"]
]

clinicaldf["ONCOTREE_PRIMARY_NODE"] = [
oncotree_dict[code.upper()]["ONCOTREE_PRIMARY_NODE"]
if code.upper() in oncotree_dict.keys()
else float("nan")
(
oncotree_dict[code.upper()]["ONCOTREE_PRIMARY_NODE"]
if code.upper() in oncotree_dict.keys()
else float("nan")
)
for code in clinicaldf["ONCOTREE_CODE"]
]

clinicaldf["ONCOTREE_SECONDARY_NODE"] = [
oncotree_dict[code.upper()]["ONCOTREE_SECONDARY_NODE"]
if code.upper() in oncotree_dict.keys()
else float("nan")
(
oncotree_dict[code.upper()]["ONCOTREE_SECONDARY_NODE"]
if code.upper() in oncotree_dict.keys()
else float("nan")
)
for code in clinicaldf["ONCOTREE_CODE"]
]

Expand All @@ -1088,9 +1094,11 @@ def store_clinical_files(
# descriptions can match
clinicaldf["AGE_AT_SEQ_REPORT_DAYS"] = clinicaldf["AGE_AT_SEQ_REPORT"]
clinicaldf["AGE_AT_SEQ_REPORT"] = [
int(math.floor(int(float(age)) / 365.25))
if process_functions.checkInt(age)
else age
(
int(math.floor(int(float(age)) / 365.25))
if process_functions.checkInt(age)
else age
)
for age in clinicaldf["AGE_AT_SEQ_REPORT"]
]
clinicaldf["AGE_AT_SEQ_REPORT"][clinicaldf["AGE_AT_SEQ_REPORT"] == ">32485"] = ">89"
Expand Down
1 change: 1 addition & 0 deletions genie/example_filetype_format.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""TODO: Rename this to model.py
This contains the GENIE model objects
"""

from abc import ABCMeta
from dataclasses import dataclass
import logging
Expand Down
1 change: 1 addition & 0 deletions genie/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module contains all the functions that stores data
to Synapse
"""

import logging
import os
import time
Expand Down
1 change: 1 addition & 0 deletions genie/process_functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Processing functions that are used in the GENIE pipeline"""

import datetime
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions genie/process_mutation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Process mutation files
TODO deprecate this module and spread functions around"""

from collections import namedtuple
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions genie/transform.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module contains all the transformation functions used throughout the GENIE
package"""

import warnings

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions genie/write_invalid_reasons.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Write invalid reasons"""

import logging
import os

Expand Down
1 change: 1 addition & 0 deletions genie_registry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Initialize GENIE registry"""

# Import logging last to not take in synapseclient logging
import logging

Expand Down
1 change: 1 addition & 0 deletions genie_registry/assay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Assay information class"""

import os
import yaml

Expand Down
1 change: 1 addition & 0 deletions genie_registry/bed.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GENIE bed class and functions"""

import os
import logging
import subprocess
Expand Down
1 change: 1 addition & 0 deletions genie_registry/clinical.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Clinical file format validation and processing"""

# from __future__ import annotations
import datetime
from io import StringIO
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""genie package setup"""

from setuptools import setup

setup()
1 change: 1 addition & 0 deletions tests/test_assay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test assay information validation and processing"""

import copy
from unittest.mock import patch

Expand Down
1 change: 1 addition & 0 deletions tests/test_bed.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test GENIE Bed class"""

import tempfile
import shutil
from unittest import mock
Expand Down
1 change: 1 addition & 0 deletions tests/test_database_to_staging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests database to staging functions"""

import os
from unittest import mock
from unittest.mock import patch
Expand Down
5 changes: 4 additions & 1 deletion tests/test_example_filetype_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def test_that_validate_returns_expected_msg_if__validate_passes(filetype_format_


def test_that_validate_throws_exception_if_file_read_error(filetype_format_class):
with patch.object(FileTypeFormat, "_validate",) as patch_validate, patch.object(
with patch.object(
FileTypeFormat,
"_validate",
) as patch_validate, patch.object(
FileTypeFormat,
"read_file",
side_effect=Exception("mocked error"),
Expand Down
1 change: 1 addition & 0 deletions tests/test_extract.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test genie.extract module"""

from unittest.mock import patch

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test GENIE filters
"""

import datetime
import os
import sys
Expand Down
1 change: 1 addition & 0 deletions tests/test_process_mutation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test process mutation functions"""

import os
from collections import namedtuple
from pandas.testing import assert_frame_equal
Expand Down
1 change: 1 addition & 0 deletions tests/test_transform.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test genie.transform module"""

import os
from io import BytesIO
from unittest import mock
Expand Down
1 change: 1 addition & 0 deletions tests/test_validate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests validate.py"""

from unittest.mock import Mock, patch

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions tests/test_write_invalid_reasons.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test write invalid reasons module"""

from unittest import mock
from unittest.mock import patch

Expand Down

0 comments on commit 664bde7

Please sign in to comment.