Skip to content

Commit

Permalink
test for ontology reference mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
sellth committed Oct 31, 2023
1 parent fdaed85 commit 8347193
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ def small2_investigation_file():
yield file


@pytest.fixture
def small2o_investigation_file():
"""This file contains an ontology reference for one of the protocol parameters."""
path = os.path.join(os.path.dirname(__file__), "data/i_small2/i_small2_o.txt")
with open(path, "rt") as file:
yield file


@pytest.fixture
def small2_study_file():
path = os.path.join(os.path.dirname(__file__), "data/i_small2/s_small2.txt")
Expand Down
93 changes: 93 additions & 0 deletions tests/data/i_small2/i_small2_o.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
ONTOLOGY SOURCE REFERENCE
Term Source Name OBI NCBITAXON ROLEO
Term Source File http://data.bioontology.org/ontologies/OBI http://data.bioontology.org/ontologies/NCBITAXON http://data.bioontology.org/ontologies/ROLEO
Term Source Version 31 8 1
Term Source Description Ontology for Biomedical Investigations National Center for Biotechnology Information (NCBI) Organismal Classification Role Ontology
INVESTIGATION
Investigation Identifier i_small2
Investigation Title Small Investigation
Investigation Description
Investigation Submission Date
Investigation Public Release Date
INVESTIGATION PUBLICATIONS
Investigation PubMed ID
Investigation Publication DOI
Investigation Publication Author List
Investigation Publication Title
Investigation Publication Status
Investigation Publication Status Term Accession Number
Investigation Publication Status Term Source REF
INVESTIGATION CONTACTS
Investigation Person Last Name
Investigation Person First Name
Investigation Person Mid Initials
Investigation Person Email
Investigation Person Phone
Investigation Person Fax
Investigation Person Address
Investigation Person Affiliation
Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier s_small2
Study Title Small Germline Study
Study Description
Comment[Study Grant Number]
Comment[Study Funding Agency]
Study Submission Date
Study Public Release Date
Study File Name s_small2.txt
STUDY DESIGN DESCRIPTORS
Study Design Type
Study Design Type Term Accession Number
Study Design Type Term Source REF
STUDY PUBLICATIONS
Study PubMed ID
Study Publication DOI
Study Publication Author List
Study Publication Title
Study Publication Status
Study Publication Status Term Accession Number
Study Publication Status Term Source REF
STUDY FACTORS
Study Factor Name
Study Factor Type
Study Factor Type Term Accession Number
Study Factor Type Term Source REF
STUDY ASSAYS
Study Assay File Name a_small2.txt
Study Assay Measurement Type protein expression profiling
Study Assay Measurement Type Term Accession Number http://purl.obolibrary.org/obo/OBI_0000615
Study Assay Measurement Type Term Source REF OBI
Study Assay Technology Type mass spectrometry
Study Assay Technology Type Term Accession Number http://purl.obolibrary.org/obo/OBI_0000470
Study Assay Technology Type Term Source REF OBI
Study Assay Technology Platform LC-MS/MS
STUDY PROTOCOLS
Study Protocol Name sample collection extraction labeling chromatography mass spectrometry data transformation
Study Protocol Type sample collection extraction labeling chromatography mass spectrometry data transformation
Study Protocol Type Term Accession Number
Study Protocol Type Term Source REF
Study Protocol Description
Study Protocol URI
Study Protocol Version
Study Protocol Parameters Name method;instrument
Study Protocol Parameters Name Term Accession Number ;123
Study Protocol Parameters Name Term Source REF ;OBI
Study Protocol Components Name
Study Protocol Components Type
Study Protocol Components Type Term Accession Number
Study Protocol Components Type Term Source REF
STUDY CONTACTS
Study Person Last Name Doe
Study Person First Name John
Study Person Mid Initials
Study Person Email
Study Person Phone
Study Person Fax
Study Person Address
Study Person Affiliation
Study Person Roles author
Study Person Roles Term Accession Number http://purl.obolibrary.org/obo/RoleO_0000061
Study Person Roles Term Source REF ROLEO
11 changes: 10 additions & 1 deletion tests/test_modify_investigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ def test_forge(assays_investigation_file):
InvestigationForge(assays_investigation_file.name)


def test_add_assay(small_investigation_file, small2_investigation_file, assays_investigation_file):
def test_add_assay(
small_investigation_file,
small2_investigation_file,
assays_investigation_file,
small2o_investigation_file,
):
forge = InvestigationForge(small_investigation_file.name)
forge.add_assay(small2_investigation_file.name)
output = forge.investigation
Expand All @@ -19,3 +24,7 @@ def test_add_assay(small_investigation_file, small2_investigation_file, assays_i
# multiple studies
with pytest.raises(IndexError):
forge.add_assay(assays_investigation_file.name)

# ontology reference mismatch
with pytest.raises(ValueError):
forge.add_assay(small2o_investigation_file.name)

0 comments on commit 8347193

Please sign in to comment.