Simple examples

These examples demonstrate simple reaction processing with different combinations of the most popular command line options. The reaction file is reaction.rxn and the two reactants are stored in reactant1.mol and reactant2.mol.

  1. For the simplest reaction processing type:

    react -r reaction.rxn reactant1.mol reactant2.mol

    or else you can also give the reaction and the reactants in SMARTS/SMILES string form:

    react -r "[F,Cl,Br,I:3][C:1]=O.[H:4][O:2][#6]>>[#6][O:2][C:1]=O.[F,Cl,Br,I:3][H:4]" \
    "FC(=O)C1=CC2=C(C=CC(CC(Br)=O)=C2)N(C(Cl)=O)C3=C1C=CC=C3" "CC(=O)OCCN1CCN(CCO)CC1"

    The -rcommand line option specifies the reaction file or string, while input files/SMILES strings (without preceeding command line option) are taken as reactants. The resulting products are written to the standard output in SMILES format:

    CC(=O)OCCN1CCN(CCOC(=O)N2C3=C(C=C(CC(Br)=O)C=C3)C=C(C(F)=O)C4=C2C=CC=C4)CC1
    Cl
    CC(=O)OCCN1CCN(CCOC(=O)C2=CC3=C(C=CC(CC(Br)=O)=C3)N(C(Cl)=O)C4=C2C=CC=C4)CC1
    F
    CC(=O)OCCN1CCN(CCOC(=O)CC2=CC3=C(C=C2)N(C(Cl)=O)C4=C(C=CC=C4)C(=C3)C(F)=O)CC1
    Br
  2. The result is written in reaction form if the -t command line option is specified with reactionoutput type:

    react -r reaction.rxn -t reaction reactant1.mol reactant2.mol

    The result in this case is:

    FC(=O)C1=CC2=C(C=CC(CC(Br)=O)=C2)N(C(Cl)=O)C3=C1C=CC=C3.CC(=O)OCCN1CCN(CCO)CC1>>CC(=O)OCCN1CCN(CCOC(=O)N2C3=C(C=C(CC(Br)=O)C=C3)C=C(C(F)=O)C4=C2C=CC=C4)CC1.Cl
    FC(=O)C1=CC2=C(C=CC(CC(Br)=O)=C2)N(C(Cl)=O)C3=C1C=CC=C3.CC(=O)OCCN1CCN(CCO)CC1>>CC(=O)OCCN1CCN(CCOC(=O)C2=CC3=C(C=CC(CC(Br)=O)=C3)N(C(Cl)=O)C4=C2C=CC=C4)CC1.F
    FC(=O)C1=CC2=C(C=CC(CC(Br)=O)=C2)N(C(Cl)=O)C3=C1C=CC=C3.CC(=O)OCCN1CCN(CCO)CC1>>CC(=O)OCCN1CCN(CCOC(=O)CC2=CC3=C(C=C2)N(C(Cl)=O)C4=C(C=CC=C4)C(=C3)C(F)=O)CC1.Br
  3. You can also save the result in a file by specifying the output file in the -ooption:

    react -r reaction.rxn -t reaction -o result.smiles reactant1.mol reactant2.mol
  4. A different output file format can be specified in the -foption:

    react -r reaction.rxn -t reaction -f rxn -o result.rxn reactant1.mol reactant2.mol
  5. Now go back to the first example. You may want to get rid of the second products. You can do this by specifying the required product index in the -xoption:

    react -r reaction.rxn -x 1 reactant1.mol reactant2.mol

    The result is:

    CC(=O)OCCN1CCN(CCOC(=O)N2C3=C(C=C(CC(Br)=O)C=C3)C=C(C(F)=O)C4=C2C=CC=C4)CC1
    CC(=O)OCCN1CCN(CCOC(=O)C2=CC3=C(C=CC(CC(Br)=O)=C3)N(C(Cl)=O)C4=C2C=CC=C4)CC1
    CC(=O)OCCN1CCN(CCOC(=O)CC2=CC3=C(C=C2)N(C(Cl)=O)C4=C(C=CC=C4)C(=C3)C(F)=O)CC1

    Note, that multiple product indexes can also be specified by an index list separated by commas, without spaces (e.g. select the first and the third from a 3-product reaction by: -x 1,3).

  6. Save the previous output in SDF format:

    react -r reaction.rxn -x 1 -f sdf -o result.sdf reactant1.mol reactant2.mol

    Show the result in MView:

    mview result.sdf

    Note, that under UNIX/Linux it is also possible to pipe the result directly to MView without saving it:

    react -r reaction.rxn -x 1 reactant1.mol reactant2.mol | mview -
  7. Go back to the first example and save the first product list (specify the number of results to be returned in -p):

    react -r reaction.rxn reactant1.mol reactant2.mol -p 1 -o products.smiles

    Assume that you have products.smiles and you want to know the reactants that can be formed to these products by processing the reaction reaction.rxn. That is, you want to process the reaction in reversed direction. You can do this by the -soption:

    react -r reaction.rxn products.smiles -s

    The result is:

    CC(Cl)=O
    OCCN1CCN(CCOC(=O)N2C3=C(C=C(CC(Br)=O)C=C3)C=C(C(F)=O)C4=C2C=CC=C4)CC1
    FC(=O)C1=CC2=C(C=CC(CC(Br)=O)=C2)N(C(Cl)=O)C3=C1C=CC=C3
    CC(=O)OCCN1CCN(CCO)CC1

    which includes our two original reactants.

