I'm currently setting up a very basic Cheminformatics pipeline for use within my academic research group to help us filter through commercially available compounds. I am a beginner KNIME user, but have a decent enough understanding of Python to think I might be able to use it to help with my issue.
I have a Table in which chemical compounds have a number of different features, three of which are important - one for $QuantityNumber$ i.e 250; one for $Unit$ i.e. grams; and one for $Price$ i.e. 104.
However, I want to later perform a calculation where I can work out price per gram, and some of the quantities are in milligrams - for this reason, I want to alter the price depending on the unit.
Could somebody please walk me through how to setup a Python scripting node in which I can do something like this for each entry in the Table (in this example converting a price and weight combination in milligrams to the appropriate price in grams) :
if $Unit$ = 'mg':
QuantityFactor = 1000 / $QuantityNumber$ (to find factor by which to multiply to get price for one gram of material)
$QuantityNumber$ = 1 (to set the quantity to 1 gram for the calculation)
$Price$ = $Price$ * QuantityFactor (to get the price per gram)
Thanks in advance.