Creating flow variables with R-Snippet works, but...

...not completely in the right way.

I am using an R-Snippet to read an external .txt file (parameter file). These parameters are then mapped to a list of flow variables. I want to send these to an OpenMS-node (MSGFPlusAdapter, node for protein identification) to use the parameters specified in the external .txt file instead of default or manually chosen values.

The flow variables are sucessfully created with:

parameters <- #receives parameter file from r source node
rownames(parameters) <- parameters[,1]
knime.out <- parameters

# write flow variables from parameter file
knime.flow.out <- list(	tolerance = as.double(parameters["tolerance",2]),
			chargeRange_min = parameters["chargeRange_min",2], 
			chargeRange_max = parameters["chargeRange_max",2],
			lengthRange_min = parameters["lengthRange_min",2],
			lengthRange_max = parameters["lengthRange_max",2],
			instrument = as.character(parameters["instrument",2]),
			enzyme = as.character(parameters["enzyme",2]),
			fragmentation = as.character(parameters["fragmentation",2]),
			protocol= as.numeric(parameters["protocol",2]),
			isotopeError_min = parameters["isotopeError_min",2], 
			isotopeError_max = parameters["isotopeError_max",2],
			matches = as.numeric(parameters["matches",2]),
			ntt = as.numeric(parameters["ntt",2]),
			tda = as.numeric(parameters["tda",2]),
			mods_count = as.numeric(1)


Now, if I check the created variables internally in the R-Script everything looks fine: #1

However if I check the Data output of the node and then the flow variables list it looks like this, the values are all wrong: #2

Anybody knows a solution? Maybe I have to specify the data types in an other way in the script?

Thanks for your time and help!

Hi Andorak,

It looks like the two screenshots point to the same URL, so I can't quite see what the issue is. Could you update the screenshot links?



The Url provides a site with both screenshots titled #1 and #2.

You should be able to scroll down a bit and see it.

Hi andorak!

Your output in #1 shows that the values which are incorrect seem to be printed as factors (Hence the "n Levels" displayed after). As far as I understand these values should be numerical?

Can you please try wrapping `as.numeric()` around e.g. chargeRange_min/max?

chargeRange_min = as.numeric(parameters["chargeRange_min",2]),

I cannot try this, as I don't know what your `parameters` variable looks like...

Hope this helps!