Repository navigation
Command Line
From 0.7.0 four commands work on whole files of structures without the window (and from 0.11.0 ./formchem db works on databases, and from 0.12.0 ./formchem edit-live opens a live structure in the running FormChem, both below): 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.
From 0.11.0 ./formchem db works on structure databases (Databases) without the window:
| Command | What it does |
|---|---|
./formchem db create TITLE [--path FILE.fcdb] |
makes a database (in the Databases folder of the data folder unless --path says otherwise) |
./formchem db info DB |
title, record and entry counts, duplicate rules and fields |
./formchem db import DB FILE |
imports SD, RD, SMILES, CSV, TSV, .fchem, molfile or InChI files; --mode new, append or merge, --key, --dry-run, --errors failed.csv
|
./formchem db search DB --substructure SMILES |
also --similarity SMILES --threshold 0.7, --exact, --formula C6-8N1 or --query JSON; prints the first 20 hits (--show N) and keeps the hit list for the window |
./formchem db export DB OUT |
the whole database or --hitlist ID to SD (--v3000), SMILES or CSV (--inchi), --fields a,b
|
./formchem db create Demo
./formchem db import ~/formchem/Databases/Demo.fcdb big.sdf --errors failed.csv
./formchem db search ~/formchem/Databases/Demo.fcdb --substructure c1ccccc1
./formchem db export ~/formchem/Databases/Demo.fcdb hits.sdf --hitlist 1
Every subcommand takes --json. The command ends with 0 on success, 1 when an import did not finish and 2 when it was refused. A database open in the app opens read-only here, and the other way round.
From 0.12.0 ./formchem edit-live asks the FormChem that is running to open a structure from the shared structure library for editing (Live Structures). Sibling Form apps use it; so can a script.
| Command | What it does |
|---|---|
./formchem edit-live ID |
opens library item ID (or the path of its Library/items/ID.svg) as a live drawing |
./formchem edit-live --object FILE |
opens the live structure object saved in FILE, adding it to the library first when it is new or newer |
--from APP |
names the app asking; the title bar shows "Live structure from APP" |
$ ./formchem edit-live s7jkf0w3t10 --from FormTxt
Opened Phenol for editing in FormChem (live structure s7jkf0w3t10, rev 1).
It ends with 0 when the structure opened, 1 when FormChem is not running or refused, and 2 when the argument could not be read.
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