Repository navigation
Command Line
From 0.7.0 four commands work on whole files of structures without the window: convert between formats, convert a folder, write properties to a CSV file and draw every record as a picture. They run from the source tree with the engine's Python; the full reference with timings is docs/CLI.md.
| Command | What it does |
|---|---|
./formchem convert IN OUT |
converts one file; the formats come from the extensions (or --from, --to); OUT may be - for the terminal |
./formchem batch DIR --to FMT |
converts every readable file in a folder (--recursive for subfolders) into DIR/converted or --out
|
./formchem descriptors IN --csv OUT |
one row per record with the Analysis panel's properties; --props picks the columns, --list shows them with their methods |
./formchem render IN --out DIR |
one SVG or PNG picture per record (--format, --size, --transparent) |
On Windows use formchem.bat with the same arguments. Formats read: SD, molfile, SMILES, CXSMILES, InChI, CML, RXN, reaction SMILES, RD files, CDXML, CDX and FormChem drawings; written: SD, molfile, SMILES, CXSMILES, InChI, InChIKey, CML, RXN, reaction SMILES and FormChem drawings. Any input may be gzip-compressed. ./formchem convert --formats lists them.
./formchem convert big.sdf big.smi --errors failed.csv
./formchem convert salts.smi - --to smiles --standardise
./formchem batch ~/mols --to sdf --out ~/mols-sdf --jobs 2
./formchem descriptors big.sdf --csv props.csv --props mw,clogp,tpsa,hbd,hba,lipinski_violations
./formchem render big.sdf --out pictures --format png --size 600x400
--standardise (or --standardize) cleans each record first, with the same steps as Structure > Standardise... in the window: clean up, normalise functional groups, remove salts and solvents, reionise, neutralise and remove explicit hydrogens by default, plus keep the largest fragment, the canonical tautomer, remove isotopes and remove stereochemistry when you name them (--standardise salts,neutralise,tautomer, --standardise all, --standardise default,tautomer,-strip_h). Steps always run in the same order. ./formchem convert --steps lists them with the RDKit method behind each.
A record that cannot be read never stops the run. The first 20 failures are printed with the record number, the name and RDKit's own reason; --errors FILE writes every failed or warned record to a CSV file instead, and batch always writes formchem-batch-report.csv when something failed. The command ends with 0 when at least one record was written, 1 when none was, and 2 for a mistake in the arguments.
On a two-core machine, 10,000 SD records convert to SMILES in about 1.4 seconds, to InChIKey in about 4 seconds, and with standardising in about 22 seconds. --jobs N (0 for one per CPU) uses several processes for large files and folders, with the output always in input order.
render draws with RDKit, close to the journal style (14.4 pt bonds, 0.6 pt lines, 10 pt Arimo labels, black on white), not with the window's own drawing code, so labels, wedges and double bonds can sit a little differently. For pictures exactly as the window shows them, with the drawing kept inside, use File > Export (Formats and Export).
./formchem cli list|describe|run|batch reaches the open window's commands from a terminal (Getting Started); ./formchem batch converts files. The desktop app does not include the conversion commands yet.
FormChem
- Home
- Manual
- Getting Started
- Drawing
- Grid and Page
- Annotations
- Reactions
- Templates
- Printing and pages
- Keyboard Shortcuts
- Stereo and Queries
- Analysis
- Names
- Spectra and NMR
- 3D
- Databases
- Lab Notebook
- Biopolymers
- Live Structures
- Accessibility
- Formats and Export
- Clipboard
- Command Line
- Agents
- Agent Activity
- Terminal
- Extensions
- Project Format
- Architecture
- Desktop
- Troubleshooting
- Development
- Releasing
Documents