Count Bits set in a Custom Fingerprint table

User 71f9fd1282

09-09-2004 10:57:40

I store the structures in a table called "test3" and using a custom fingerprint (classes FP*.java) and used generatemd to create the custom fingerprints for the molecules in table "f9901".


Now I want to count how often a Bit is set in "f9901" for a group of molecules belonging to the same drugclass (this information is stored in a user defined field VARCHAR(100) called 'gruppe', e.g. "aRB").





Can you tell me if i am really reading out the data from the "f9901" table (or am i creating new fingerprints according to the FPGenerator-class???)?





Thanks for your help!





here is the code:





public class mrechnen


{





public static void main(String[] args)


throws SQLException, ClassNotFoundException


{





int dim=379; //fingerprintlength





String structuretablename = "test3";


String fingerprintname = "f9901"


String gruppe = "aRB"








String[] mdNames = {fingerprintname};


String sqlCondition="gruppe='"+gruppe+"'";








ConnectionHandler ch = new ConnectionHandler();


ch.setDriver("org.gjt.mm.mysql.Driver");


ch.setUrl("jdbc:mysql://localhost/mysql");


ch.setLoginName("fp1");


ch.setPassword(";-)");


try


{


ch.connect();


}





catch ...








MDDBReader mddbreader = new MDDBReader(ch, structuretablename, mdNames, sqlCondition);








String cd_id;


int ctr=0;





MDSet mdset = new MDSet();





FP descriptor = new FP();





int i,j,hits=0;





int[] bitsset = new int[dim];





boolean ersterTreffer = true;





try


{


while (mddbreader.next()!=null)


{


if (ersterTreffer)


{


ersterTreffer = false;


}





ctr=ctr+1;


mdset = mddbreader.getMDSet();





// is this correct?????


descriptor = (FP) mdset.getDescriptor(0);








System.out.println("Checking molecule nr"+ctr+". of group");





for (i=0;i<dim;i++) //Eintraege berechnen


{


if (descriptor.getKey(i)==1)


{


bitsset++;





}


...


}

ChemAxon efa1591b5a

09-09-2004 11:28:36

You are reading the table, and taking stored FP data from the table (no generation is here). The source line with the question marks is all right.





However, MDSet should be set up properly: after it is created and its only component (FP) is created, this components has to be added to the set:





Code:
MDSet mdset = new MDSet( 1 ); // there'll be only 1 component


FP descriptor = new FP();


mdset.addDescriptor( descriptor );






Hope this helps, please get back to the forum in case you need further assistance.





Miklos