Я работаю над проблемой змеиной магии, которую не могу решить. Дан файл образцов, таких как:
tissue type replicate file
ear rep1 H3K4me3 00.data/chip_seq/H3K4me3/ear_H3K4me3_rep1.fastq
ear rep2 H3K4me3 00.data/chip_seq/H3K4me3/ear_H3K4me3_rep2.fastq
ear rep1 input 00.data/chip_seq/input/ear_input_rep1.fastq
ear rep2 input 00.data/chip_seq/input/ear_input_rep2.fastq
leaf rep1 H3K4me3 00.data/chip_seq/H3K4me3/ear_H3K4me3_rep1.fastq
leaf rep2 H3K4me3 00.data/chip_seq/H3K4me3/ear_H3K4me3_rep2.fastq
leaf rep1 input 00.data/chip_seq/input/ear_input_rep1.fastq
leaf rep2 input 00.data/chip_seq/input/ear_input_rep2.fastq
root rep1 input 00.data/chip_seq/input/ear_input_rep1.fastq
root rep2 input 00.data/chip_seq/input/ear_input_rep2.fastq
Функция snakemake, которую я использую для ввода этого списка файлов - здесь она называется get_chip_mods
, генерирует комбинации подстановочных знаков, которые на самом деле не существуют. Таким образом, в этом случае get_chip_mods
генерирует такие комбинации, как root_rep1_H3K4me3
, хотя указанный файл не указан в примерах. Есть ли способ запретить этой функции генерировать комбинации, которых нет в файле примеров?
Ниже начало моего конвейера.
#Load Samples from the CSV file - index the important ones
samples = pd.read_csv(config["samples"], sep=' ').set_index(["tissue", "type", "replicate"], drop=False)
samples.index = samples.index.set_levels([i.astype(str) for i in samples.index.levels]) # enforce str in index
rule all:
input:
¦ "00.data/reference/bowtie_idx.1.bt2",
¦ expand("00.data/trimmed_chip/{tissue}_{chip}_{replicate}_trimmed.fq" , tissue = samples["tissue"],
chip = samples["type"], replicate = samples["replicate"]),
#This is where I believe I've been hitting issues.
def get_chip_mods(wildcards):
final_list = samples.loc[(wildcards.tissue, wildcards.type, wildcards.replicate), ["file"]].dropna()
print(final_list)
return final_list
rule trim_reads:
input:
¦ get_chip_mods
params:
¦ "00.data/trimmed_chip/log_files/{tissue}_{type}_{replicate}.log"
output:
¦ "00.data/trimmed_chip/{tissue}_{type}_{replicate}_trimmed.fq"
threads: 5
message:"""Trimming"""
shell:
¦ """
¦ java -jar /usr/local/apps/eb/Trimmomatic/0.36-Java-1.8.0_144/trimmomatic-0.36.jar \
¦ SE -threads {threads} -phred33 {input} {output} \
¦ ILLUMINACLIP:/scratch/jpm73279/04.lncRNA/02.Analysis/23.generate_all_metaplots/00.data/adapter.fa:2:30:10 \
¦ LEADING:3 TRAILING:3 SLIDINGWINDOW:4:15 MINLEN:36
¦ """
Я получаю следующую ошибку
KeyError:
Wildcards:
tissue=root
type=H3K4me3
replicate=rep1