Removing a string from a list in the nf script section with groovy - multiple solutions do not work #3891
Unanswered
colindaven
asked this question in
Q&A
Replies: 2 comments 2 replies
-
Good to know you solved your issue. A snippet I like to share when we want to know what methods are supported by an object in a Nextflow channel can be found below: some_ch = Channel.of(file("/Users/mribeirodantas/dag.dot"), "some random string")
some_ch.view { it.properties.each{ println it } } |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think the issue is that a path input can be a file or a list of files depending on whether there are multiple files, which has caused lots of headaches for users over the years. This PR #3706 will address the problem by allowing you to specify the number of files you expect (e.g. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have problems with groovy code apparently not working in the nextflow script section. I'm just trying to remove a string from a groovy list by multiple methods, either by removing it directly, or adding a string at position 1 and then eg calling
.unique()
etc.Why does arg.unique() not work in Nextflow on a list of strings?? Could it be that the filenames are not actually just ArrayLists of strings in Nextflow ?
Edit and resolution - yes, this was actually the case - check the class of your object before wondering why groovy standard list methods are not working!
Example - I expected the nextflow object
nf_fasta_paths
to be a list, but it was not. All groovy methods such ascontains(), unique()
etc failed without a warning/error in this code. Everything works as expected if I convert the objectnf_fasta_paths
into a standard groovyArrayList
in a for loop.Beta Was this translation helpful? Give feedback.
All reactions