I have tried multple solutons in the platform but none seems to work. I can't seem to wrap my around the error AttributeError: 'Wildcards' object has no attribute 'sample'
Here is what I am trying to do:
import pandas as pd
sample_csv = os.path.join(BASE_DIR, "samples.csv")
sample_table = pd.read_csv(sample_csv).set_index('sample', drop=False)
def get_fq1(wildcards):
return sample_table.loc[wildcards.sample, 'fastq1']
def get_fq2(wildcards):
return sample_table.loc[wildcards.sample, 'fastq2']
def get_fq_files_dict(wildcards):
return {
"r1" : sample_table.loc[wildcards.sample, 'fastq1'],
"r2" : sample_table.loc[wildcards.sample, 'fastq2'],
}
rule fastp:
input:
unpack(get_fq_files_dict)
output:
expand(base_dir + "/trimmed/{sample}_trimmed.{r}.fastq.gz", sample=SAMPLES_f, # This is refined elsewhere, r=['_1','_2'])
shell:
"""
echo {input} # This is just a decoy command
"""
This code throws me the error
AttributeError: 'Wildcards' object has no attribute 'sample'
Does anybody have an idea what is not right?