@bighatbio/stat.seqs

中文文档
0.1.22发布于 2021/10/18CommonJS近 30 天下载 1.9万

A module to analyze multiple seqs (information content, frequency, ...)

原始使用文档
文档目录12 节
  1. Getting Started
  2. Operations
  3. Frequency
  4. Sequence identity and consensus
  5. Background distribution
  6. Information content (entropy) and conservation
  7. Conservation with a background distribution
  8. Trivial analysis
  9. Operate with the sequences
  10. Contributing
  11. Support
  12. License

stat.seqs

NPM version Build Status

A module to analyze multiple seqs (information content, frequency, ...)

Getting Started

Install the module with: npm install stat.seqs

var MSAStats = require('stat.seqs');
var seqs = ["AACG", "CACG", "AAGC", "CAAG"];
var stats = MSAStats(seqs);

All operations are cached, but they will be calculated again if you change the sequences.

Operations

Frequency

stats.frequency() // calculates the relative frequency of a base at a given position
> [ { A: 0.5, C: 0.5 },
  { A: 1 },
  { C: 0.5, G: 0.25, A: 0.25 },
  { C: 0.25, G: 0.75 } ]

Sequence identity and consensus

stats.consensus() // calculates the consensus
> "AACG"

stats.identity() // identity to the consensus seq
> [ 1, 0.75, 0.5, 0.5 ]

stats.identity("AAAA") // identity to the given seq
> [ 0.5, 0.25, 0.5, 0.5 ]

Background distribution

stats.background() // calculates the background distribution of all seqs
> { A: 0.4375, C: 0.3125, G: 0.25 }

stats.bg = {A: 0.25, C: 0.25, G: 0.25, T: 0.25} // set your own background distribution

stats.useBackground(); // use background distribution in anlysis

Information content (entropy) and conservation

stats.ic() // calculates the information content
> [ 1, 0, 1.5, 0.81 ]

// change your alphabet
stats.setDNA(); // default
stats.setProtein();
stats.alphabetSize = 21; // your own size

// now you can scale the information content 
stats.scale(stats.ic());
> [ 0.5, 0, 0.75, 0.41 ]

stats.conservation() // needs an alphabetSize!
> [ 1, 2, 0.5, 1.19 ]
stats.scale(stats.conservation()) // scale conservation 
> [ 0.5, 1, 0.25, 0.59 ]

stats.conservResidue() // calculate conservation per residue
> [ { A: 0.5, C: 0.5 },
  { A: 2 },
  { C: 0.25, G: 0.13, A: 0.13 },
  { G: 0.89, C: 0.3 } ]

stats.conservResidue({scaled: true}) 
> [ { A: 0.25, C: 0.25 },
  { A: 1 },
  { C: 0.13, G: 0.06, A: 0.06 },
  { G: 0.45, C: 0.15 } ]

Scale and conservation require a set alphabetSize (default 4);

Conservation with a background distribution

(work in progress)

stats.useBackground(); // by default from all letters

stats.ic() // calculates the information content
stats.scale(stats.ic());

stats.conservation(

stats.scale(stats.conservation())

stats.conservResidue() 

stats.conservResidue({scaled: true}) 

Trivial analysis

stats.maxLength() 
> 4
stats.gaps() // relative percentage of gaps for a column
> [0, 0, 0, 0]

Operate with the sequences

stats.addSeq("AAA")
stats.addSeqs(["AAA", "AAB"])
stats.resetSeqs(["AAA", "AAB"])
stats.removeSeq("AAA")
stats.removeSeq(2) // you can also use indexes

Contributing

Please submit all issues and pull requests to the greenify/stat.seqs repository!

Support

If you have any problem or suggestion please open an issue here.

License

The MIT License

Copyright (c) 2014, greenify

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

版本与发布记录

@bighatbio/stat.seqs 共发布 2 个版本,首次发布于 2021/10/18;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.22latest2021/10/185 年前
0.1.212021/10/185 年前

关于 @bighatbio/stat.seqs 的常见问题

@bighatbio/stat.seqs 是什么?

A module to analyze multiple seqs (information content, frequency, ...)

如何安装 @bighatbio/stat.seqs?

在项目目录运行 npm install @bighatbio/stat.seqs,或使用 pnpm add / yarn add / bun add。

@bighatbio/stat.seqs 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bighatbio__stat.seqs 是否存在。

@bighatbio/stat.seqs 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bighatbio/stat.seqs 可以商用吗?

@bighatbio/stat.seqs 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@bighatbio/stat.seqs 的下载量有多少?

根据 npm 官方下载统计,@bighatbio/stat.seqs 在 2026/10/08 – 2026/11/06 这 30 天内被下载 19,051 次,日均约 635 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bighatbio/stat.seqs 还在维护吗?

最新版本 0.1.22 发布于 2021/10/18(5 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/10/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。