Bitvector cardinality?

Is there an easy method to create a column containing fingerprint bitvector cardinalities (number of set bits) from a column of fingerprints?

I had assumed that a java snippet could do it but can't see how to access knime's SparseBitVectorCell class (the import isn't recognised).

We have a node in development to do this.  We were not planning on community release quite yet, but we could bump it up our priority list!


We will try to get this node into our nightly build update site tomorrow morning - will post again when it is there.


Hope this helps,


OK, that would be splendid...

Out of interest it would be nice to know if it could also be done via a java snippet node, or does one need to go throught the SDK to do this kind of thing?

I will have to get into the SDK at some point, but still relatively new to Knime.

I know that the 'native' access to the fingerprints in the snippets gives you them as a string representation as a list of set bits.  You may be able to chop this around, but if you do find a way it would be interesting to know.  This post might help:


We've just updated the nightly build with the node.  In case you are wondering, the icon is supposed to look like a pair of scales in front of a barcode!

The node may be a little slow on big tables at the moment - we will optimise it a bit in a future update, but we believe it to work on both Sparse and Dense representations.

Please let us know if it does what you need.


I will try out the new node once its available. I did manage to do this in a snippet - found out where the extra knime.core jar file was located and added this to custom libs, and did something like this (which may not be the most efficient method):

// custom imports:
import java.math.BigInteger;

// not all code shown
  public Integer out_Cardinality;

// custom variables:
SparseBitVector sbv;
//body of snippet
BigInteger tmp = new BigInteger(c_Fingerprint,2);
String hex=tmp.toString(2);
sbv=new SparseBitVector(hex);
int ln=sbv.cardinality();
out_Cardinality = ln;

The node is now available, if you want to give it a try.  It's only in the nightly build, but that has now been re-built with the new node.


Tried the new node - it works fine - and the computed cardinality agrees with the code I used above.

Cheers for that.

- SGO -

Great.  Thanks for the feedback - it's always good to know it works on with a truly independant test!


I am a java barcode reader developer.I have experienced a problem with calculation of molecular fingerprints using the CDK plugin version 1.2.0 BETA in the latest version of KNIME. When I pass a CDK format molecule to the CDK Fingerprint node it outputs the fingerprint in an integer column that only displays one number instead of a string of numbers as I had expected. That is the DataTable displays the column as type I while the DataTableSpec says the type is BitVecCell and the DataColumnProperties tab says the column is a string. Am I doing something wrong or is there a work around? Have any of you tried using the Fingerprint node with succes?