Skip to content

Commit 0641887

Browse files
author
oerc0042
committed
minor cleanup
1 parent 9259005 commit 0641887

10 files changed

Lines changed: 94 additions & 94 deletions

File tree

isatools/convert/isatab2json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def convert(self, work_dir):
141141
)
142142

143143
# validate json
144-
with open(join(SCHEMAS_PATH, INVESTIGATION_SCHEMA)) as json_fp:
144+
with open(join(SCHEMAS_PATH, INVESTIGATION_SCHEMA)):
145145
# investigation_schema = json.load(json_fp)
146146
# schema = DRAFT4.create_resource(investigation_schema)
147147
# registry = Registry.with_resource(investigation_schema['id'], schema)

isatools/io/isatab_configurator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def parsexml_(infile, parser=None, **kwargs):
7373

7474
try:
7575
from generatedssuper import GeneratedsSuper
76-
except ImportError as exp:
76+
except ImportError:
7777

7878
class GeneratedsSuper(object):
7979
tzoff_pattern = re_.compile(r"(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$")

isatools/isajson/validate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@ def check_utf8(fp):
549549
def check_isa_schemas(isa_json, investigation_schema_path):
550550
"""Used for rule 0003 and 4003"""
551551
try:
552-
with open(investigation_schema_path) as fp:
552+
with open(investigation_schema_path):
553+
553554
resources = []
554555
investigation_schema_path = Path(investigation_schema_path)
555556
schemas_dir = investigation_schema_path.parent

isatools/isatab/validate/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def validate_origin_mzml2isa(fp: TextIO) -> None:
264264

265265
try:
266266
fp.seek(0)
267-
report = utils.detect_isatab_process_pooling(fp)
267+
utils.detect_isatab_process_pooling(fp)
268268
except BaseException:
269269
pass
270270

tests/create/test-isacreate-ontosource.py

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -225,76 +225,76 @@ def setUp(self):
225225
)
226226

227227
# A high-throughput phenotyping imaging based phenotyping assay
228-
phenotype_assay_dict = OrderedDict(
229-
[
230-
("measurement_type", OntologyAnnotation(term="phenotyping", term_source="", term_accession="")),
231-
(
232-
"technology_type",
233-
OntologyAnnotation(term="high-throughput imaging", term_source="", term_accession=""),
234-
),
235-
("extraction", {}),
236-
(
237-
"extract",
238-
[
239-
{
240-
"node_type": EXTRACT,
241-
"characteristics_category": OntologyAnnotation(
242-
term="extract type", term_source="", term_accession=""
243-
),
244-
"characteristics_value": OntologyAnnotation(
245-
term="supernatant",
246-
term_source="OBI",
247-
term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
248-
),
249-
"size": 1,
250-
"technical_replicates": None,
251-
"is_input_to_next_protocols": True,
252-
}
253-
],
254-
),
255-
(
256-
"phenotyping by high throughput imaging",
257-
{
258-
OntologyAnnotation(
259-
term="instrument",
260-
term_source="OBI",
261-
term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
262-
): [OntologyAnnotation(term="lemnatech gigant")],
263-
OntologyAnnotation(
264-
term="acquisition_mode",
265-
term_source="OBI",
266-
term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
267-
): [
268-
OntologyAnnotation(term="UV light"),
269-
OntologyAnnotation(term="near-IR light"),
270-
OntologyAnnotation(term="far-IR light"),
271-
OntologyAnnotation(term="visible light"),
272-
],
273-
OntologyAnnotation(
274-
term="camera position",
275-
term_source="OBI",
276-
term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
277-
): ["top", "120 degree", "240 degree", "360 degree"],
278-
OntologyAnnotation(
279-
term="imaging daily schedule",
280-
term_source="OBI",
281-
term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
282-
): ["06.00", "19.00"],
283-
},
284-
),
285-
(
286-
"raw_spectral_data_file",
287-
[
288-
{
289-
"node_type": DATA_FILE,
290-
"size": 1,
291-
"technical_replicates": 2,
292-
"is_input_to_next_protocols": False,
293-
}
294-
],
295-
),
296-
]
297-
)
228+
# phenotype_assay_dict = OrderedDict(
229+
# [
230+
# ("measurement_type", OntologyAnnotation(term="phenotyping", term_source="", term_accession="")),
231+
# (
232+
# "technology_type",
233+
# OntologyAnnotation(term="high-throughput imaging", term_source="", term_accession=""),
234+
# ),
235+
# ("extraction", {}),
236+
# (
237+
# "extract",
238+
# [
239+
# {
240+
# "node_type": EXTRACT,
241+
# "characteristics_category": OntologyAnnotation(
242+
# term="extract type", term_source="", term_accession=""
243+
# ),
244+
# "characteristics_value": OntologyAnnotation(
245+
# term="supernatant",
246+
# term_source="OBI",
247+
# term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
248+
# ),
249+
# "size": 1,
250+
# "technical_replicates": None,
251+
# "is_input_to_next_protocols": True,
252+
# }
253+
# ],
254+
# ),
255+
# (
256+
# "phenotyping by high throughput imaging",
257+
# {
258+
# OntologyAnnotation(
259+
# term="instrument",
260+
# term_source="OBI",
261+
# term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
262+
# ): [OntologyAnnotation(term="lemnatech gigant")],
263+
# OntologyAnnotation(
264+
# term="acquisition_mode",
265+
# term_source="OBI",
266+
# term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
267+
# ): [
268+
# OntologyAnnotation(term="UV light"),
269+
# OntologyAnnotation(term="near-IR light"),
270+
# OntologyAnnotation(term="far-IR light"),
271+
# OntologyAnnotation(term="visible light"),
272+
# ],
273+
# OntologyAnnotation(
274+
# term="camera position",
275+
# term_source="OBI",
276+
# term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
277+
# ): ["top", "120 degree", "240 degree", "360 degree"],
278+
# OntologyAnnotation(
279+
# term="imaging daily schedule",
280+
# term_source="OBI",
281+
# term_accession="https://purl.obolibrary.org/obo/OBI_0100026",
282+
# ): ["06.00", "19.00"],
283+
# },
284+
# ),
285+
# (
286+
# "raw_spectral_data_file",
287+
# [
288+
# {
289+
# "node_type": DATA_FILE,
290+
# "size": 1,
291+
# "technical_replicates": 2,
292+
# "is_input_to_next_protocols": False,
293+
# }
294+
# ],
295+
# ),
296+
# ]
297+
# )
298298

