问题
I have several genome files, all with suffix .1.ht2l to .8.ht2l
bob.1.ht2l
bob.2.ht2l
bob.3.ht2l
bob.4.ht2l
bob.5.ht2l
bob.6.ht2l
bob.7.ht2l
bob.8.ht2l
steve.1.ht2l ....steve.8.ht2l and so on
and sereval RNAseq samples, like
flower_kevin_1.fastq.gz
flower_kevin_2.fastq.gz
flower_daniel_1.fastq.gz
flower_daniel_2.fastq.gz and so on also with different tissues.
I would like to align all rnaseq reds against the genomes. UPDATED:
workdir: "/path/to/aligned"
(HISAT2_INDEX_PREFIX,)=glob_wildcards("/path/to/index/{prefix}.1.ht2l")
(SAMPLES,)=glob_wildcards("/path/to/{sample}_1.fastq.gz")
print(HISAT2_INDEX_PREFIX)
print (SAMPLES)
rule all:
input:
expand("{prefix}.{sample}.bam", zip, prefix=HISAT2_INDEX_PREFIX, sample=SAMPLES)
rule hisat2:
input:
hisat2_index=expand("%s.{ix}.ht2l" % "/path/to/index/{prefix}", ix=range(1, 9)),
fastq1="/path/to/{sample}_1.fastq.gz",
fastq2="/path/to/{sample}_2.fastq.gz"
output:
bam = "{prefix}.{sample}.bam",
txt = "{prefix}.{sample}.txt",
log: "{prefix}.{sample}.snakemake_log.txt"
threads: 5
shell:
"/Tools/hisat2-2.1.0/hisat2 -p {threads} -x {HISAT2_INDEX_PREFIX}"
" -1 {input.fastq1} -2 {input.fastq2} --summary-file {output.txt} |"
"/Tools/samtools-1.9/samtools sort -@ {threads} -o {output.bam}"
I get missing input files error, I am sure the error is somewhere with suffixes, however,I do not know how to solve and any suggestion is much appreciated. UPDATE: ALL genome files bob.1.ht2l..bob.8.ht2l, steve.1.ht2l..steve.8.ht2l get invoked all at once, why is that?
回答1:
Let's compare these 2 lines:
(HISAT2_INDEX_PREFIX,)=glob_wildcards("/path/to/index/{prefix}.1.ht2l")
hisat2_index=expand("%s.{ix}.ht2l" % HISAT2_INDEX_PREFIX, ix=range(1, 9)),
The first line explicitly specifies the /path/to/index/
, the second misses this path. Be consistent, that should fix your problem.
来源:https://stackoverflow.com/questions/59460188/snakemake-hisat2-alignment-of-many-rnaseq-reads-against-many-genomes