Snakemake 输入函数异常。 AttributeError:“通配符”对象没有属性

2024-03-25

我有一个带有 ChIP-seq 单端 fastq 文件名的列表对象allfiles=['/path/file1.fastq','/path/file2.fastq','/path/file3.fastq']。我正在尝试设置该对象,allfiles,作为通配符(我想要 fastqc 规则的输入(以及其他规则,例如映射,但让我们保持简单)。我尝试了下面代码中看到的内容(lambda wildcards: data.loc[(wildcards.sample),'read1'])。然而,这给了我错误

"InputFunctionException in line 118 of Snakefile:
AttributeError: 'Wildcards' object has no attribute 'sample'
Wildcards:
" 

有人确切知道如何定义它吗?看来我已经很接近了,我明白了总体思路,但我无法正确获取语法并执行它。谢谢 !

Code:

import pandas as pd
import numpy as np

# Read in config file parameters
configfile: 'config.yaml'
sampleFile = config['samples'] # three columns: sample ID , /path/to/chipseq_file_SE.fastq , /path/to/chipseq_input.fastq
outputDir = config['outputdir'] # output directory

outDir = outputDir + "/MyExperiment"
qcDir = outDir + "/QC"

# Read in the samples table
data = pd.read_csv(sampleFile, header=0, names=['sample', 'read1', 'inputs']).set_index('sample', drop=False)
samples = data['sample'].unique().tolist() # sample IDs
read1 = data['read1'].unique().tolist() # ChIP-treatment file single-end file
inplist= data['inputs'].unique().tolist() # the ChIP-input files
inplistUni= data['inputs'].unique().tolist() # the ChIP-input files (unique)
allfiles = read1 + inplistUni

# Target rule
rule all:
    input:
        expand(f'{qcDir}' + '/raw/{sample}_fastqc.html', sample=samples),
        expand(f'{qcDir}' + '/raw/{sample}_fastqc.zip', sample=samples),

# fastqc report generation
rule fastqc:
    input: lambda wildcards: data.loc[(wildcards.sample), 'read1']
    output:
        html=expand(f'{qcDir}' + '/raw/{sample}_fastqc.html',sample=samples) ,
        zip=expand(f'{qcDir}' + '/raw/{sample}_fastqc.zip',sample=samples)
    log: expand(f'{logDir}' + '/qc/{sample}_fastqc_raw.log',sample=samples)
    threads: 4
    wrapper: "fastqc {input} 2>> {log}"

现在output文件的rule fastqc一旦解决,就没有任何通配符。也就是说,目前蛇文件中有一项工作,其中rule fastqc尝试为所有样本生成一个输出文件。

但是,您似乎想运行rule fastqc每个样本单独进行。在这种情况下,需要概括如下,其中{sample}是通配符:

rule fastqc:
    input: lambda wildcards: data.loc[(wildcards.sample), 'read1']
    output:
        html = qcDir + '/raw/{sample}_fastqc.html,
        zip=qcDir + '/raw/{sample}_fastqc.zip'
    log: logDir + '/qc/{sample}_fastqc_raw.log'
    threads: 4
    shell: "fastqc {input} 2>> {log}"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Snakemake 输入函数异常。 AttributeError:“通配符”对象没有属性 的相关文章

  • SQL更新替换语句

    我需要使用 REPLACE 编写一条 sql 更新语句 该字符串看起来像 SE 88 000000001 我需要替换两个星号 之间的数字 除了要替换的数字始终位于两个星号之间之外 这里没有其他模式 在这种情况下可以使用通配符吗 感谢你的帮助
  • 使用通配符选择以 XXX 开头的所有列?

    I have several columns in my databases with similar names How do I select those based on the word they start with Here s
  • Snakemake 通配符:使用目录输出中的通配符文件

    我是 Snakemake 的新手 并尝试在规则中使用特定文件 来自directory 克隆 git 存储库的另一个规则的输出 目前 这给了我一个错误Wildcards in input files cannot be determined
  • 使用通配符进行模式匹配

    如何使用通配符识别字符串 我找到了glob2rx 但我不太明白如何使用它 我尝试使用以下代码来选择数据框中以单词开头的行blue make data frame a lt data frame x c red blue1 blue2 red
  • 如何在 SQLAlchemy 中使用通配符? [复制]

    这个问题在这里已经有答案了 我正在尝试使用 SQLAlchemy 对查询使用通配符 但我得到一个空列表 My code engine create engine os getenv DATABASE URL db scoped sessio
  • LINQ to SQL 通配符

    如何在 LINQ To SQL lambda 表达式中构建通配符 这就是我目前所拥有的 var query from log in context Logs select log foreach string filter in Custo
  • CSS 中类的通配符 *

    我有这些我正在设计的 div tocolor 但我还需要唯一标识符 1 2 3 4 等 因此我将其添加为另一个类tocolor 1 div class tocolor tocolor 1 tocolor 1 div div class to
  • Snakemake 中“未给出通配符错误值”

    我正在尝试使用 Snakemake 制作一个简单的管道 从网络上下载两个文件 然后将它们合并到一个输出中 我认为可行的是以下代码 dwn lnks 1 https molb7621 github io workshop downloads
  • 与 shell 通配符和正则表达式的混淆

    发起人为reply https stackoverflow com questions 1320721 postgres regex and nested queries something like unix pipes 1322144
  • 如何快速识别 Snakemake 中的规则是否需要输入函数

    我正在关注其文档页面上的 Snakemake 教程 并且确实陷入了输入函数的概念https snakemake readthedocs io en stable tutorial advanced html step 3 input fun
  • 错误的snakemake glob_wilcards 和 wildcard_constraints

    在我的 Snakemake 管道中 我试图检索正确的通配符 我研究过 wildcard constraints 和这个帖子 https stackoverflow com questions 66882849 snakemake how t
  • 之间的区别。 git 中的 (点) 和 * (星号) 通配符

    我有一个本地存储库 并试图放弃自上次提交以来的所有更改 git checkout HEAD 命令 一切工作正常 即使更改是在某个子目录中 但是当我添加一些未跟踪的文件 满足中的掩码 gitignore 对存储库的根目录说 Ignored t
  • 如何将通配符参数传递给 bash 文件

    我正在尝试编写一个 bash 脚本 允许用户使用通配符传递目录路径 例如 bash show files sh 当在此目录中执行时 drw r r 2 root root 4 0K Sep 18 11 33 dir a rw r r 1 r
  • 默认内存请求是否可以在 Snakefile 中覆盖?

    我有一个包含多个规则的 Snakefile 只有少数规则需要超过 1 GB 核心才能在集群上运行 这resources指令对此非常有用 但我找不到设置默认值的方法 我宁愿不用写resources mem per cpu 1024对于每条不需
  • SQL Server 通配符[关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions Does Select from t
  • 字符串是否匹配 glob 模式

    我有一系列路径 比方说 Users alansouza workspace project src js components chart Graph js 另外 我在配置文件中有一个条目 其中包含通配符 glob 格式的该路径的附加属性
  • 如何在 Sitecore 中使用带有通配符项的内部链接?

    我有一个多站点 Sitecore 解决方案 所有站点共享一个产品范围 该产品范围存储在与站点根节点处于同一级别的 共享数据 节点内 站点上的各个产品页面使用通配符项来根据 URL 的最后部分查找产品 这意味着我们无法使用富文本编辑器中的内部
  • 在 jQuery 中使用通配符 ID 并获取通配符 ID

    我有4个ID hideshow1 hideshow2 hideshow3 hideshow4 现在 当单击这些 ID 的按钮时 我想最后使用这些整数执行单独的操作 到目前为止我有这个 document ready function id h
  • 在snakemake规则中使用pyenv

    我正在使用 Snakemake 来实现一个漫长而复杂的管道 其中涉及一些外部编写的 python2 脚本 当我尝试使用 pyenv 指定 python2 时 pyenv shell命令失败 同时pyenv global and pyenv
  • C# 泛型中的通配符等效项

    假设我有一个通用类 如下所示 public class GeneralPropertyMap

随机推荐