use of org.openscience.cdk.fingerprint.IBitFingerprint in project MetFragRelaunched by ipb-halle.
the class TanimotoSimilarityTest method toBitString.
private String toBitString(IBitFingerprint fp) {
final StringBuilder bitStringBuilder = new StringBuilder();
final BitSet bitSet = fp.asBitSet();
for (int i = 0; i < bitSet.size(); i++) {
boolean bit = bitSet.get(i);
if (bit)
bitStringBuilder.append("1");
else
bitStringBuilder.append("0");
}
return bitStringBuilder.toString();
}
use of org.openscience.cdk.fingerprint.IBitFingerprint in project MetFragRelaunched by ipb-halle.
the class TanimotoSimilarityTest method testFingerprint.
@Test
public void testFingerprint() throws Exception {
// LKJPSUCKSLORMF-UHFFFAOYSA-N
final String smiles = "CN(C(=O)NC1=CC=C(C=C1)Cl)OC";
final IAtomContainer molecule = MoleculeFunctions.getAtomContainerFromSMILES(smiles);
MoleculeFunctions.prepareAtomContainer(molecule, true);
final IBitFingerprint fp = TanimotoSimilarity.calculateFingerPrint(molecule);
final String bitStringOfFingerprint = this.toBitString(fp);
assertThat(bitStringOfFingerprint, is(this.oldFingerprintString));
}
use of org.openscience.cdk.fingerprint.IBitFingerprint in project MetFragRelaunched by ipb-halle.
the class FingerPrintR method toBitString.
private static String toBitString(IBitFingerprint fp) {
final StringBuilder bitStringBuilder = new StringBuilder();
final BitSet bitSet = fp.asBitSet();
for (int i = 0; i < bitSet.size(); i++) {
boolean bit = bitSet.get(i);
if (bit)
bitStringBuilder.append("1");
else
bitStringBuilder.append("0");
}
return bitStringBuilder.toString();
}
use of org.openscience.cdk.fingerprint.IBitFingerprint in project MetFragRelaunched by ipb-halle.
the class FingerPrintR method calculateFingerprintFromSmiles.
public static String calculateFingerprintFromSmiles(String smiles) {
final IAtomContainer con = getAtomContainerFromSmiles(smiles);
MoleculeFunctions.prepareAtomContainer(con, true);
final IBitFingerprint fingerprint = TanimotoSimilarity.calculateFingerPrint(con);
return toBitString(fingerprint);
}
use of org.openscience.cdk.fingerprint.IBitFingerprint in project MetFragRelaunched by ipb-halle.
the class MetFusionMoNASpectralSimilarityInitialiser method initScoreParameters.
@Override
public void initScoreParameters(Settings settings) throws Exception {
/*
*
*/
// initialise MoNA web service
MoNARestWebService webService = new MoNARestWebService(settings);
((ProcessingStatus) settings.get(VariableNames.PROCESS_STATUS_OBJECT_NAME)).setProcessStatusString("Retrieving Results from MoNA");
CandidateList candidatesFromMoNA = null;
try {
candidatesFromMoNA = webService.performSpectrumSimilaritySearch();
} catch (Exception e) {
settings.set(VariableNames.METFUSION_MONA_SPECTRAL_SIMILARITY_CANDIDATES_NAME, new CandidateList());
e.printStackTrace();
return;
}
for (int i = 0; i < candidatesFromMoNA.getNumberElements(); i++) {
IBitFingerprint fingerprint = TanimotoSimilarity.calculateFingerPrint(candidatesFromMoNA.getElement(i).getAtomContainer());
candidatesFromMoNA.getElement(i).setProperty("Fingerprint", fingerprint);
}
settings.set(VariableNames.METFUSION_MONA_SPECTRAL_SIMILARITY_CANDIDATES_NAME, candidatesFromMoNA);
}
Aggregations