Class FingerprinterTool

java.lang.Object
org.openscience.cdk.fingerprint.FingerprinterTool

public class FingerprinterTool extends Object
Tool with helper methods for IFingerprint.
Author:
steinbeck
Source code:
main
Belongs to CDK module:
standard
Keywords:
fingerprint
Created on:
2002-02-24
  • Constructor Details

    • FingerprinterTool

      public FingerprinterTool()
  • Method Details

    • isSubset

      public static boolean isSubset(BitSet bs1, BitSet bs2)
      Checks whether all the positive bits in BitSet bs2 occur in BitSet bs1. If so, the molecular structure from which bs2 was generated is a possible substructure of bs1.

      Example:

        Molecule mol = MoleculeFactory.makeIndole();
        BitSet bs = Fingerprinter.getBitFingerprint(mol);
        Molecule frag1 = MoleculeFactory.makePyrrole();
        BitSet bs1 = Fingerprinter.getBitFingerprint(frag1);
        if (Fingerprinter.isSubset(bs, bs1)) {
            System.out.println("Pyrrole is subset of Indole.");
        }
        
      Parameters:
      bs1 - The reference BitSet
      bs2 - The BitSet which is compared with bs1
      Returns:
      True, if bs2 is a subset of bs1
      Keywords:
      substructure search
    • listDifferences

      public static List<Integer> listDifferences(BitSet bs1, BitSet bs2)
      This lists all bits set in bs2 and not in bs2 (other way round not considered) in a list and to logger. See. differences(java.util.BitSet, java.util.BitSet) for a method to list all differences, including those missing present in bs2 but not bs1.
      Parameters:
      bs1 - First bitset
      bs2 - Second bitset
      Returns:
      An arrayList of Integers
      See Also:
    • differences

      public static Set<Integer> differences(BitSet s, BitSet t)
      List all differences between the two bit vectors. Unlike listDifferences(java.util.BitSet, java.util.BitSet) which only list those which are set in s but not in t.
      Parameters:
      s - a bit vector
      t - another bit vector
      Returns:
      all differences between s and t
    • makeBitFingerprint

      public static IBitFingerprint makeBitFingerprint(Map<String,Integer> features)
      Convert a mapping of features and their counts to a 1024-bit binary fingerprint. A single bit is set for each pattern.
      Parameters:
      features - features to include
      Returns:
      the continuous fingerprint
      See Also:
    • makeBitFingerprint

      public static IBitFingerprint makeBitFingerprint(Map<String,Integer> features, int len)
      Convert a mapping of features and their counts to a binary fingerprint. A single bit is set for each pattern.
      Parameters:
      features - features to include
      len - fingerprint length
      Returns:
      the continuous fingerprint
      See Also:
    • makeBitFingerprint

      public static IBitFingerprint makeBitFingerprint(Map<String,Integer> features, int len, int bits)
      Convert a mapping of features and their counts to a binary fingerprint. Each feature can set 1-n hashes, the amount is modified by the bits operand.
      Parameters:
      features - features to include
      len - fingerprint length
      bits - number of bits to set for each pattern
      Returns:
      the continuous fingerprint
    • makeCountFingerprint

      public static ICountFingerprint makeCountFingerprint(Map<String,Integer> features)
      Wrap a mapping of features and their counts to a continuous (count based) fingerprint.
      Parameters:
      features - features to include
      Returns:
      the continuous fingerprint