schrodinger.active_learning.al_ligand_ml_utils module

schrodinger.active_learning.al_ligand_ml_utils.addExtraFeatures(training_csv: str, batched_csv_files: list[str], extra_features: list[str]) None

Read extra features from the batched csv input files. Add them to the training data. This only works for AL-FEP since the batched csv files can be read in RAM.

Parameters:
  • training_csv – Path to the training CSV file.

  • batched_csv_files – List of paths to the batched CSV files.

  • extra_features – Names of the extra feature columns.

schrodinger.active_learning.al_ligand_ml_utils.check_license()

Check for the existence of the AUTOQSAR license and exit with an error message if it doesn’t.

schrodinger.active_learning.al_ligand_ml_utils.setup_large_dataset_workers()

Determines the number of cores available on a host and deducts 1 CPU from the maximum number of available cores to avoid monopolizing all cores. If only one core is available, returns 1.

schrodinger.active_learning.al_ligand_ml_utils.write_sorted_results(results, output_csv, sorted_by_uncertainty=None, sample_ratio=0.1, ascending=True)

Sort the results from ligand_ml by prediction value and optionally create uncertainty-sorted output.

Parameters:
  • results (pandas.core.frame.DataFrame) – dataframe that contains the pre-sorted ligand_ml prediction

  • output_csv (str) – file that contains the sorted by predict results.

  • sorted_by_uncertainty (str or None) – file that contains the sorted by uncertainty results.

  • sample_ratio (float) – top sample ratio that ranges in (0, 1).

  • ascending (bool) – sort predictions from smallest to largest if True

schrodinger.active_learning.al_ligand_ml_utils.extract_glide_residue_features(st: Structure) dict[str, float]

Extract Glide per-residue interaction features from a structure that has the s_glide_res_interaction property (set by Glide when WRITE_RES_INTERACTION is enabled).

Parameters:

st – Structure with residue interaction data

Returns:

Dictionary mapping feature names to float values, e.g. {"r_glide_res:A:42:ALA :vdw": -1.23, ...}

schrodinger.active_learning.al_ligand_ml_utils.get_smiles_from_structure(st: Structure) Optional[str]

Generate a canonical SMILES string for a structure.

Parameters:

st – Input structure

Returns:

SMILES string, or None on failure

schrodinger.active_learning.al_ligand_ml_utils.collect_feature_columns(input_mae: str) list

Scan ligand structures in a Maestro file and collect all unique Glide residue feature column names. Automatically skips receptors in PV/EPV files.

Parameters:

input_mae – Path to input .mae* file

Returns:

Sorted list of unique feature column names

schrodinger.active_learning.al_ligand_ml_utils.write_feature_csv(input_mae: str, output_csv: str, target_property: str, feature_header: list = None, allow_duplicates: bool = True) list

Write Glide residue features to a CSV for al_ligand_ml_worker.py. Columns: SMILES, Value, Title, then one per residue feature. Automatically skips receptors in PV/EPV files.

Parameters:
  • input_mae – Path to input Maestro file

  • output_csv – Path to output CSV file

  • target_property – Structure property name for the Value column

  • feature_header – Pre-computed feature column names, or None to auto-detect

  • allow_duplicates – If False, keep only first occurrence of each SMILES

Returns:

Used feature_header list

schrodinger.active_learning.al_ligand_ml_utils.write_ml_feature_json(feature_names: list[str], output_json: str, feature_type: str = 'with_feature')

Write the ml_feature.json file consumed by al_ligand_ml_worker.py.

The feature_type controls how al_ligand_ml_worker.py trains: "with_feature" combines SMILES and Glide residue features, "only_feature" trains only on Glide residue features, "no_feature" trains only on SMILES.

Parameters:
  • feature_names – List of feature column names

  • output_json – Output file path

  • feature_type – One of "with_feature", "only_feature", or "no_feature"