Minimal example:
input:
file input_files from featureCounts_to_merge.collect()
output:
file 'merged_gene_counts.txt'
script:
//if we only have 1 file, just use cat and pipe output to csvtk. Else join all files first, and then remove unwanted column names.
def single = input_files instanceof Path ? 1 : input_files.size()
def merge = (single == 1) ? 'cat' : 'csvtk join -t -f "Geneid,Start,Length,End,Chr,Strand,gene_name"'
"""
$merge $input_files | csvtk cut -t -f "-Start,-Chr,-End,-Length,-Strand" | sed 's/Aligned.sortedByCoord.out.markDups.bam//g' > merged_gene_counts.txt
"""
I expect input_files.size() to return the size of the list, e.g. having n elements.
Actually, this depends:
See above testcase
What is bla in your example? do you mean input_files ?
Updated the post, yes that's what I meant :-)
OK, this is the problem we discussed right. Therefore with input_files instanceof Path ? 1 : input_files.size() you get the list size, right?
Exactly, I used this now for the RNAseq pipeline in that way :-)
OK. being so I will change the title because it's misleading. The problem is not the File.size method but the fact that a list containing a single value is implicitly converted to the element value, causing that quirk behaviour.
Yes of course :-)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.