Skip to content

Metdata

MASSIVE.metadata

Meant to contain metadata classes that can be added to Samples if desired. Enzyme is an example. Metadata can enrich visualizations (see Plate.show_sample_positions() as an example).

Enzyme

Bases: object

Used to standardize naming and retrieval of enzyme variant attributes.

Source code in MASSIVE/metadata.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Enzyme(object):
    """
    Used to standardize naming and retrieval of enzyme variant attributes.
    """
    def __init__(self, id:int, name:str, mutation:str="WT", organism:str=None):
        """

        Args:
            id: Unique, incremental identifier for each variant.
            name: Enzyme name, e.g. 'T7_RNAP'
            mutation: Amino acid substitution relative to WT, like "T47A" or "WT"
            organism: Organism name, e.g. 'T7_bacteriophage'
        """
        self.id = id
        self.name = name
        self.mutation = mutation
        self.organism = organism

    def __str__(self):
        return f"{self.id}, {self.mutation}"

    def get_aa_position(self) -> int|None:
        """
        returns integer value of amino acid position from `Enzyme.mutation`.

        Examples:<br>
            "D83A" return int(83)<br>
            "S340P" returns int(340)<br>
            "WT" returns None<br>
            "blah" returns None<br>
        """
        try:
            pos = int(self.mutation[1:-1])
            return pos
        except ValueError:  # happens if there is text entered in self.mutation
            return None
        except TypeError:   # happens if self.mutation is None
            return None

__init__(id, name, mutation='WT', organism=None)

Parameters:

Name Type Description Default
id int

Unique, incremental identifier for each variant.

required
name str

Enzyme name, e.g. 'T7_RNAP'

required
mutation str

Amino acid substitution relative to WT, like "T47A" or "WT"

'WT'
organism str

Organism name, e.g. 'T7_bacteriophage'

None
Source code in MASSIVE/metadata.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
def __init__(self, id:int, name:str, mutation:str="WT", organism:str=None):
    """

    Args:
        id: Unique, incremental identifier for each variant.
        name: Enzyme name, e.g. 'T7_RNAP'
        mutation: Amino acid substitution relative to WT, like "T47A" or "WT"
        organism: Organism name, e.g. 'T7_bacteriophage'
    """
    self.id = id
    self.name = name
    self.mutation = mutation
    self.organism = organism

get_aa_position()

returns integer value of amino acid position from Enzyme.mutation.

Examples:
"D83A" return int(83)
"S340P" returns int(340)
"WT" returns None
"blah" returns None

Source code in MASSIVE/metadata.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def get_aa_position(self) -> int|None:
    """
    returns integer value of amino acid position from `Enzyme.mutation`.

    Examples:<br>
        "D83A" return int(83)<br>
        "S340P" returns int(340)<br>
        "WT" returns None<br>
        "blah" returns None<br>
    """
    try:
        pos = int(self.mutation[1:-1])
        return pos
    except ValueError:  # happens if there is text entered in self.mutation
        return None
    except TypeError:   # happens if self.mutation is None
        return None