在Snakemake中使用cutadapt适配器文件输入



我是Snakemake的新手,正在尝试移植我的BASH代码以使用Snakemak规则。免责声明,顺便说一句,我正试图在shell块中使用cutadapt来多路分解fastq文件,使用带有标头和适配器序列的fasta文件。与fasta标头匹配的样本名加载在rule-all:中并指定为通配符

rule all:
input:
expand([os.path.join(outDir, "reads_trim.fq"),
os.path.join(outDir, "{name}.tmp")], name=samples_list)

reads_trim文件是一个标准的串联fastq文件(来自Nanopore测序(。我的问题是这个规则运行了12次,因为我的"样本"中有12个样本;samples_list";。然后,我得到了12个具有正确命名的输出文件,但它们都包含完全相同的内容。我想知道如果只运行一次输出是否正确,但还没有找到强制这种行为的方法。

rule demultiplex:
""" Demultiplex Nextera-styled barcodes using the compiled barcode fasta file """
input:
barcodeFile=os.path.join(outDir, "barcodes_used.fasta"),
fastqFile=os.path.join(outDir, "reads_trim.fq")
output: os.path.join(outDir, "{name}.tmp")
message: "Demultiplexing trimmed reads"
log: "logs/cutadapt/demultiplexing_{name}.log"
shell:
"""
cutadapt -e 0.20 -O 10 -m 15 -M 15 -g file:{input.barcodeFile} -o {output} {input.fastqFile}
"""

知道如何获得一个文件进入、x个文件输出不同(适配器所在地(的标准行为吗?

我不熟悉用于多路分解的cutadapt,但从docs,我我认为你想要这样的东西(我简化了你的原始代码(:

rule all:
input:
expand("{name}.tmp", name= samples_list),
rule demultiplex:
input:
barcodeFile= "barcodes_used.fasta",
fastqFile= "reads_trim.fq"
output: 
expand("{name}.tmp", name=samples_list),
shell:
r"""
cutadapt ... -g file:{input.barcodeFile} -o {{name}}.tmp {input.fastqFile}
"""

如果输入reads_trim.fq在一个镜头中产生所有12个输出文件,那么您需要列出output指令中的所有12个输出。我用了CCD_ 3函数。注意,{{name}}.tmp有双花括号告诉snakemake它不是通配符,但它的读取方式与{name}(根据cutadapt文档,如果我没看错的话(。

顺便问一下,你确定cutadapt可以解复用Nanopore吗?

最新更新