diff --git a/conkit/command_line/conkit_validate.py b/conkit/command_line/conkit_validate.py index 71b4e63c..f0a1ea3d 100644 --- a/conkit/command_line/conkit_validate.py +++ b/conkit/command_line/conkit_validate.py @@ -311,6 +311,8 @@ def main(): if args.RUN_SVM=='yes': logger.info(os.linesep + "Running Support Vector Machine.") + validation.calculate_features() + if args.moltype=='Protein': p = PDBParser() structure = p.get_structure('structure', args.pdbfile)[0] diff --git a/conkit/plot/modelvalidation.py b/conkit/plot/modelvalidation.py index 5b0bd642..0fcde067 100644 --- a/conkit/plot/modelvalidation.py +++ b/conkit/plot/modelvalidation.py @@ -141,9 +141,20 @@ def __init__(self, model, prediction, sequence, map_align_exe=None, dist_bins=No self.prediction = prediction self.sequence = sequence self.absent_residues = self._get_absent_residues() + prediction_cmap = self._prepare_contactmap(self.prediction.copy()) + predicted_dict = prediction_cmap.as_dict() self.data = pd.DataFrame() + self.data['RESNUM'] = predicted_dict.keys() + self.data['MISALIGNED'] = False + self.data['SCORE'] = 0 + self.data['CONTACTS'] = 0 + self.data['PLDDT'] = 0 + self.data['Q_IN_ERROR'] = '' + + def calculate_features(self): + model_distogram = self._prepare_distogram(self.model.copy()) prediction_distogram = self._prepare_distogram(self.prediction.copy()) model_cmap = self._prepare_contactmap(self.model.copy()) @@ -296,14 +307,10 @@ def _parse_data(self, predicted_dict, *metrics): for residue_features in zip(sorted(predicted_dict.keys()), *metrics): _features.append((*residue_features,)) - self.data = pd.DataFrame(_features) - self.data.columns = ALL_VALIDATION_FEATURES - - self.data['MISALIGNED'] = False - self.data['SCORE'] = 0 - self.data['CONTACTS'] = 0 - self.data['PLDDT'] = 0 - self.data['Q_IN_ERROR'] = '' + feature_df = pd.DataFrame(_features) + feature_df.columns = ALL_VALIDATION_FEATURES + + self.data = self.data.merge(feature_df, how='inner', on =['RESNUM']) diff --git a/conkit/plot/tools.py b/conkit/plot/tools.py index 929a8042..02648906 100644 --- a/conkit/plot/tools.py +++ b/conkit/plot/tools.py @@ -408,7 +408,7 @@ def get_zscores(model_distogram, predicted_cmap_dict, absent_residues, *metrics) absent_residues: list, tuple, set The residues that are missing from the model *metrics: list - The mertics for which the Z-Scores will be calculated + The metrics for which the Z-Scores will be calculated Returns -------