diff --git a/lib/QC.groovy b/lib/QualityChecker.groovy similarity index 98% rename from lib/QC.groovy rename to lib/QualityChecker.groovy index 875480a..49959e8 100644 --- a/lib/QC.groovy +++ b/lib/QualityChecker.groovy @@ -5,7 +5,7 @@ * Luca Cozzuto */ - class QC { + class QualityChecker { /* * Properties definition diff --git a/lib/Reporter.groovy b/lib/Reporter.groovy new file mode 100644 index 0000000..650ab88 --- /dev/null +++ b/lib/Reporter.groovy @@ -0,0 +1,104 @@ +/* + * Class for making reports, file descriptors, etc + * + * @authors + * Luca Cozzuto + */ + + class Reporter { + + /* + * Properties definition + */ + + String email = '' + String id = '' + String title = '' + String subtitle = '' + String strand = '' + String extension = '' + String type = '' + String file_name = '' + String PI = '' + String user = '' + String config_file = '' + + + def public test() { + output = this.dump() + """ + echo '${output}' + """ + } + + /* + * Method for writing files needed for an HUB @ UCSC Genome Browser + */ + + def public makeGenomeUcscHub() { + + """ + echo "genome ${this.id} +trackDb ${this.id}/trackDb.txt" > genomes.txt; + echo "hub ${this.id} +shortLabel ${this.title} +longLabel ${this.subtitle} +genomesFile genomes.txt +email ${this.email}" > hub.txt + """ + } + + /* + * Method for writing track DB file needed for HUB @ UCSC Genome Browser + */ + def public makeBigWigTrackDB() { + + """ + echo "track ${this.id} +type ${this.type} +compositeTrack on +shortLabel RNAseq profiles (${this.title}) +longLabel RNAseq profiles (${this.subtitle}) +visibility full +color 0,0,255 +autoScale on +maxHeightPixels 128:60:11 +" >> trackDb.txt; + for i in *.${this.extension}; \\ + do NAME=`echo \$i | sed s/\\.${this.extension}//g`; \\ + echo track \$NAME; \\ + echo bigDataUrl \$i; \\ + echo shortLabel \$NAME; \\ + echo longLabel \$NAME; \\ + echo "type ${this.type}"; \\ + echo "parent ${this.id}"; \\ + echo ""; \\ + done >> trackDb.txt; + """ + } + + /* + * Method for writing multiQC report in a super custom way + */ + def public makeMultiQCreport() { + + """ +echo "title: \"${this.title}\" +subtitle: \"${this.subtitle}\" +intro_text: False + +report_header_info: + - PI: ${this.PI} + - User: ${this.user} + - Date: `date` + - Contact E-mail: \'${this.email}\' + - Application Type: \'ChIP-seq\' + - Reference Genome: \'${this.id}\' +" > config.yaml; +cat ${this.config_file} >> config.yaml; + multiqc -c config.yaml . + """ + } + + +} \ No newline at end of file diff --git a/testFunctions.nf b/testFunctions.nf index dbd0df0..cef55fc 100644 --- a/testFunctions.nf +++ b/testFunctions.nf @@ -27,16 +27,12 @@ */ -/* - * Check that helper function `mappingPairsWithSTAR` returns the exepcted result - - */ process testFunction { echo true script: - myclass = new NGSaligner2(reads:"luca.fastq", output:"toni.qual") + def myclass = new QC(input:"luca.fastq", output:"toni.qual") myclass.test() }