我的{dir}是一个变量= / nameX / tissueX / trimmed 这是我使用的代码:
HISAT2_INDEX_PREFIX = "/index/genome_chromosomes"
directories, SAMPLES=glob_wildcards('/test/{dir}/{sample}_1.fastq.gz')
rule all:
input:
expand("{dir}/{sample}.bam", zip, dir=directories, sample=SAMPLES)
rule hisat2:
input:
hisat2_index=expand("%s.{ix}.ht2l" % HISAT2_INDEX_PREFIX, ix=range(1, 9)),
fastq1="/test/{dir}/{sample}_1.fastq.gz",
fastq2="/test/{dir}/{sample}_1.fastq.gz"
output:
bam = "{dir}/{sample}.bam",
txt = "{dir}/{sample}.txt",
log: "{dir}/{sample}.snakemake_log.txt"
threads: 2
shell:
"hisat2 -p {threads} -x {HISAT2_INDEX_PREFIX}"
" -1 {input.fastq1} -2 {input.fastq2} --summary-file {output.txt} |"
"samtools sort -@ {threads} -o {output.bam}"
如何修改在每个bam文件中添加nameX前缀并将所有bam文件保存在同一目录中的方式?并为相同的nameX创建一个bam文件?