Skip to content

Commit

Permalink
add process to convert manifest json to csv
Browse files Browse the repository at this point in the history
  • Loading branch information
imendes93 committed Dec 23, 2021
1 parent 1b82eec commit 5c36a60
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
31 changes: 29 additions & 2 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,18 @@ if (params.download_from) {
.set { accession_ids }
}
if(download_from('gen3-drs')){
// TODO - Reads parameter optional. If not provided use all data in manifest
Channel
.fromPath(params.reads)
.ifEmpty { exit 1, "Cannot find CSV reads file : ${params.reads}" }
.splitCsv(skip:1)
.map { md5sum, file_name, obj_id, file_size -> [md5sum, file_name, obj_id, file_size] }
.set { ch_gtex_gen3_ids }
.map { file_name -> [file_name] }
.set { ch_gtex_gen3_reads }

Channel
.fromPath(params.manifest)
.ifEmpty { exit 1, "Cannot find manifest file : ${params.manifest}" }
.set { ch_gtex_gen3_manifest }
}
if(download_from('ftp')){
Channel
Expand Down Expand Up @@ -465,6 +471,27 @@ if ( download_from('ftp') ) {
---------------------------------------------------*/

if ( download_from('gen3-drs')) {
process in2csv {
label 'tiny_memory'
publishDir "${params.outdir}/process-logs/${task.process}/${file(file_name).baseName}", pattern: "command-logs-*", mode: 'copy'

input:
file(manifest) from ch_gtex_gen3_manifest

output:
file("*.csv") into ch_gtex_gen3_manifest_csv

script:
"""
filename=$(basename $manifest .json)
in2csv $manifest > \${filename}.csv
"""
}
ch_gtex_gen3_manifest_csv.
.splitCsv(skip:1)
.map { md5sum, file_name, obj_id, file_size -> [md5sum, file_name, obj_id, file_size] }
.set { ch_gtex_gen3_ids }

process gen3_drs_fasp {
tag "${file_name}"
label 'low_memory'
Expand Down
3 changes: 3 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ process {
withName: 'get_accession' {
container = 'anczukowlab/download_reads:2.0'
}
withName: 'in2csv' {
container = 'quay.io/lifebitai/csvkit:1.0.5'
}
withName: 'gen3_drs_fasp' {
container = 'anczukowlab/lifebit-ai-fasp:v1.1'
}
Expand Down

0 comments on commit 5c36a60

Please sign in to comment.