gpt4 book ai didi

Nextflow - How to pass the yaml format input file from an argument to channel as a list(NextFlow-如何将YAML格式的输入文件从参数传递给频道作为列表)

转载 作者:bug小助手 更新时间:2023-10-24 20:49:27 32 4
gpt4 key购买 nike



How to pass the yaml format input file from an argument to a channel samples as a list? Appreciate if any nextflow function or simple solution to make the channel samples works!

如何将YAML格式的输入文件从一个参数传递到一个通道样本作为列表?如果有任何NextFlow功能或简单的解决方案来使通道样本工作,我将不胜感激!


$ nextflow run main.nf \
-config nextflow.config \
--input_list s3://my-bucket/params.yml \
--publish_dir ./output

--input_list s3://my-bucket/params.yaml

--INPUT_LIST S3://my-Bucket/pars.yaml


samples:
-
biosample_id: WGS001
bam: WGS001.bam
-
biosample_id: WGS0002
bam: NWGS0002.bam

The given below channel samples code works well with -params-file s3://my-bucket/params.yaml but I need to use with an argument input_list for a reason where I can't use with -params-file

下面给出的通道样例代码可以很好地与-pars-file s3://my-Bucket/params.yaml一起使用,但我需要与参数INPUT_LIST一起使用,因为我不能与-pars-file一起使用


// input_list = "s3://my-bucket/params.yaml"


Channel
.fromList( params.samples )
.ifEmpty { ['biosample_id': params.biosample_id, 'bam': params.bam] }
.set { samples }


Channel
samples.branch { rec ->
....


Channel
samples.map { it.biosample_id }
....

The follwoing code works

以下代码起作用


import groovy.yaml.YamlSlurper

params.inputs_list = "inputs.yaml"

workflow {
inputs = new YamlSlurper().parse(file(params.inputs_list))

Channel
.fromList(inputs['samples'])
.ifEmpty { ['biosample_id': params.biosample_id, 'aln': params.aln] }
.set { samples }

更多回答

parse the yml and extract the samples list..?

解析YML并提取样本列表..?

yes, with preserving the current method channel sample or with minimal changes would be good. The channel samples method in my workflow works in commandline with -params-file params.yml but I couldn't run it from nftower dashboard which is one of my requirement. LImitation of pasting the large size of input (eg. 10k samples list) file as json/yaml in the the nftower dashboard under "pipeline parameter" which is equivalent to the Nextflow -params-file option. Here I want to pass the input file as an arg input_list to overcome the character limitation.

是的,保留当前方法通道样本或进行最小的更改将是很好的。我的工作流中的频道样例方法在命令行中与-pars-file params.yml一起工作,但我无法从nfTower仪表板运行它,这是我的需求之一。限制粘贴较大尺寸的输入内容(例如10K Samples List)文件作为json/yaml出现在nfTower仪表板中,它相当于Nextflow-PARAMS-FILE选项。在这里,我想将输入文件作为一个参数INPUT_LIST传递,以克服字符限制。

@Steve would you able to give any comment? thanks

@史蒂夫,你能发表什么评论吗?谢谢

The YML format looks completely different from the YAML format. The officially recommended extension for files containing YAML documents has been .yaml since at least September 2006. Please catch up.

YML格式看起来与YAML格式完全不同。至少从2006年9月起,官方推荐的包含YAML文档的文件的扩展名就是.yaml。请跟上。

sure, updated the extension

当然,更新了扩展

优秀答案推荐

The follwoing code works

以下代码起作用


import groovy.yaml.YamlSlurper

params.inputs_list = "inputs.yaml"

workflow {
inputs = new YamlSlurper().parse(file(params.inputs_list))

Channel
.fromList(inputs['samples'])
.ifEmpty { ['biosample_id': params.biosample_id, 'aln': params.aln] }
.set { samples }

更多回答

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com