Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sellth committed Jul 27, 2023
1 parent f381a2e commit 2e41a06
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 52 deletions.
1 change: 0 additions & 1 deletion altamisa/apps/isatab2dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def print_dot(
proc_shape="ellipse",
proc_color="blue",
):

print(indent + "/* materials */", file=outf)
for name, mat in obj.materials.items():
label = json.dumps("{}:\n{}\n({})".format(mat.type, mat.name if mat.name else "-", name))
Expand Down
40 changes: 20 additions & 20 deletions altamisa/constants/investigation_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
INVESTIGATION_PUBLICATION_TITLE = "Investigation Publication Title" #:
INVESTIGATION_PUBLICATION_STATUS = "Investigation Publication Status" #:
INVESTIGATION_PUBLICATION_STATUS_TERM_ACCESSION_NUMBER = (
"Investigation Publication Status Term Accession Number"
) #:
"Investigation Publication Status Term Accession Number" #:
)
INVESTIGATION_PUBLICATION_STATUS_TERM_SOURCE_REF = (
"Investigation Publication Status Term Source REF"
) #:
"Investigation Publication Status Term Source REF" #:
)
#: Collected header keys of INVESTIGATION PUBLICATIONS
INVESTIGATION_PUBLICATIONS_KEYS = (
INVESTIGATION_PUBMED_ID,
Expand All @@ -96,8 +96,8 @@
INVESTIGATION_PERSON_AFFILIATION = "Investigation Person Affiliation" #:
INVESTIGATION_PERSON_ROLES = "Investigation Person Roles" #:
INVESTIGATION_PERSON_ROLES_TERM_ACCESSION_NUMBER = (
"Investigation Person Roles Term Accession Number"
) #:
"Investigation Person Roles Term Accession Number" #:
)
INVESTIGATION_PERSON_ROLES_TERM_SOURCE_REF = "Investigation Person Roles Term Source REF" #:
#: Collected header keys of INVESTIGATION CONTACTS section
INVESTIGATION_CONTACTS_KEYS = (
Expand Down Expand Up @@ -152,8 +152,8 @@
STUDY_PUBLICATION_TITLE = "Study Publication Title" #:
STUDY_PUBLICATION_STATUS = "Study Publication Status" #:
STUDY_PUBLICATION_STATUS_TERM_ACCESSION_NUMBER = (
"Study Publication Status Term Accession Number"
) #:
"Study Publication Status Term Accession Number" #:
)
STUDY_PUBLICATION_STATUS_TERM_SOURCE_REF = "Study Publication Status Term Source REF" #:
#: Collected header keys of STUDY PUBLICATIONS section
STUDY_PUBLICATIONS_KEYS = (
Expand Down Expand Up @@ -185,13 +185,13 @@
STUDY_ASSAY_FILE_NAME = "Study Assay File Name" #:
STUDY_ASSAY_MEASUREMENT_TYPE = "Study Assay Measurement Type" #:
STUDY_ASSAY_MEASUREMENT_TYPE_TERM_ACCESSION_NUMBER = (
"Study Assay Measurement Type Term Accession Number"
) #:
"Study Assay Measurement Type Term Accession Number" #:
)
STUDY_ASSAY_MEASUREMENT_TYPE_TERM_SOURCE_REF = "Study Assay Measurement Type Term Source REF" #:
STUDY_ASSAY_TECHNOLOGY_TYPE = "Study Assay Technology Type" #:
STUDY_ASSAY_TECHNOLOGY_TYPE_TERM_ACCESSION_NUMBER = (
"Study Assay Technology Type Term Accession Number"
) #:
"Study Assay Technology Type Term Accession Number" #:
)
STUDY_ASSAY_TECHNOLOGY_TYPE_TERM_SOURCE_REF = "Study Assay Technology Type Term Source REF" #:
STUDY_ASSAY_TECHNOLOGY_PLATFORM = "Study Assay Technology Platform" #:
#: Collected header keys of STUDY ASSAYS section
Expand All @@ -217,19 +217,19 @@
STUDY_PROTOCOL_VERSION = "Study Protocol Version" #:
STUDY_PROTOCOL_PARAMETERS_NAME = "Study Protocol Parameters Name" #:
STUDY_PROTOCOL_PARAMETERS_NAME_TERM_ACCESSION_NUMBER = (
"Study Protocol Parameters Name Term Accession Number"
) #:
"Study Protocol Parameters Name Term Accession Number" #:
)
STUDY_PROTOCOL_PARAMETERS_NAME_TERM_SOURCE_REF = (
"Study Protocol Parameters Name Term Source REF"
) #:
"Study Protocol Parameters Name Term Source REF" #:
)
STUDY_PROTOCOL_COMPONENTS_NAME = "Study Protocol Components Name" #:
STUDY_PROTOCOL_COMPONENTS_TYPE = "Study Protocol Components Type" #:
STUDY_PROTOCOL_COMPONENTS_TYPE_TERM_ACCESSION_NUMBER = (
"Study Protocol Components Type Term Accession Number"
) #:
"Study Protocol Components Type Term Accession Number" #:
)
STUDY_PROTOCOL_COMPONENTS_TYPE_TERM_SOURCE_REF = (
"Study Protocol Components Type Term Source REF"
) #:
"Study Protocol Components Type Term Source REF" #:
)
#: Collected header keys of STUDY PROTOCOLS section
STUDY_PROTOCOLS_KEYS = (
STUDY_PROTOCOL_NAME,
Expand Down
4 changes: 2 additions & 2 deletions altamisa/constants/table_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
METABOLITE_ASSIGNMENT_FILE = "Metabolite Assignment File" #:
PEPTIDE_ASSIGNMENT_FILE = "Peptide Assignment File" #:
POST_TRANSLATIONAL_MODIFICATION_ASSIGNMENT_FILE = (
"Post Translational Modification Assignment File"
) #:
"Post Translational Modification Assignment File" #:
)
PROTEIN_ASSIGNMENT_FILE = "Protein Assignment File" #:
RAW_DATA_FILE = "Raw Data File" #:
RAW_SPECTRAL_DATA_FILE = "Raw Spectral Data File" #:
Expand Down
9 changes: 3 additions & 6 deletions altamisa/isatab/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ class Comment:

