aegis_sim.recording.phenomaprecorder

 1import pandas as pd
 2import logging
 3import pathlib
 4
 5from .recorder import Recorder
 6from aegis_sim import submodels
 7
 8
 9class PhenomapRecorder(Recorder):
10    """
11
12    Records once.
13    """
14
15    def __init__(self, odir: pathlib.Path):
16        self.odir = odir
17        self.init_odir()
18
19    def write(self):
20        """
21
22        # OUTPUT SPECIFICATION
23        path: /phenomap.csv
24        filetype: csv
25        category: genotype
26        description: A static list of phenotypic effects of each genomic site.
27        trait granularity: N/A
28        time granularity: N/A
29        frequency parameter: once
30        structure: A table with four columns: effector site index, affected trait, affected age, effect magnitude. Each row represents an effect of a single site on a specific trait expressed at a specific age.
31        """
32        architecture = submodels.architect.architecture
33
34        if hasattr(architecture, "phenomap") and architecture.phenomap.phenolist:
35            phenolist = architecture.phenomap.phenolist
36            df = pd.DataFrame(phenolist)
37            df.to_csv(self.odir / "phenomap.csv", index=None, header=["bit", "trait", "age", "weight"])
38        else:
39            logging.info("Phenomap is empty.")
class PhenomapRecorder(aegis_sim.recording.recorder.Recorder):
10class PhenomapRecorder(Recorder):
11    """
12
13    Records once.
14    """
15
16    def __init__(self, odir: pathlib.Path):
17        self.odir = odir
18        self.init_odir()
19
20    def write(self):
21        """
22
23        # OUTPUT SPECIFICATION
24        path: /phenomap.csv
25        filetype: csv
26        category: genotype
27        description: A static list of phenotypic effects of each genomic site.
28        trait granularity: N/A
29        time granularity: N/A
30        frequency parameter: once
31        structure: A table with four columns: effector site index, affected trait, affected age, effect magnitude. Each row represents an effect of a single site on a specific trait expressed at a specific age.
32        """
33        architecture = submodels.architect.architecture
34
35        if hasattr(architecture, "phenomap") and architecture.phenomap.phenolist:
36            phenolist = architecture.phenomap.phenolist
37            df = pd.DataFrame(phenolist)
38            df.to_csv(self.odir / "phenomap.csv", index=None, header=["bit", "trait", "age", "weight"])
39        else:
40            logging.info("Phenomap is empty.")

Records once.

PhenomapRecorder(odir: pathlib.Path)
16    def __init__(self, odir: pathlib.Path):
17        self.odir = odir
18        self.init_odir()
odir
def write(self):
20    def write(self):
21        """
22
23        # OUTPUT SPECIFICATION
24        path: /phenomap.csv
25        filetype: csv
26        category: genotype
27        description: A static list of phenotypic effects of each genomic site.
28        trait granularity: N/A
29        time granularity: N/A
30        frequency parameter: once
31        structure: A table with four columns: effector site index, affected trait, affected age, effect magnitude. Each row represents an effect of a single site on a specific trait expressed at a specific age.
32        """
33        architecture = submodels.architect.architecture
34
35        if hasattr(architecture, "phenomap") and architecture.phenomap.phenolist:
36            phenolist = architecture.phenomap.phenolist
37            df = pd.DataFrame(phenolist)
38            df.to_csv(self.odir / "phenomap.csv", index=None, header=["bit", "trait", "age", "weight"])
39        else:
40            logging.info("Phenomap is empty.")

OUTPUT SPECIFICATION

path: /phenomap.csv filetype: csv category: genotype description: A static list of phenotypic effects of each genomic site. trait granularity: N/A time granularity: N/A frequency parameter: once structure: A table with four columns: effector site index, affected trait, affected age, effect magnitude. Each row represents an effect of a single site on a specific trait expressed at a specific age.