8个版本 (5个破坏性更新)
0.8.0 | 2024年6月28日 |
---|---|
0.7.3 | 2024年6月17日 |
0.6.0 | 2023年12月13日 |
0.5.1 | 2023年8月31日 |
0.3.0 | 2023年6月25日 |
#242 in 生物学
每月533次下载
在 lightmotif-py 中使用
1.5MB
4.5K SLoC
🎼🧬 lightmotif-tfmpvalue

是TFMPvalue算法的Rust语言移植,用于lightmotif
crate。.
🗺️ 概览
TFMPvalue是Touzet & Varré[1]提出的一种算法,用于从位置权重矩阵得到的分数计算p-value。它使用离散化来计算位置权重矩阵的分数分布的近似值,通过递增精度级别迭代直到收敛。这种方法优于Beckstette et al.[2]提出的基于动态规划的LazyDistrib等方法。
lightmotif-tfmpvalue
为使用来自lightmotif
crate的位置权重矩阵提供了对TFMPvalue算法的实现。
💡 示例
使用lightmotif
创建位置特定评分矩阵,然后使用TFMPvalue算法计算给定分数的确切p-value,或者给定p-value的分数阈值。
extern crate lightmotif;
extern crate lightmotif_tfmpvalue;
use lightmotif::pwm::CountMatrix;
use lightmotif::abc::Dna;
use lightmotif::seq::EncodedSequence;
use lightmotif_tfmpvalue::TfmPvalue;
// Use a ScoringMatrix from `lightmotif`
let pssm = CountMatrix::<Dna>::from_sequences(&[
EncodedSequence::encode("GTTGACCTTATCAAC").unwrap(),
EncodedSequence::encode("GTTGATCCAGTCAAC").unwrap(),
])
.unwrap()
.to_freq(0.25)
.to_scoring(None);
// Initialize the TFMPvalue algorithm for the given PSSM
// (the `pssm` reference must outlive `tfmp`).
let mut tfmp = TfmPvalue::new(&pssm);
// Compute the exact p-value for a given score
let pvalue = tfmp.pvalue(19.3);
assert_eq!(pvalue, 1.4901161193847656e-08);
// Compute the exact score for a given p-value
let score = tfmp.score(pvalue);
assert_eq!(score, 19.3);
请注意,在上面的示例中,计算没有界限,因此对于某些特定的矩阵,算法可能需要大量内存才能收敛。使用TfmPvalue::approximate_pvalue
和TfmPvalue::approximate_score
方法获取算法迭代的迭代器,允许您根据外部标准(如总内存使用)在任何给定时间停止。
💭 反馈
⚠️ 问题跟踪器
发现了一个错误?有改进请求吗?如果您需要报告或询问,请访问 GitHub问题跟踪器。如果您正在提交错误报告,请尽可能提供关于问题的详细信息,并尝试在简单且易于复现的情况下重现相同的错误。
📋 更新日志
本项目遵循 语义化版本控制,并按照 Keep a Changelog 格式提供 更新日志。
⚖️ 许可证
此库在开源 GNU通用公共许可证v3.0 下提供。原始TFMPvalue实现由 CRISTaL团队 编写,该团队属于 CRISTaL 和 里尔大学,并按照 GNU通用公共许可证v2.0 的条款提供。
本项目与原始TFMPvalue作者没有任何关联、赞助或任何形式的认可。它由 Martin Larralde 在欧洲分子生物学实验室(EMBL)的泽勒团队(Zeller team)的博士项目中开发。
📚 参考文献
- Touzet, Hélène and Jean-Stéphane Varré. ‘Efficient and accurate P-value computation for Position Weight Matrices’. Algorithms for Molecular Biology 2, 1–12 (2007). doi:10.1186/1748-7188-2-15.
- Beckstette, Michael, Robert Homann, and Robert Giegerich. ‘Fast index based algorithms and software for matching position specific scoring matrices’. BMC Bioinformatics 7, 389 (2006). doi:10.1186/1471-2105-7-389.