Skip to content

v020

get_peptides(spec, data_files, root_dir=Path.cwd(), **kwargs)

Get peptides from the spec

Source code in hdxms_datasets/migration/v020.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def get_peptides(
    spec: dict, data_files: dict, root_dir: Path = Path.cwd(), **kwargs
) -> list[Peptides]:
    """Get peptides from the spec"""

    peptides = []
    for deut_type, p_spec in spec.items():
        data_file = data_files[p_spec["data_file"]]
        p = Peptides(
            data_file=root_dir / data_file["filename"],
            data_format=data_file["format"],
            deuteration_type=deut_type,
            filters=p_spec.get("filters", {}),
            **kwargs,
            **get_metadata(p_spec),
        )

        peptides.append(p)

    return peptides