PathLengthFingerprints.pl - Generate atom path length based fingerprints for SD files
PathLengthFingerprints.pl SDFile(s)...
PathLengthFingerprints.pl [--AromaticityModel AromaticityModelType] [-a, --AtomIdentifierType AtomicInvariantsAtomTypes] [--AtomicInvariantsToUse "AtomicInvariant1,AtomicInvariant2..."] [--FunctionalClassesToUse "FunctionalClass1,FunctionalClass2..."] [--BitsOrder Ascending | Descending] [-b, --BitStringFormat BinaryString | HexadecimalString] [--CompoundID DataFieldName or LabelPrefixString] [--CompoundIDLabel text] [--CompoundIDMode DataField | MolName | LabelPrefix | MolNameOrLabelPrefix] [--DataFields "FieldLabel1,FieldLabel2,... "] [-d, --DataFieldsMode All | Common | Specify | CompoundID] [--DetectAromaticity Yes | No] [-f, --Filter Yes | No] [--FingerprintsLabel text] [--fold Yes | No] [--FoldedSize number] [-h, --help] [-i, --IgnoreHydrogens Yes | No] [-k, --KeepLargestComponent Yes | No] [-m, --mode PathLengthBits | PathLengthCount] [--MinPathLength number] [--MaxPathLength number] [-n, --NumOfBitsToSetPerPath number] [--OutDelim comma | tab | semicolon] [--output SD | FP | text | all] [-q, --quote Yes | No] [-r, --root RootName] [-p, --PathMode AtomPathsWithoutRings | AtomPathsWithRings | AllAtomPathsWithoutRings | AllAtomPathsWithRings] [-s, --size number] [-u, --UseBondSymbols Yes | No] [--UsePerlCoreRandom Yes | No] [--UseUniquePaths Yes | No] [-q, --quote Yes | No] [-r, --root RootName] [-v, --VectorStringFormat IDsAndValuesString | IDsAndValuesPairsString | ValuesAndIDsString | ValuesAndIDsPairsString] [-w, --WorkingDir dirname] SDFile(s)...
Generate atom path length fingerprints for SDFile(s) and create appropriate SD, FP or CSV/TSV text file(s) containing fingerprints bit-vector or vector strings corresponding to molecular fingerprints.
Multiple SDFile names are separated by spaces. The valid file extensions are .sdf and .sd. All other file names are ignored. All the SD files in a current directory can be specified either by *.sdf or the current directory name.
The current release of MayaChemTools supports generation of path length fingerprints corresponding to following -a, --AtomIdentifierTypes:
Based on the values specified for -p, --PathMode, --MinPathLength and --MaxPathLength, all appropriate atom paths are generated for each atom in the molecule and collected in a list and the list is filtered to remove any structurally duplicate paths as indicated by the value of --UseUniquePaths option.
For each atom path in the filtered atom paths list, an atom path string is created using value of -a, --AtomIdentifierType and specified values to use for a particular atom identifier type. Value of -u, --UseBondSymbols controls whether bond order symbols are used during generation of atom path string. For each atom path, only lexicographically smaller atom path strings are kept.
For PathLengthBits value of -m, --mode option, each atom path is hashed to a 32 bit unsigned integer key using TextUtil::HashCode function. Using the hash key as a seed for a random number generator, a random integer value between 0 and --Size is used to set corresponding bits in the fingerprint bit-vector string. Value of --NumOfBitsToSetPerPath option controls the number of time a random number is generated to set corresponding bits.
For PathLengthCount value of -m, --mode option, the number of times an atom path appears is tracked and a fingerprints count-string corresponding to count of atom paths is generated.
Example of SD file containing path length fingerprints string data:
Example of FP file containing path length fingerprints string data:
Example of CSV Text file containing pathlength fingerprints string data:
The current release of MayaChemTools generates the following types of path length fingerprints bit-vector and vector strings:
Specify aromaticity model to use during detection of aromaticity. Possible values in the current release are: MDLAromaticityModel, TriposAromaticityModel, MMFFAromaticityModel, ChemAxonBasicAromaticityModel, ChemAxonGeneralAromaticityModel, DaylightAromaticityModel or MayaChemToolsAromaticityModel. Default value: MayaChemToolsAromaticityModel.
The supported aromaticity model names along with model specific control parameters are defined in AromaticityModelsData.csv, which is distributed with the current release and is available under lib/data directory. Molecule.pm module retrieves data from this file during class instantiation and makes it available to method DetectAromaticity for detecting aromaticity corresponding to a specific model.
This option is ignored during No value of --DetectAromaticity option.
Specify atom identifier type to use for assignment of atom types to hydrogen and/or non-hydrogen atoms during calculation of atom types fingerprints. Possible values in the current release are: AtomicInvariantsAtomTypes, DREIDINGAtomTypes, EStateAtomTypes, FunctionalClassAtomTypes, MMFF94AtomTypes, SLogPAtomTypes, SYBYLAtomTypes, TPSAAtomTypes, UFFAtomTypes. Default value: AtomicInvariantsAtomTypes.
Specify atom identifier type to use during generation of atom path strings corresponding to path length fingerprints. Possible values in the current release are: AtomicInvariantsAtomTypes, DREIDINGAtomTypes, EStateAtomTypes, FunctionalClassAtomTypes, MMFF94AtomTypes, SLogPAtomTypes, SYBYLAtomTypes, TPSAAtomTypes, UFFAtomTypes. Default value: AtomicInvariantsAtomTypes.
This value is used during AtomicInvariantsAtomTypes value of a, --AtomIdentifierType option. It's a list of comma separated valid atomic invariant atom types.
Possible values for atomic invariants are: AS, X, BO, LBO, SB, DB, TB, H, Ar, RA, FC, MN, SM. Default value: AS.
The atomic invariants abbreviations correspond to:
Atom type generated by AtomTypes::AtomicInvariantsAtomTypes class corresponds to:
Except for AS which is a required atomic invariant in atom types, all other atomic invariants are optional. Atom type specification doesn't include atomic invariants with zero or undefined values.
In addition to usage of abbreviations for specifying atomic invariants, the following descriptive words are also allowed:
Examples:
Benzene: Using value of AS for --AtomicInvariantsToUse, Yes for UseBondSymbols, and AllAtomPathsWithRings for -p, --PathMode, atom path strings generated are:
And using AS,X,BO for --AtomicInvariantsToUse generates following atom path strings:
Urea: Using value of AS for --AtomicInvariantsToUse, Yes for UseBondSymbols, and AllAtomPathsWithRings for -p, --PathMode, atom path strings are:
And using AS,X,BO for --AtomicInvariantsToUse generates following atom path strings:
This value is used during FunctionalClassAtomTypes value of a, --AtomIdentifierType option. It's a list of comma separated valid functional classes.
Possible values for atom functional classes are: Ar, CA, H, HBA, HBD, Hal, NI, PI, RA. Default value [ Ref 24 ]: HBD,HBA,PI,NI,Ar,Hal.
The functional class abbreviations correspond to:
AtomTypes::FunctionalClassAtomTypes module is used to assign functional class atom types. It uses following definitions [ Ref 60-61, Ref 65-66 ]:
Bits order to use during generation of fingerprints bit-vector string for PathLengthBits value of -m, --mode option. Possible values: Ascending, Descending. Default: Ascending.
Ascending bit order which corresponds to first bit in each byte as the lowest bit as opposed to the highest bit.
Internally, bits are stored in Ascending order using Perl vec function. Regardless of machine order, big-endian or little-endian, vec function always considers first string byte as the lowest byte and first bit within each byte as the lowest bit.
Format of fingerprints bit-vector string data in output SD, FP or CSV/TSV text file(s) specified by --output used during PathLengthBits value of -m, --mode option. Possible values: BinaryString, HexadecimalString. Default value: HexadecimalString.
BinaryString corresponds to an ASCII string containing 1s and 0s. HexadecimalString contains bit values in ASCII hexadecimal format.
Examples:
This value is --CompoundIDMode specific and indicates how compound ID is generated.
For DataField value of --CompoundIDMode option, it corresponds to datafield label name whose value is used as compound ID; otherwise, it's a prefix string used for generating compound IDs like LabelPrefixString<Number>. Default value, Cmpd, generates compound IDs which look like Cmpd<Number>.
Examples for DataField value of --CompoundIDMode:
Examples for LabelPrefix or MolNameOrLabelPrefix value of --CompoundIDMode:
The value specified above generates compound IDs which correspond to Compound<Number> instead of default value of Cmpd<Number>.
Specify compound ID column label for FP or CSV/TSV text file(s) used during CompoundID value of --DataFieldsMode option. Default: CompoundID.
Specify how to generate compound IDs and write to FP or CSV/TSV text file(s) along with generated fingerprints for FP | text | all values of --output option: use a SDFile(s) datafield value; use molname line from SDFile(s); generate a sequential ID with specific prefix; use combination of both MolName and LabelPrefix with usage of LabelPrefix values for empty molname lines.
Possible values: DataField | MolName | LabelPrefix | MolNameOrLabelPrefix. Default: LabelPrefix.
For MolNameAndLabelPrefix value of --CompoundIDMode, molname line in SDFile(s) takes precedence over sequential compound IDs generated using LabelPrefix and only empty molname values are replaced with sequential compound IDs.
This is only used for CompoundID value of --DataFieldsMode option.
Comma delimited list of SDFiles(s) data fields to extract and write to CSV/TSV text file(s) along with generated fingerprints for text | all values of --output option.
This is only used for Specify value of --DataFieldsMode option.
Examples:
Specify how data fields in SDFile(s) are transferred to output CSV/TSV text file(s) along with generated fingerprints for text | all values of --output option: transfer all SD data field; transfer SD data files common to all compounds; extract specified data fields; generate a compound ID using molname line, a compound prefix, or a combination of both. Possible values: All | Common | specify | CompoundID. Default value: CompoundID.
Detect aromaticity before generating fingerprints. Possible values: Yes or No. Default value: Yes.
No --DetectAromaticity forces usage of atom and bond aromaticity values from SDFile(s) and skips the step which detects and assigns aromaticity.
No --DetectAromaticity value is only allowed uring AtomicInvariantsAtomTypes value of -a, --AtomIdentifierType options; for all possible values -a, --AtomIdentifierType values, it must be Yes.
Specify whether to check and filter compound data in SDFile(s). Possible values: Yes or No. Default value: Yes.
By default, compound data is checked before calculating fingerprints and compounds containing atom data corresponding to non-element symbols or no atom data are ignored.
SD data label or text file column label to use for fingerprints string in output SD or CSV/TSV text file(s) specified by --output. Default value: PathLenghFingerprints.
Fold fingerprints to increase bit density during PathLengthBits value of -m, --mode option. Possible values: Yes or No. Default value: No.
Size of folded fingerprint during PathLengthBits value of -m, --mode option. Default value: 256. Valid values correspond to any positive integer which is less than -s, --size and meets the criteria for its value.
Examples:
Print this help message
Ignore hydrogens during fingerprints generation. Possible values: Yes or No. Default value: Yes.
For yes value of -i, --IgnoreHydrogens, any explicit hydrogens are also used for generation of atoms path lengths and fingerprints; implicit hydrogens are still ignored.
Generate fingerprints for only the largest component in molecule. Possible values: Yes or No. Default value: Yes.
For molecules containing multiple connected components, fingerprints can be generated in two different ways: use all connected components or just the largest connected component. By default, all atoms except for the largest connected component are deleted before generation of fingerprints.
Specify type of path length fingerprints to generate for molecules in SDFile(s). Possible values: PathLengthBits, PathLengthCount. Default value: PathLengthBits.
For PathLengthBits value of -m, --mode option, a fingerprint bit-vector string containing zeros and ones is generated and for PathLengthCount value, a fingerprint vector string corresponding to number of atom paths is generated.
Minimum atom path length to include in fingerprints. Default value: 1. Valid values: positive integers and less than --MaxPathLength. Path length of 1 correspond to a path containing only one atom.
Maximum atom path length to include in fingerprints. Default value: 8. Valid values: positive integers and greater than --MinPathLength.
Number of bits to set per path during generation of fingerprints bit-vector string for PathLengthBits value of -m, --mode option. Default value: 1. Valid values: positive integers.
Delimiter for output CSV/TSV text file(s). Possible values: comma, tab, or semicolon Default value: comma.
Type of output files to generate. Possible values: SD, FP, text, or all. Default value: text.
Overwrite existing files.
Specify type of atom paths to use for generating pathlength fingerprints for molecules in SDFile(s). Possible values:AtomPathsWithoutRings, AtomPathsWithRings, AllAtomPathsWithoutRings, AllAtomPathsWithRings. Default value: AllAtomPathsWithRings.
For molecules with no rings, first two and last two options are equivalent and generate same set of atom paths starting from each atom with length between --MinPathLength and --MaxPathLength. However, all these four options can result in the same set of final atom paths for molecules containing fused, bridged or spiro rings.
For molecules containing rings, atom paths starting from each atom can be traversed in four different ways:
AtomPathsWithoutRings - Atom paths containing no rings and without sharing of bonds in traversed paths.
AtomPathsWithRings - Atom paths containing rings and without any sharing of bonds in traversed paths.
AllAtomPathsWithoutRings - All possible atom paths containing no rings and without any sharing of bonds in traversed paths.
AllAtomPathsWithRings - All possible atom paths containing rings and with sharing of bonds in traversed paths.
Atom path traversal is terminated at the ring atom.
Based on values specified for for -p, --PathMode, --MinPathLength and --MaxPathLength, all appropriate atom paths are generated for each atom in the molecule and collected in a list.
For each atom path in the filtered atom paths list, an atom path string is created using value of -a, --AtomIdentifierType and specified values to use for a particular atom identifier type. Value of -u, --UseBondSymbols controls whether bond order symbols are used during generation of atom path string. Atom symbol corresponds to element symbol and characters used to represent bond order are: 1 - None; 2 - '='; 3 - '#'; 1.5 or aromatic - ':'; others: bond order value. By default, bond symbols are included in atom path strings. Exclusion of bond symbols in atom path strings results in fingerprints which correspond purely to atom paths without considering bonds.
UseUniquePaths controls the removal of structurally duplicate atom path strings are removed from the list.
For PathLengthBits value of -m, --mode option, each atom path is hashed to a 32 bit unsigned integer key using TextUtil::HashCode function. Using the hash key as a seed for a random number generator, a random integer value between 0 and --Size is used to set corresponding bits in the fingerprint bit-vector string. Value of --NumOfBitsToSetPerPaths option controls the number of time a random number is generated to set corresponding bits.
For PathLengthCount value of -m, --mode option, the number of times an atom path appears is tracked and a fingerprints count-string corresponding to count of atom paths is generated.
For molecule containing rings, combination of -p, --PathMode and --UseBondSymbols allows generation of up to 8 different types of atom path length strings:
Default atom path length fingerprints generation for molecules containing rings with AllAtomPathsWithRings value for -p, --PathMode, Yes value for --UseBondSymbols, 2 value for --MinPathLength and 8 value for --MaxPathLength is the most time consuming. Combinations of other options can substantially speed up fingerprint generation for molecules containing complex ring systems.
Additionally, value for option -a, --AtomIdentifierType in conjunction with corresponding specified values for atom types changes the nature of atom path length strings and the fingerprints.
Put quote around column values in output CSV/TSV text file(s). Possible values: Yes or No. Default value: Yes.
New file name is generated using the root: <Root>.<Ext>. Default for new file names: <SDFileName><PathLengthFP>.<Ext>. The file type determines <Ext> value. The sdf, fpf, csv, and tsv <Ext> values are used for SD, FP, comma/semicolon, and tab delimited text files, respectively.This option is ignored for multiple input files.
Size of fingerprints. Default value: 1024. Valid values correspond to any positive integer which satisfies the following criteria: power of 2, >= 32 and <= 2 ** 32.
Examples:
Specify whether to use bond symbols for atom paths during generation of atom path strings. Possible values: Yes or No. Default value: Yes.
No value option for -u, --UseBondSymbols allows the generation of fingerprints corresponding purely to atoms disregarding all bonds.
Specify whether to use Perl CORE::rand or MayaChemTools MathUtil::random function during random number generation for setting bits in fingerprints bit-vector strings. Possible values: Yes or No. Default value: Yes.
No value option for --UsePerlCoreRandom allows the generation of fingerprints bit-vector strings which are same across different platforms.
The random number generator implemented in MayaChemTools is a variant of linear congruential generator (LCG) as described by Miller et al. [ Ref 120 ]. It is also referred to as Lehmer random number generator or Park-Miller random number generator.
Unlike Perl's core random number generator function rand, the random number generator implemented in MayaChemTools, MathUtil::random, generates consistent random values across different platforms for a specific random seed and leads to generation of portable fingerprints bit-vector strings.
Specify whether to use structurally unique atom paths during generation of atom path strings. Possible values: Yes or No. Default value: Yes.
No value option for --UseUniquePaths allows usage of all atom paths generated by -p, --PathMode option value for generation of atom path strings leading to duplicate path count during PathLengthCount value of -m, --mode option. It doesn't change fingerprint string generated during PathLengthBits value of -m, --mode.
For example, during AllAtomPathsWithRings value of -p, --PathMode option, benzene has 12 linear paths of length 2 and 12 cyclic paths length of 7, but only 6 linear paths of length 2 and 1 cyclic path of length 7 are structurally unique.
Format of fingerprints vector string data in output SD, FP or CSV/TSV text file(s) specified by --output used during PathLengthCount value of -m, --mode option. Possible values: IDsAndValuesString | IDsAndValuesPairsString | ValuesAndIDsString | ValuesAndIDsPairsString. Defaultvalue: IDsAndValuesString.
Examples:
Location of working directory. Default: current directory.
To generate path length fingerprints corresponding to all unique paths from length 1 through 8 in hexadecimal bit-vector string format of size 1024 and create a SamplePLFPHex.csv file containing sequential compound IDs along with fingerprints bit-vector strings data, type:
To generate path length fingerprints corresponding to all unique paths from length 1 through 8 in hexadecimal bit-vector string format of size 1024 and create SamplePLFPHex.sdf, SamplePLFPHex.fpf, and SamplePLFPHex.csv files containing sequential compound IDs in CSV file along with fingerprints bit-vector strings data, type:
To generate path length fingerprints corresponding to all unique paths from length 1 through 8 in binary bit-vector string format of size 1024 and create a SamplePLFPBin.csv file containing sequential compound IDs along with fingerprints bit-vector strings data, type:
To generate path length fingerprints corresponding to count of all unique paths from length 1 through 8 in IDsAndValuesString format and create a SamplePLFPCount.csv file containing sequential compound IDs along with fingerprints vector strings data, type:
To generate path length fingerprints corresponding to count of all unique paths from length 1 through 8 in IDsAndValuesString format using E-state atom types and create a SamplePLFPCount.csv file containing sequential compound IDs along with fingerprints vector strings data, type:
To generate path length fingerprints corresponding to count of all unique paths from length 1 through 8 in IDsAndValuesString format using SLogP atom types and create a SamplePLFPCount.csv file containing sequential compound IDs along with fingerprints vector strings data, type:
To generate path length fingerprints corresponding to count of all unique paths from length 1 through 8 in IDsAndValuesString format and create a SamplePLFPCount.csv file containing sequential compound IDs along with fingerprints vector strings data, type:
To generate path length fingerprints corresponding to count of all unique paths from length 1 through 8 in IDsAndValuesString format using AS,X,BO as atomic invariants and create a SamplePLFPCount.csv file containing sequential compound IDs along with fingerprints vector strings data, type:
To generate path length fingerprints corresponding to count of all paths from length 1 through 8 in IDsAndValuesString format and create a SamplePLFPCount.csv file containing compound IDs from MolName line along with fingerprints vector strings data, type:
To generate path length fingerprints corresponding to all unique paths from length 1 through 8 in hexadecimal bit-vector string format of size 512 after folding and create SamplePLFPHex.sdf, SamplePLFPHex.fpf, and SamplePLFPHex.sdf files containing sequential compound IDs along with fingerprints bit-vector strings data, type:
To generate path length fingerprints corresponding to all unique paths from length 1 through 8 containing no rings and without sharing of bonds in hexadecimal bit-vector string format of size 1024 and create a SamplePLFPHex.csv file containing sequential compound IDs along with fingerprints bit-vector strings data and all data fields, type:
To generate path length fingerprints corresponding to all unique paths from length 1 through 8 containing rings and without sharing of bonds in hexadecimal bit-vector string format of size 1024 and create a SamplePLFPHex.tsv file containing compound IDs derived from combination of molecule name line and an explicit compound prefix along with fingerprints bit-vector strings data and all data fields, type:
To generate path length fingerprints corresponding to count of all unique paths from length 1 through 8 in IDsAndValuesString format and create a SamplePLFPCount.csv file containing sequential compound IDs along with fingerprints vector strings data using aromaticity specified in SD file, type:
To generate path length fingerprints corresponding to all unique paths from length 2 through 6 in hexadecimal bit-vector string format of size 1024 and create a SamplePLFPHex.csv file containing sequential compound IDs along with fingerprints bit-vector strings data, type:
InfoFingerprintsFiles.pl, SimilarityMatricesFingerprints.pl, AtomNeighborhoodsFingerprints.pl, ExtendedConnectivityFingerprints.pl, MACCSKeysFingerprints.pl, TopologicalAtomPairsFingerprints.pl, TopologicalAtomTorsionsFingerprints.pl, TopologicalPharmacophoreAtomPairsFingerprints.pl, TopologicalPharmacophoreAtomTripletsFingerprints.pl
Copyright (C) 2024 Manish Sud. All rights reserved.
This file is part of MayaChemTools.
MayaChemTools is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.