This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Basic coding-Stuck with Java script while working with KNIME

Hi there, I am working screening a ligand db on KMINE, and have to assign a column for the number of times each ligand cleared the following conditions for the 5 attributes in the columns of the input table:

Attributes                                                        Conditions
 1. SlogP                                                           <5
 2. TPSA                                                            <70
 3. Average Molecular Weight  (AMW)             <450
 4. No of rotatable bonds                                   <8
 5. Total Hydrogen donors and acceptors          <7

I am new to coding and I am suppose to use Java snippet according to the workflow I am following: I tried if-else-if statement, but as per the code, the conditions are getting bypassed every time it is true for one condition, hence the output column shows either 0 or 1.

enter image description here

I am following this beautiful website: https://www.geeksforgeeks.org/continue-statement-in-java/?ref=lbp which has the best simplified illustrations for a beginner. But all the flowcharts simply do not conform to my problem. I really need some help here. :)

java

1 answer

I'm not sure I understand. unless I'm wrong you don't have to use else if , just use if statements

int count=0;
if($a$ < 12) count++;
if($b$ < 34) count++;
if($c$ > 57) count++;
if($d$ < 89) count++;
return count;

Log in to answer this question.