Hi ! I'm looking for a way to improve my pipeline ...
# nf-test
l
Hi ! I'm looking for a way to improve my pipeline level nf-test. To do so I would like to share a common function to recursively check all the file in the output directory. To share it I wa thinking of adding it to a groovy file in the libDir folder defined in the .nf-test.config but I didn't succeed in properly importing it. Is there an example somewhere I could take inspiration from ?
Here is the function set in ./tests/lib/test_helper.groovy
Copy code
public class Methods {
    public static def getRecursiveFileNames(fileOrDir, outputDir, variants_md5=true, txt_md5=true) {
        def f = new File(fileOrDir.toString())
        if ( f.isDirectory() ) {
            return f.listFiles()
                .collect { getRecursiveFileNames(it, outputDir, variants_md5) }
                .sort { it.file }
        }
        def check = null
        def file_name = f.toString().replace("${outputDir}/","")
        if ( (f.name.endsWith('.txt') || f.name.endsWith('.log')) && txt_md5 ) {
            check = path(f.toString()).md5
            return ["file": file_name, "md5": check ]
        } else if ( f.name.endsWith('.vcf.gz') && variants_md5 ) {
            check = path(f.toString()).vcf.variantsMD5
            return ["file": file_name, "variants": check ]
        } else{
            return ["file": file_name]
        }
    }
}
I'm getting the following error when using it in a nextflow_pipeline test:
groovy.lang.MissingMethodException: No signature of method: test_stitch_nf$_run_closure1$_closure2.getRecursiveFileNames() is applicable for argument types: (sun.nio.fs.UnixPath, String) values: [/home
m
l
Because I would like to obtain the md5sum of the variants when it's a vcf 🙂
m
so my answer as often is Sarek
👀 1
but I have a simpler example in rnavar
l
Thanks a lot. The issue was that my groovy file wasn't named the same way as the class 🤣
m
In our pipeline, @Naran • excluded the vcf files from getAllFilesFromDir here and here • added the nft-vcf plugin here • the tests lists the VCF files separately and gets their checksum via the plugin here
nf core deal with it 1
m
Nice