catalogue
Instanciate the catalogue
ResistanceCatalogue
Resistance catalogue loading
Source code in piezo/catalogue.py
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 |
|
__init__(catalogue_file, prediction_subset_only=False)
Construct a resistance catalogue
Parameters:
Name | Type | Description | Default |
---|---|---|---|
catalogue_file
|
str
|
Path to the catalogue file |
required |
prediction_subset_only
|
bool
|
Whether to use a subset of genes to only resistance genes. Defaults to False. |
False
|
Source code in piezo/catalogue.py
18 19 20 21 22 23 24 25 26 |
|
predict(mutation, verbose=False, show_evidence=False)
Make a prediction of a mutation's effects based on the catalogue
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mutation
|
str
|
Mutation in GARC |
required |
verbose
|
bool
|
Whether to be verbose. Defaults to False. DEPRECIATED |
False
|
show_evidence
|
bool
|
If True predictions are returned as
( |
False
|
Returns:
Type | Description |
---|---|
Dict[str, Tuple] | Dict[str, str] | str
|
Dict[str, Tuple] | Dict[str, str] | str: Dictionary mapping drug name ->
prediction, or if |
Source code in piezo/catalogue.py
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 |
|
load_catalogue(catalogue_file, prediction_subset_only)
Read in the Antimicrobial Resistance Catalogue.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
catalogue_file
|
str
|
path to a resistance catalogue as a CSV file in the correct format, as determined by its grammar |
required |
prediction_subset_only
|
bool
|
whether to subset the catalogue down so it ONLY includes entities (e.g. DRUG,GENE pairs) that include at least one row predicting resistance |
required |
Returns:
Name | Type | Description |
---|---|---|
catalogue |
namedtuple
|
defined tuple |
Notes
- Applies checks to ensure the catalogue is in the right format.
Source code in piezo/catalogue.py
71 72 73 74 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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
parse_json(data)
Load the data within a json string to Python dict
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str
|
JSON string |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dictionary of the JSON data |
Source code in piezo/catalogue.py
58 59 60 61 62 63 64 65 66 67 68 |
|
predict(catalogue, mutation, verbose=False, show_evidence=False)
Predict the effect of the given mutation on one or more antimicrobials.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
catalogue
|
namedtuple
|
The catalogue |
required |
mutation
|
str
|
a genetic variant in the form GENE_MUTATION e.g. for a SNP katG@S315T, INDEL katG@315_indel. |
required |
verbose
|
bool
|
if True, then a description of the rules that apply to the supplied mutation and their priority is written to STDOUT (default=False). DEPRECIATED |
False
|
show_evidence
|
bool
|
If True, predictions are returned as a tuple of
( |
False
|
Returns:
Name | Type | Description |
---|---|---|
result |
dict
|
the drugs affected by the mutation are the keys, and the predicted phenotypes are the values. e.g. {'LEV':'R', 'MXF':'R'} if the gene isn't in the catalogue, then an "S" is returned, on the assumption that it is probably susceptible. |
Notes
- mutations can be specified in a grammar that covers most of the known and expected genetic variants.
- Stop codon is represented by "!"
- "any mutation at position S315" (i.e. a wildcard) is represented by "?" e.g. S315?
- for more info see the walkthrough and also the NOMENCLATURE.md file
Source code in piezo/catalogue.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|