Compute mass and structure¶
HELMshaker can assemble the whole-molecule structure from the monomer records and report molecular weight, formula, SMILES and a molblock.
This needs RDKit, which is not part of the core install:
It also needs a monomer library whose records carry smiles and rgroups. A
dictionary without structures parses fine but cannot be assembled.
Weight and formula¶
from helmshaker import Molecule, MonomerLibrary
library = MonomerLibrary()
library.load_from_file("monomers.json") # your dictionary, or one pulled from TMR
oligo = Molecule.from_helm(
"RNA1{[moe](A)[sp].[moe](U)[sp].[moe](G)}$$$$V2.0", monomer_library=library
)
print(oligo.molecular_weight()) # 1124.996
print(oligo.molecular_formula()) # C38H54N12O20P2S2
The same works for peptides, including cyclic ones, where the disulfide is accounted for:
peptide = Molecule.from_helm(
"PEPTIDE1{C.A.A.A.C}$PEPTIDE1,PEPTIDE1,1:R3-5:R3$$$V2.0", monomer_library=library
)
print(peptide.molecular_weight()) # 435.528
print(peptide.molecular_formula()) # C15H25N5O6S2
Structure output¶
smiles = oligo.to_smiles()
molblock = oligo.to_molblock()
print(smiles[:60])
print(len(molblock.splitlines()), "molblock lines")
Getting everything at once¶
Each of the calls above assembles the structure. When you want more than one
value, call analyze_structure() once and read the fields off the result:
result = oligo.analyze_structure()
print(result.molecular_weight)
print(result.molecular_formula)
print(result.exact_mass)
result.smiles
result.molblock
From the command line¶
helmshaker mw 'RNA1{[moe](A)[sp].[moe](U)}$$$$V2.0' --dictionary oligos
helmshaker mw 'RNA1{[moe](A)[sp].[moe](U)}$$$$V2.0' --dictionary oligos --smiles