These are chat archives for nextflow-io/nextflow

25th
Jun 2018
Maxime Vallée
@valleem
Jun 25 2018 11:32

Hello NF community, quick question!
I have a problem using Operators on input list (I have a Channel holding lists). I achieve expected results using .first() or .last() or take(3). However, when I use .filter( ~/.*vcf/ )} (to get only the VCF files), I end up with :

Caused by:

  No signature of method: java.util.ArrayList.filter() is applicable for argument types: (java.util.regex.Pattern) values: [^S.*]Possible solutions: clear(), size(), clear(), clear(), size(), first()

I tried also .endsWith("vcf"), no success either. Any help will be greatly appreciated!

Paolo Di Tommaso
@pditommaso
Jun 25 2018 12:05
provide a code example
Maxime Vallée
@valleem
Jun 25 2018 12:21

Sure, it is bogus code just to test it out :

    script:
     """
    echo ${inputs}
    echo ${inputs.collect { "-V $it " }}
    echo ${inputs.collect { "-V $it " }.join()}

    echo ${inputs.collect { "-V $it " }.first()}
    echo ${inputs.collect { "-V $it " }.last()}
    echo ${inputs.collect { "-V $it " }.take( 3 )}
    echo ${inputs.collect { "-V $it " }.filter( ~/^S.*/ )}

    """

Everything works as expected until I add the last line, I end up with the error I pasted previously.

Paolo Di Tommaso
@pditommaso
Jun 25 2018 12:27
because filter is not a method you can apply to a collection/array
you are looking for findAll
Maxime Vallée
@valleem
Jun 25 2018 12:38
thank you, I will try and report
Maxime Vallée
@valleem
Jun 25 2018 13:40
report : it works thank you!