GroupBy chunk of rows unequally distributed ?

Hello

I would like to ask your help for the following problem.

A software that predicts molecules’ toxicities gives the following output as plain text file.

image

Each line containing the string “SMILES” correspond to one molecule and the rows immediately after it are the respective predicted value(s) until the next “SMILES”-containing string, which denotes the next molecule (and so on). The issue is that, for a given molecule, one to many values can be given.

The desired output is simply to transpose next to each molecule its predicted value(s).

image

If the number of rows after each molecule would stay the same, this can be easily done with a groupby node. However, as it randomly changes i don’t know how to correctly group each block of rows.

Do you have any suggestion on how to do it? Considering that I am not an expert of java or python scripting…

Thank you in advance.

Filippo

Hi @remov3

Welcome to the KNIME forum . Scripting is not needed, see this workflow KNIME_project2.knwf (41.8 KB)

.

Is this what you are looking for?
gr. Hans

4 Likes

Dear HansS

thank you for your help, it was exactly what i was looking for.

Kind regards,

Filippo

3 Likes

Hi there,

would take a similar approach with Missing Value node only would avoid Joiner and Sorter by using Rule Engine node to determine group.

DataManip

Here is wf: KNIME_project2_ipazin.knwf 1.knwf (65.6 KB)

Br,
Ivan

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.