Skip to content

Commit

Permalink
new DEFAULT_SUMMARIZE
Browse files Browse the repository at this point in the history
'*.md,*.html,*.?sv,*.pdf,multiqc/multiqc_report.html'
  • Loading branch information
drernie committed Oct 3, 2023
1 parent f86ba23 commit 16f7f3c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import groovy.json.JsonOutput
@CompileStatic
class QuiltProduct {
public final static String README_FILE = 'README_NF_QUILT.md'
public final static String SUMMARY_FILE = 'quilt_summarize.json'


private final static String KEY_META = 'metadata'
private final static String KEY_README = 'readme'
Expand All @@ -64,7 +66,7 @@ class QuiltProduct {
## processes
${meta['workflow']['stats']['processes']}
'''
private final static String DEFAULT_SUMMARIZE = '**.md,**.html'
private final static String DEFAULT_SUMMARIZE = '*.md,*.html,*.?sv,*.pdf,multiqc/multiqc_report.html'

private final static String[] BIG_KEYS = [
'nextflow', 'commandLine', 'scriptFile', 'projectDir',
Expand Down Expand Up @@ -276,7 +278,7 @@ ${meta['workflow']['stats']['processes']}
}

String qs_json = JsonOutput.toJson(quilt_summarize.keySet() as String[])
writeString(qs_json, pkg, 'quilt_summarize.json')
writeString(qs_json, pkg, SUMMARY_FILE)
return quilt_summarize
}

Expand Down
46 changes: 46 additions & 0 deletions plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ import nextflow.Session
import nextflow.quilt.QuiltSpecification
import nextflow.quilt.QuiltProduct
import nextflow.quilt.jep.QuiltParser
import nextflow.quilt.jep.QuiltPackage

import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import groovy.transform.CompileDynamic
import spock.lang.IgnoreIf
import spock.lang.Unroll

/**
*
Expand Down Expand Up @@ -145,4 +150,45 @@ class QuiltProductTest extends QuiltSpecification {
makeWriteProduct(skip_meta).pubStatus == 1 // still fails on implicit metadata
}

void writeFile(root, filename) {
Path outPath = Paths.get(root, filename)
outPath.getParent().toFile().mkdirs()
Files.writeString(outPath, "#Time, Filename\n${timestamp},${filename}")
println("writeFile: ${filename} -> ${outPath}")
}

int writeFiles(dest) {
String root = dest.toString()
String[] filenames = [
'SUMMARIZE_ME.md',
'SUMMARIZE_ME.csv',
'SUMMARIZE_ME.tsv',
'SUMMARIZE_ME.html',
'SUMMARIZE_ME.pdf',
'SUMMARIZE_ME.xml',
'multiqc/multiqc_report.html'
]
filenames.each { writeFile(root, it) }
return filenames.size()
}

@Unroll
@IgnoreIf({ env.WRITE_BUCKET == 'quilt-example' || env.WRITE_BUCKET == null })
void 'should summarize top-level readable files + multiqc '() {
given:
String sumURL = writeableURL('summarized')
QuiltPackage sumPkg = writeablePackage('summarized')
writeFiles(sumPkg.packageDest())

and:
Session session = Mock(Session)
QuiltPath path = QuiltPathFactory.parse(sumURL)
QuiltProduct product = new QuiltProduct(path, session)

expect:
product.publish() == 0
sumPkg.install()
Files.exists(Paths.get(sumPkg.packageDest().toString(), QuiltProduct.SUMMARY_FILE))
}

}

0 comments on commit 16f7f3c

Please sign in to comment.