The use and meaning of command-line options in the above commands:

Option

Description

Default

-r

specifies the reaction file

-

-t

specifies the output type ('reaction' or 'product')

'product'

-f

specifies the output format (e.g. 'sdf', 'mol', 'rxn')

'smiles'

-o

specifies the output file path

standard output (console)

-x

extract specified products (e.g. 1,3)

return all products

-p

the maximum number of product lists to be returned (e.g. 2)

return all product lists

-s

take reversed reaction

take reaction as it is

A UNIX command that reads reactants from the mols.sdf file, processes the reaction defined in the r.rxnfile and writes the resulting reaction molecules to the standard output in smiles format:

react -r r.rxn mols.sdf

The same but returns only the second and the third products (note that 2,3should be written without white space in between):

react -r r.rxn -x 2,3 mols.sdf

This example specifies the reaction with reactivity rule and the reactants on the command line, extracts the first product:

react -r "[Cl:4][C:3]=O.[#7:2][H:1]>>[#7:2][C:3]=O.[Cl:4][H:1]..r:charge(ratom(4)) > -1.2" \
"CCCC(Cl)=O" "NCCC1CCCCC1" -x 1

The same with an additional selectivity rule and tolerance:

react -r "[Cl:4][C:3]=O.[#7:2][H:1]>>[#7:2][C:3]=O.[Cl:4][H:1]..r:charge(ratom(4)) > -1.2..s:psa(product(0))..t:1.5" \
"CCCC(Cl)=O" "NCCC1CCCCC1" -x 1

A UNIX command that reads reactants from the mols.sdf file, processes the reaction defined in the r.rxn file and writes the product molecules in the file named products.sdfto be created in the same directory:

react -r r.rxn mols.sdf -f sdf -o products.sdf

The same with verbose output, returning only one product list, then displaying the result in MarvinView:

react -r r.rxn mols.sdf -p 1 -f sdf -o products.sdf -v
mview products.sdf

Assume that the reaction file r.rdf contains a selectivity rule. Product lists are sorted by decreasing selectivity, all product lists are accepted (-n tignores selectivity tolerance). The result is displayed using MarvinView:

react -r r.rdf -n t r1.mol r2.mol | mview -

Note that such piping does not work in Windows.

Processes a reversed reaction and ignoring both reactivity and selectivity rules:

react -r r.rdf -n rs -s r1.mol r2.mol -o products.sdf

Performs a reaction on multiple reactants in combinatorial mode, returns the first two product lists sorted by selectivity, for each reactant pairs:

react -r r.rdf -m comb -p 2 r1.sdf r2.sdf -o products.sdf

The same without preloading input molecules into memory (-e, --file-storage). This slows reaction processing and is necessary only if there are a lot of input molecules (thousands) in which case the JVM would run out of memory by holding all input molecules:

react -r r.rdf -e -m comb -p 2 r1.sdf r2.sdf -o products.sdf

Create product IDs from reaction and reactant IDs. The reaction ID is R1. Read the reactant IDs from the ID and CD_ID tags for the first and the second reactants, respectively, write the generated ID to the PID tag in the product SDF.

react -r r1.rdf -f sdf a1.sdf a2.sdf -i R1 -R ID,CD_ID -P PID