Skip to content

Commit

Permalink
Remove DEFINED_CANCER_TYPES global variable
Browse files Browse the repository at this point in the history
  • Loading branch information
forus committed Jul 11, 2024
1 parent 2dd1e62 commit a8f014a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 1 addition & 3 deletions scripts/importer/validateData.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
DEFINED_SAMPLE_IDS = None
DEFINED_SAMPLE_ATTRIBUTES = None
PATIENTS_WITH_SAMPLES = None
DEFINED_CANCER_TYPES = None
mutation_sample_ids = None
mutation_file_sample_ids = set()
sample_ids_panel_dict = {}
Expand Down Expand Up @@ -5388,15 +5387,14 @@ def validate_study(study_dir, portal_instance, logger, relaxed_mode, strict_maf_
cancer_type_validators[0].validate()
studydefined_cancer_types = (
cancer_type_validators[0].defined_cancer_types)
DEFINED_CANCER_TYPES = studydefined_cancer_types

# next check the cancer type of the meta_study file
if cbioportal_common.MetaFileTypes.STUDY not in validators_by_meta_type:
logger.error('No valid study file detected')
return
if portal_instance.cancer_type_dict is not None and not (
study_cancer_type in portal_instance.cancer_type_dict or
study_cancer_type in DEFINED_CANCER_TYPES):
study_cancer_type in studydefined_cancer_types):
logger.error(
'Cancer type of study is neither known to the portal nor defined '
'in a cancer_type file',
Expand Down
2 changes: 0 additions & 2 deletions tests/unit_tests_validate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2297,12 +2297,10 @@ class StudyCompositionTestCase(LogBufferTestCase):
def setUp(self):
"""Store validateData globals changed by running validate_study()."""
super(StudyCompositionTestCase, self).setUp()
self.orig_defined_cancer_types = validateData.DEFINED_CANCER_TYPES
self.orig_defined_sample_ids = validateData.DEFINED_SAMPLE_IDS

def tearDown(self):
"""Restore the environment to before setUp() was called."""
validateData.DEFINED_CANCER_TYPES = self.orig_defined_cancer_types
validateData.DEFINED_SAMPLE_IDS = self.orig_defined_sample_ids
super(StudyCompositionTestCase, self).tearDown()

Expand Down

0 comments on commit a8f014a

Please sign in to comment.