<jupyter_start><jupyter_text>PEPCONF OptimizationDataset Preparation From John:> This dataset contains several categories of interesting short peptides:> - dipeptide> - tripeptide> - disulfide-linked peptides> - short bioactive peptides> - cyclic peptides>> We should use our standard conformer enumeration schemes to generate conformers for QM. The original starting molecules were XYZ files.John has already turned these into canonical isomeric SMILES using `extract-pepconf-smiles.py`.We will start from these SMILES in our submission generation.<jupyter_code>import os

import numpy as np

from qcsubmit.factories import OptimizationDataset, OptimizationDatasetFactory
from openforcefield.topology import Molecule
from qcsubmit import workflow_components<jupyter_output><empty_output><jupyter_text>Preparation steps<jupyter_code>moldata = dict()
with open('pepconf.csv', 'r') as f:
    for line in f:
        smiles, name = line.strip().split(',')
        moldata[name] = smiles<jupyter_output><empty_output><jupyter_text>We won't use the names in the SMILES file, since we'll be generating stereoisomers, conformers.<jupyter_code>mols = [Molecule.from_smiles(smiles, allow_undefined_stereo=True) for smiles in moldata.values()]
len(mols)
# Generate the workflow to apply to the molecules
qcs_ds = OptimizationDatasetFactory()

component = workflow_components.EnumerateStereoisomers()
component.max_isomers = 100
component.toolkit = "rdkit"
qcs_ds.add_workflow_component(component)

component = workflow_components.StandardConformerGenerator()
component.max_conformers = 100
component.toolkit = "rdkit"
component.rms_cutoff = 3.0
qcs_ds.add_workflow_component(component)
desc = "OptimizationDataset of short peptides in various contexts, including disulfide bridges."
name = "OpenFF PEPCONF OptimizationDataset v1.0"

dataset = qcs_ds.create_dataset(
    dataset_name=name,
    molecules=mols,
    description=desc,
    tagline=desc,
)
print("Workflow complete; dataset generated.")
dataset.metadata.long_description_url = "https://github.com/openforcefield/qca-dataset-submission/tree/master/submissions/2020-10-26-PEPCONF-Optimization"
dataset.metadata.long_description = "OptimizationDataset of short peptides in various contexts, including disulfide bridges. The source PEPCONF dataset is documented in [Nature Scientific Data](https://www.nature.com/articles/sdata2018310), and available on [GitHub](https://github.com/aoterodelaroza/pepconf). This dataset extracts the molecules that were simulated, but uses the QCSubmit infrastructure to generate a new `OptimizationDataset`, so does not use the original conformers."
dataset.metadata.submitter = 'dotsdl'

confs = np.array([len(mol.conformers) for mol in dataset.molecules])
print("Number of unique molecules       ", dataset.n_molecules)
print("Number of filtered molecules     ", dataset.n_filtered)
print("Number of conformers             ", dataset.n_records)
print("Number of conformers min mean max", 
      confs.min(), "{:6.2f}".format(confs.mean()), confs.max())

dataset.export_dataset("dataset.json.bz2")
dataset.metadata.elements<jupyter_output><empty_output><jupyter_text>dataset = OptimizationDataset.parse_file("dataset.json.bz2")<jupyter_code>dataset.visualize("molecules.pdf", columns=3, toolkit="openeye")
dataset.provenance
# manual provenance fix
import openeye
dataset.provenance["openeye"] = openeye.__version__
dataset.metadata.submitter = 'jchodera'
dataset.export_dataset("dataset.json.bz2")
dataset.molecules_to_file('molecules.smi', 'smi')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09553245293621804, 'fraction_numerical': 0.008710311885361057, 'mean_word_length': 6.4789915966386555, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '110856', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1039, 'n_words': 270, 'path': 'submissions/2020-10-26-PEPCONF-Optimization/Dataset Preparation.ipynb', 'repo_name': 'openforcefield/qca-dataset-submission', 'size': '3559'}