5 个不稳定版本
0.3.5 | 2024 年 3 月 14 日 |
---|---|
0.2.3 | 2024 年 2 月 9 日 |
0.2.2 | 2024 年 2 月 9 日 |
0.1.1 | 2024 年 2 月 8 日 |
0.1.0 | 2024 年 2 月 8 日 |
在 生物学 中排名第 86
每月下载量 237 次
52KB
890 行
RecMap 库(及命令行工具)用于在 Rust 中读取和处理重组图
可以从 HapMap 格式的重组图读取创建一个 RecMap
对象。注意,由于 HapMap 重组格式不包含染色体长度,因此还必须指定它。提供了一个便利函数 read_seqlens
来读取 TSV 格式的“基因组”文件,其中包含染色体名称和长度。
以下是一个示例,它从 HapMap 格式的重组图中加载一个重组图并计算总图长度。
use recmap::prelude::*;
let seqlens = read_seqlens("hg38_seqlens.tsv")
.expect("could not read seqlens");
let rec_map = RecMap::from_hapmap("decode_2019_map.txt", seqlens)
.expect("cannot read hapmap");
for (name, rate_map) in rec_map.iter() {
println!("{}\t{}", name, rate_map.total_map_length().unwrap());
}
此示例可以通过命令行运行
cargo run --example calc_map_lengths -- --seqlens hg38_seqlens.tsv decode_2019_map.txt
当处理重组图时,最常见的任务之一是估计任意标记的图位置,这通常通过线性插值完成。《RecMap》提供了一种简单的方法来对一个位置(RecMap.interpolate_map_position()
)以及多个位置进行插值,使用 RecMap.interpolate_map_positions()
use recmap::prelude::*;
let seqlens = read_seqlens("hg38_seqlens.tsv")
.expect("could not read seqlens");
let rec_map = RecMap::from_hapmap("decode_2019_map.txt", seqlens)
.expect("cannot read hapmap");
let positions = vec![11975064, 15007450];
rec_map.interpolate_map_positions("chr1", &positions);
命令行工具
此外,《recmap》还提供了一个可选的命令行工具功能,可以根据 BED3 输入插值重组图位置和重组率
$ recmap interp --seqlens hg38_seqlens.tsv --hapmap decode_2019_map.txt \
hg38_1Mb_windows.bed --output decode_2019_map_1Mb_summaries.tsv --header
目前命令行工具只有一个子命令,尽管可能还会添加更多功能。如果您有想要的功能,请提交问题!
安装
要在自己的 Rust 项目中使用库,请使用以下命令安装
$ cargo add recmap
要安装命令行工具,请使用
$ cargo install recmap --features=cli
依赖项
~4–5MB
~83K SLoC