Skip to content

formats

DynamX_v3_cluster

Source code in hdxms_datasets/formats.py
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class DynamX_v3_cluster:
    columns = [
        "Protein",
        "Start",
        "End",
        "Sequence",
        "Modification",
        "Fragment",
        "MaxUptake",
        "MHP",
        "State",
        "Exposure",
        "File",
        "z",
        "RT",
        "Inten",
        "Center",
    ]
    state_name = "State"
    exposure_name = "Exposure"

    def convert(self, df: nw.DataFrame) -> nw.DataFrame:
        """
        Convert the DataFrame to a standard format.
        """
        return from_dynamx_cluster(df)

convert(df)

Convert the DataFrame to a standard format.

Source code in hdxms_datasets/formats.py
68
69
70
71
72
def convert(self, df: nw.DataFrame) -> nw.DataFrame:
    """
    Convert the DataFrame to a standard format.
    """
    return from_dynamx_cluster(df)

DynamX_v3_state

Source code in hdxms_datasets/formats.py
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
43
44
class DynamX_v3_state:
    columns = [
        "Protein",
        "Start",
        "End",
        "Sequence",
        "Modification",
        "Fragment",
        "MaxUptake",
        "MHP",
        "State",
        "Exposure",
        "Center",
        "Center SD",
        "Uptake",
        "Uptake SD",
        "RT",
        "RT SD",
    ]
    state_name = "State"
    exposure_name = "Exposure"

    def convert(self, df: nw.DataFrame) -> nw.DataFrame:
        """
        Convert the DataFrame to a standard format.
        """
        return from_dynamx_state(df)

convert(df)

Convert the DataFrame to a standard format.

Source code in hdxms_datasets/formats.py
40
41
42
43
44
def convert(self, df: nw.DataFrame) -> nw.DataFrame:
    """
    Convert the DataFrame to a standard format.
    """
    return from_dynamx_state(df)

HDExaminer_v3

Source code in hdxms_datasets/formats.py
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
class HDExaminer_v3:
    columns = [
        "Protein State",
        "Deut Time",
        "Experiment",
        "Start",
        "End",
        "Sequence",
        "Charge",
        "Search RT",
        "Actual RT",
        "# Spectra",
        "Peak Width Da",
        "m/z Shift Da",
        "Max Inty",
        "Exp Cent",
        "Theor Cent",
        "Score",
        "Cent Diff",
        "# Deut",
        "Deut %",
        "Confidence",
    ]
    state_name = "Protein State"
    exposure_name = "Deut Time"

    def convert(self, df: nw.DataFrame) -> nw.DataFrame:
        """
        Convert the DataFrame to a standard format.
        """
        return from_hdexaminer(df)

convert(df)

Convert the DataFrame to a standard format.

Source code in hdxms_datasets/formats.py
101
102
103
104
105
def convert(self, df: nw.DataFrame) -> nw.DataFrame:
    """
    Convert the DataFrame to a standard format.
    """
    return from_hdexaminer(df)

HDXFormat

Bases: Protocol

Source code in hdxms_datasets/formats.py
 6
 7
 8
 9
10
11
12
13
14
15
class HDXFormat(Protocol):
    columns: list[str]
    state_name: str
    exposure_name: str

    def convert(self, df: nw.DataFrame) -> nw.DataFrame:
        """
        Convert the DataFrame to a standard format.
        """
        ...

convert(df)

Convert the DataFrame to a standard format.

Source code in hdxms_datasets/formats.py
11
12
13
14
15
def convert(self, df: nw.DataFrame) -> nw.DataFrame:
    """
    Convert the DataFrame to a standard format.
    """
    ...

identify_format(cols, *, exact=True)

Identify which HDXFormat subclass the given column list matches.

Parameters:

Name Type Description Default
cols list[str]

The column names to check.

required
exact bool

If True, order must match; otherwise, uses set equality.

True

Returns:

Type Description
Optional[HDXFormat]

The matching HDXFormat subclass, or None if no match.

Source code in hdxms_datasets/formats.py
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
def identify_format(cols: list[str], *, exact: bool = True) -> Optional[HDXFormat]:
    """
    Identify which HDXFormat subclass the given column list matches.

    Args:
        cols: The column names to check.
        exact: If True, order must match; otherwise, uses set equality.

    Returns:
        The matching HDXFormat subclass, or None if no match.
    """
    for fmt_class in HDX_FORMATS:
        template = fmt_class.columns
        if exact and cols == template:
            return fmt_class
        elif not exact and set(cols) == set(template):
            return fmt_class
    return None