prediction
pypythia.prediction.collect_features(msa, msa_file, raxmlng, pars_trees_file=None, log_info=False, threads=None, seed=0)
Helper function to collect all features required for predicting the difficulty of the MSA.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msa
|
MSA
|
MSA object corresponding to the MSA file to compute the features for. |
required |
raxmlng
|
RAxMLNG
|
Initialized RAxMLNG object. |
required |
pars_trees_file
|
Path
|
Path to store the inferred parsimony trees. Defaults to None. In this case, the trees are not stored. |
None
|
log_info
|
bool
|
If True, log intermediate progress information using the default logger. Defaults to False. |
False
|
threads
|
int
|
The number of threads to use for parallel parsimony tree inference. Defaults to None. Uses the RAxML-NG auto parallelization scheme if none is set. |
None
|
seed
|
int
|
Random seed to use for the parsimony tree inference. Defaults to 0. |
0
|
Returns: Dataframe containing a single row with all features required for predicting the difficulty of the MSA. The columns correspond to the feature names the predictor was trained with.
Source code in pypythia/prediction.py
60 61 62 63 64 65 66 67 68 69 70 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 |
|
pypythia.prediction.predict_difficulty(msa_file, raxmlng=DEFAULT_RAXMLNG_EXE, threads=None, seed=0, file_format=None, data_type=None, deduplicate=True, remove_full_gaps=True, result_prefix=None, store_results=True, plot_shap=False, model_file=DEFAULT_MODEL_FILE, log_info=False)
Predict the difficulty of an MSA using the PyPythia difficulty predictor.
Per default, the MSA is deduplicated and full gap sequences are removed before the difficulty is predicted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msa_file
|
Path
|
Path to the MSA file. Note that the MSA file must be in either FASTA or PHYLIP format. |
required |
raxmlng
|
Path
|
Path to the RAxML-NG executable. If not set, uses the RAxML-NG binary found in the PATH environment variable. |
DEFAULT_RAXMLNG_EXE
|
threads
|
int
|
Number of threads to use for parallel parsimony tree inference. If not set, uses the RAxML-NG auto parallelization scheme. |
None
|
seed
|
int
|
Random seed to use for the parsimony tree inference. Defaults to 0. |
0
|
file_format
|
FileFormat
|
File format of the MSA file. Defaults to None. In this case, the file format
is inferred based on the file content. See |
None
|
data_type
|
DataType
|
Data type of the MSA sequences. Defaults to None. In this case, the data type
is inferred based on the file content. See |
None
|
deduplicate
|
bool
|
If True, remove duplicate sequences from the MSA. Defaults to True. |
True
|
remove_full_gaps
|
bool
|
If True, remove full gap sequences from the MSA. Defaults to True. |
True
|
result_prefix
|
Path
|
Prefix for the result files. Defaults to None. In this case, the prefix is set to the MSA file name. |
None
|
store_results
|
bool
|
If True, store intermediate results as file. Defaults to True.
In this case, the following files are stored:
- The reduced MSA in PHYLIP format (if duplicates or full gap sequences were removed) in |
True
|
plot_shap
|
bool
|
If True, plot the shapley values as waterfall plot. Defaults to False. |
False
|
model_file
|
Path
|
Path to the trained difficulty predictor model. Defaults to the latest model shipped with PyPythia. |
DEFAULT_MODEL_FILE
|
log_info
|
bool
|
If True, log intermediate progress information using the default logger. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
float64
|
np.float64: Predicted difficulty of the MSA. |
Source code in pypythia/prediction.py
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 170 171 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 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
|