@attr.s(auto_attribs=True, frozen=True)
class OntologyRef:
"""Description of an ontology term source, as used for investigation file.
"""
"""Description of an ontology term source, as used for investigation file."""

#: The name of the ontology (e.g., ``CEBI``)
name: str
Expand All @@ -112,8 +111,7 @@ class OntologyRef:

@attr.s(auto_attribs=True, frozen=True)
class BasicInfo:
"""Basic metadata for an investigation or study (``INVESTIGATION`` or ``STUDY``).
"""
"""Basic metadata for an investigation or study (``INVESTIGATION`` or ``STUDY``)."""

#: Path to the investigation or study file
path: Path
Expand All @@ -135,8 +133,7 @@ class BasicInfo:

@attr.s(auto_attribs=True, frozen=True)
class PublicationInfo:
"""Information regarding an investigation publication (``INVESTIGATION PUBLICATIONS``).
"""
"""Information regarding an investigation publication (``INVESTIGATION PUBLICATIONS``)."""

#: Publication PubMed ID
pubmed_id: str
Expand Down
4 changes: 2 additions & 2 deletions altamisa/isatab/parse_investigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _split_study_protocols_parameters(
tpl = "Repeated protocol parameter; found: {}"
msg = tpl.format(names)
raise ParseIsatabException(msg)
for (name, acc, src) in zip(names, name_term_accs, name_term_srcs):
for name, acc, src in zip(names, name_term_accs, name_term_srcs):
if any((name, acc, src)): # skips empty parameters
yield models.OntologyTermRef(name, acc, src)

Expand All @@ -79,7 +79,7 @@ def _split_study_protocols_components(
tpl = "Repeated protocol components; found: {}"
msg = tpl.format(names)
raise ParseIsatabException(msg)
for (name, ctype, acc, src) in zip(
for name, ctype, acc, src in zip(
names, types, type_term_accs, type_term_srcs
): # pragma: no cover
if not name and any((ctype, acc, src)):
Expand Down
3 changes: 1 addition & 2 deletions altamisa/isatab/write_assay_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ def run(self):


class _WriterBase:
"""Base class that writes a file from an ``Study`` or ``Assay`` object.
"""
"""Base class that writes a file from an ``Study`` or ``Assay`` object."""

#: Note type starting a graph
_starting_type = None
Expand Down
12 changes: 6 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
master_doc = "index"

# General information about the project.
project = u"AltamISA"
copyright = u"2018-2019, Berlin Institute of Health"
author = u"Mathias Kuhring, Manuel Holtgrewe"
project = "AltamISA"
copyright = "2018-2019, Berlin Institute of Health"
author = "Mathias Kuhring, Manuel Holtgrewe"

# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
Expand Down Expand Up @@ -132,15 +132,15 @@
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, "altamisa.tex", u"AltamISA Documentation", u"Core Unit Bioinformatics", "manual")
(master_doc, "altamisa.tex", "AltamISA Documentation", "Core Unit Bioinformatics", "manual")
]


# -- Options for manual page output ------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "altamisa", u"AltamISA Documentation", [author], 1)]
man_pages = [(master_doc, "altamisa", "AltamISA Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------
Expand All @@ -152,7 +152,7 @@
(
master_doc,
"altamisa",
u"AltamISA Documentation",
"AltamISA Documentation",
author,
"altamisa",
"One line description of project.",
Expand Down
15 changes: 5 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,23 @@ def small_assay_file():

@pytest.fixture
def full_investigation_file():
"""This file contains values for each normal investigation section and key.
"""
"""This file contains values for each normal investigation section and key."""
path = os.path.join(os.path.dirname(__file__), "data/i_fullinvest/i_fullinvest.txt")
with open(path, "rt") as file:
yield file


@pytest.fixture
def full2_investigation_file():
"""This file contains values for each normal investigation section and key.
"""
"""This file contains values for each normal investigation section and key."""
path = os.path.join(os.path.dirname(__file__), "data/i_fullinvest2/i_fullinvest2.txt")
with open(path, "rt") as file:
yield file


@pytest.fixture
def comment_investigation_file():
"""This file contains comments for each investigation section.
"""
"""This file contains comments for each investigation section."""
path = os.path.join(os.path.dirname(__file__), "data/i_comments/i_comments.txt")
with open(path, "rt") as file:
yield file
Expand Down Expand Up @@ -124,8 +121,7 @@ def small2_study_file():

@pytest.fixture
def small2_assay_file():
"""This file contains splitting and pooling examples.
"""
"""This file contains splitting and pooling examples."""
path = os.path.join(os.path.dirname(__file__), "data/i_small2/a_small2.txt")
with open(path, "rt") as file:
yield file
Expand All @@ -140,8 +136,7 @@ def gelelect_investigation_file():

@pytest.fixture
def gelelect_assay_file():
"""This file contains special cases for gel electrophoresis assays.
"""
"""This file contains special cases for gel electrophoresis assays."""
path = os.path.join(
os.path.dirname(__file__),
"data/test_gelelect/a_study01_protein_expression_profiling_gel_electrophoresis.txt",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_header_exception_simple_header_not_allowed(assay_file_exception_simple_


def test_header_exception_labeled_header_not_allowed(
assay_file_exception_labeled_header_not_allowed
assay_file_exception_labeled_header_not_allowed,
):
with pytest.raises(ParseIsatabException) as excinfo:
AssayReader.from_stream("S1", "A1", assay_file_exception_labeled_header_not_allowed)
Expand All @@ -35,7 +35,7 @@ def test_header_exception_unknown_header(assay_file_exception_unknown_header):


def test_header_exception_term_source_ref_next_column(
assay_file_exception_term_source_ref_next_column
assay_file_exception_term_source_ref_next_column,
):
with pytest.raises(ParseIsatabException) as excinfo:
AssayReader.from_stream("S1", "A1", assay_file_exception_term_source_ref_next_column)
Expand All @@ -44,7 +44,7 @@ def test_header_exception_term_source_ref_next_column(


def test_header_exception_term_source_ref_stop_iteration(
assay_file_exception_term_source_ref_stop_iteration
assay_file_exception_term_source_ref_stop_iteration,
):
with pytest.raises(ParseIsatabException) as excinfo:
AssayReader.from_stream("S1", "A1", assay_file_exception_term_source_ref_stop_iteration)
Expand Down

0 comments on commit 2e41a06

Please sign in to comment.