File size: 1,431 Bytes
c97ac7e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from .constants import AA_MASSES_DICT, M_H, STANDARD_AMINO_ACIDS

__all__ = [
    "AA_MASSES_DICT",
    "M_H",
    "STANDARD_AMINO_ACIDS",
    "MAX_PEPTIDE_LENGTH",
    "MIN_PEPTIDE_LENGTH",
    "NUM_LENGTH_CLASSES",
    "SpectrumDataSet",
    "build_dataloader",
    "build_vocabulary",
    "apply_length_padding",
    "class_to_length",
    "clamp_length",
    "decoder_output_size",
    "decoder_output_token_ids",
    "get_aa_masses",
    "get_dataset",
    "get_output_aa_masses",
    "length_to_active_mask",
    "length_to_class",
    "spectrum_collate",
    "validate_peptide_length",
]

_LENGTH_NAMES = {
    "MAX_PEPTIDE_LENGTH",
    "MIN_PEPTIDE_LENGTH",
    "NUM_LENGTH_CLASSES",
    "apply_length_padding",
    "class_to_length",
    "clamp_length",
    "length_to_active_mask",
    "length_to_class",
    "validate_peptide_length",
}

_DATA_NAMES = {
    "SpectrumDataSet",
    "build_dataloader",
    "build_vocabulary",
    "decoder_output_size",
    "decoder_output_token_ids",
    "get_aa_masses",
    "get_dataset",
    "get_output_aa_masses",
    "spectrum_collate",
}


def __getattr__(name: str):
    if name in _LENGTH_NAMES:
        from . import lengths as lengths_module

        return getattr(lengths_module, name)
    if name in _DATA_NAMES:
        from . import data as data_module

        return getattr(data_module, name)
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")