299299
# A RNA-Seq based transcription profiling assay
300300
rna_seq_assay_dict = OrderedDict(

tests/create/test_create_models_study_design.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ def test_get_epoch_out_of_bounds_index(self):
24992499
with self.assertRaises(
25002500
IndexError, msg="An index error is raised if the epoch is out of bounds for all the StudyArms."
25012501
) as ex_cm:
2502-
epoch_cells = self.study_design.get_epoch(4)
2502+
self.study_design.get_epoch(4)
25032503
self.assertEqual(ex_cm.exception.args[0], errors.GET_EPOCH_INDEX_OUT_OR_BOUND_ERROR)
25042504

25052505
# FIXME still failing - sort this out
@@ -3502,7 +3502,7 @@ def test_compute_parallel_design_group_sizes_non_treatment_map_error(self):
35023502
self.assertEqual(ex_cm.exception.args[0], "Map for NonTreatment screen is not correctly set.")
35033503

35043504
def test_1(self):
3505-
sample_assay_plan = {}
3505+
35063506
treatments_map = [
35073507
(self.first_treatment, self.sample_assay_plan),
35083508
(self.second_treatment, self.sample_assay_plan),
@@ -3566,7 +3566,7 @@ def test_compute_single_arm_design_group_sizes_error(self):
35663566
(self.third_treatment, self.sample_assay_plan),
35673567
]
35683568
with self.assertRaises(TypeError, msg="The group_sizes list has the wrong length") as ex_cm:
3569-
single_arm_design = StudyDesignFactory.compute_single_arm_design(treatments_map, group_size=[10, 12])
3569+
StudyDesignFactory.compute_single_arm_design(treatments_map, group_size=[10, 12])
35703570
self.assertEqual(ex_cm.exception.args[0], errors.GROUP_SIZES_ERROR)
35713571

35723572
def test_compute_concomitant_treatment_design_three_treatments(self):
@@ -3652,7 +3652,7 @@ def test_compute_concomitant_treatment_design_three_treatments_run_in(self):
36523652
def test_compute_concomitant_treatment_design_group_size_error(self):
36533653
treatments = [self.first_treatment, self.third_treatment, self.fourth_treatment]
36543654
with self.assertRaises(TypeError, msg="The group_sizes list has the wrong length") as ex_cm:
3655-
concomitant_treatment_design = StudyDesignFactory.compute_concomitant_treatments_design(
3655+
StudyDesignFactory.compute_concomitant_treatments_design(
36563656
treatments, self.sample_assay_plan, group_size=[10, 12, 13]
36573657
)
36583658
self.assertEqual(ex_cm.exception.args[0], errors.GROUP_SIZES_ERROR)
@@ -3755,7 +3755,7 @@ def test_compute_crossover_design_multi_element_cell_three_treatments(self):
37553755
def test_compute_crossover_design_multi_element_cell_group_sizes_error(self):
37563756
treatments = [self.first_treatment, self.third_treatment, self.fourth_treatment]
37573757
with self.assertRaises(TypeError, msg="The group_sizes list has the wrong length") as ex_cm:
3758-
crossover_design_with_multi_element_cell = StudyDesignFactory.compute_crossover_design_multi_element_cell(
3758+
StudyDesignFactory.compute_crossover_design_multi_element_cell(
37593759
treatments,
37603760
self.sample_assay_plan,
37613761
group_sizes=(10, 15, 12, 15, 12),
@@ -3810,7 +3810,7 @@ def test_compute_single_arm_design_multi_element_cell_three_treatments(self):
38103810
def test_compute_single_arm_design_multi_element_cell_group_sizes_error(self):
38113811
treatments = [self.first_treatment, self.third_treatment, self.fourth_treatment]
38123812
with self.assertRaises(TypeError, msg="The group_sizes list has the wrong length") as ex_cm:
3813-
crossover_design_with_multi_element_cell = StudyDesignFactory.compute_single_arm_design_multi_element_cell(
3813+
StudyDesignFactory.compute_single_arm_design_multi_element_cell(
38143814
treatments,
38153815
self.sample_assay_plan,
38163816
group_size=(10, 15, 12),

tests/isatab/test_isatab.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_isatab_flatten(self):
132132
flatten(test_list)
133133

134134
def test_isatab_get_pv_columns(self):
135-
columns = []
135+
# columns = []
136136
pp = ProtocolParameter(parameter_name="test_parameter_name")
137137
with self.assertRaises(AttributeError):
138138
pv = ParameterValue(category="test_parameter_name", value=3)
@@ -1073,9 +1073,9 @@ def test_isatab_dump_investigation_with_assay(self):
10731073

10741074
from isatools.model import _build_assay_graph
10751075

1076-
graph = _build_assay_graph(study.process_sequence)
1077-
graph1 = _build_assay_graph(assay1.process_sequence)
1078-
graph2 = _build_assay_graph(assay2.process_sequence)
1076+
_build_assay_graph(study.process_sequence)
1077+
# graph1 = _build_assay_graph(assay1.process_sequence)
1078+
# graph2 = _build_assay_graph(assay2.process_sequence)
10791079

10801080
try:
10811081
isatab.dump(investigation, self._tmp_dir)

tests/test_tests_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_assert_tab_content_equal_investigation(self):
9494
self.assertTrue(utils.assert_tab_content_equal(i_tab1, i_tab2))
9595

9696
def test_assert_tab_content_equal_investigation_except(self):
97-
with self.assertRaises(OSError) as context:
97+
with self.assertRaises(OSError):
9898
with open(os.path.join(utils.TAB_DATA_DIR, "BII-I-1", "i_investigation.txt")) as i_tab1:
9999
with open(os.path.join(utils.TAB_DATA_DIR, "BII-S-3", "i_gilbert.txt")) as i_tab2:
100100
self.assertEqual(

tests/validators/test_validate_test_data.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,7 @@ def setUp(self):
358358
def test_validate_testdata_sampleassayplan_json(self):
359359
with open(os.path.join(utils.JSON_DATA_DIR, "create", "sampleassayplan_test.json")) as test_case_fp:
360360
with open(os.path.join(self.v2_create_schemas_path, "sample_assay_plan_schema.json")) as fp:
361-
sample_assay_plan_schema = json.load(fp)
362-
361+
json.load(fp)
363362
resources = []
364363
res_path = (
365364
pathlib.Path("file://", self.v2_create_schemas_path, "sample_assay_plan_schema.json")
@@ -381,7 +380,7 @@ def test_validate_testdata_sampleassayplan_json(self):
381380
def test_validate_testdata_sampleassayplan_qc_json(self):
382381
with open(os.path.join(utils.JSON_DATA_DIR, "create", "sampleassayplan_qc_test.json")) as test_case_fp:
383382
with open(os.path.join(self.v2_create_schemas_path, "sample_assay_plan_schema.json")) as fp:
384-
sample_assay_plan_schema = json.load(fp)
383+
json.load(fp)
385384

386385
resources = []
387386
schemas_dir = Path("file://", self.v2_create_schemas_path)
@@ -403,7 +402,7 @@ def test_validate_testdata_sampleassayplan_qc_json(self):
403402
def test_validate_testdata_treatment_sequence_json(self):
404403
with open(os.path.join(utils.JSON_DATA_DIR, "create", "treatment_sequence_test.json")) as test_case_fp:
405404
with open(os.path.join(self.v2_create_schemas_path, "treatment_sequence_schema.json")) as fp:
406-
treatment_sequence_schema = json.load(fp)
405+
json.load(fp)
407406
# res_path = pathlib.Path("file://", self.v2_create_schemas_path, "treatment_sequence_schema.json").as_uri()
408407
# resolver = RefResolver(res_path, treatment_sequence_schema)
409408
# validator = Draft4Validator(treatment_sequence_schema, resolver=resolver)

tests/validators/test_validators.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,11 +484,11 @@ def test_info_reporting_mtbls1_isatab(self):
484484
report = isatab.validate(
485485
fp=test_case_fp, config_dir=utils.DEFAULT2015_XML_CONFIGS_DATA_DIR, log_level=self._reporting_level
486486
)
487-
# self.assertIn(
488-
# {'supplemental': 'Found 4 study groups in s_MTBLS1.txt',
489-
# 'code': 5001,
490-
# 'message': 'Found 4 study groups in s_MTBLS1.txt'},
491-
# report['info'])
487+
self.assertIn(
488+
{'supplemental': 'Found 4 study groups in s_MTBLS1.txt',
489+
'code': 5001,
490+
'message': 'Found 4 study groups in s_MTBLS1.txt'},
491+
report['info'])
492492

493493

494494
class TestBatchValidateIsaTab(unittest.TestCase):

0 commit comments

Comments
 (0)