hi all, I'm relatively new to nf-core. I'm develop...
# help
v
hi all, I'm relatively new to nf-core. I'm developing a nf-core style workflow and have a question about validating tabulated data inputs to a workflow. I have 3 different sample sheets to put into the workflow. One of the sample sheets is converted into a channel to initiate the workflow, but the other two are input to separate downstream modules as file paths which are then read in, but this will necessarily not use the validated outputs. My question is, is there a way to save the validated output as a sample sheet which I can then feed into the downstream module?
n
I am not so sure if I really understand your question. Do you mean validate via
nf-schema
? That would throw errors if things do not pass validation I think, but would not change anything about the files
As in, there is no validated output, if the input is not valid it fails.
v
yes, I use
nf-schema
to validate my files. Maybe I'm getting hung up over an edge case, but I'm worried about what would happen if my file was largely correct except that one entry in a row has a trailing whitespace that would cause errors in the workflow. From what I understand,
samplesheetToList()
catches these trailing whitespaces and trims them, but I don't see an easy way to convert its output back into a sample sheet for downstream workflow analysis. That means validation won't throw an error, but my workflow will because I am still using unvalidated inputs.
n
I see, I never really tried that, but it should be rather straightforward groovy https://groovy.apache.org/blog/reading-and-writing-csv-files you should be able to take the list that comes out and write it to a new csv file
v
okay, so it sounds like I would need to save the validated outputs and then read them in again in the relevant process. Will look into it - thanks for your help!
n
An alternative would be having them as a channel input for your other process, but I understood your question to mean that those other tools require a file input
You could also create a file from a channel in the process, this depends a bit in your needs
v
yeah, the other process requires a file input instead so I would either have to save the validated outputs as a file or modify my process to collect channel inputs and construct a dataframe instead. Both are doable, and it sounds like the latter is cleaner to avoid writing operations