根据背景将突变轨迹聚类到基因型和基因型的一组脚本
muller的Python项目详细描述
一组脚本,用于将突变轨迹聚类到基因型,并根据背景对基因型进行聚类
内容
- 一组脚本,用于将突变轨迹聚类到基因型并按背景聚类基因型
- 内容
- 安装
- 需求
- 示例用法
- 常规工作流
- 脚本选项
- 输入数据集
- 输出
- 表格
- 时间序列表
- ggmuller的表格
- 链接矩阵
- 距离矩阵
- muller table
- 图形
- muller plots
- 谱系图
- TimeSeries绘图
- 距离热图
- 树状图
- 脚本
- 补充文件
- 表格
安装
这些脚本可在pypi上找到,并可使用
安装pip install muller
要将脚本更新到最新版本,只需运行
pip install muller --upgrade
然后使用
lineage [args]
也可以简单地克隆该软件包,但随后需要单独安装附加的必需软件包。
git clone https://github.com/cdeitrick/muller_diagrams.git
cd muller_diagrams
lineage [args]
要求
这些脚本需要几个python包才能工作。可以使用pip install[package]
或conda install[package]
安装每个程序
- 数据类(如果使用低于3.7的python版本)
- 洛古鲁
- matplotlib
- 熊猫
- Pygraphviz
- scipy
- 肖伯恩
- xlrd(读取excel文件)
如果包pygraphviz
在安装期间抛出错误,通常是因为它在当前环境中找不到正确的依赖项。
使用
Linux:
sudo apt-get install python-dev graphviz libgraphviz-dev pkg-configM: < /P>
brew install graphviz
或系统上的等效包管理器。
可选套餐
tqdm
:如果同时安装了tqdm
,脚本将为大型数据集显示一个progressbar。美化组4
:有时csv文件的编码不明确(脚本抛出unicodedecodeerror)。如果美化组4
已安装,脚本将尝试更正编码错误。
示例用法
脚本当前默认使用二项式距离进行分层聚类。"说明"文件夹中提供了更多信息。 使用python调用"muller"文件夹:
Muller.py --input [input filename] --output [output folder]
使用默认参数运行。
Muller.py --input [filename] --frequencies 0.05 --detected 0.10
0.05组的基因型(即[0.00,0.05,0.10,…,0.90,0.95,1.00]
)基于每个基因型的最大频率。然后,每组中的每个基因型按照第一次检测到的时间点(频率大于0.10的第一个时间点)进行排序。输出文件与输入表保存在同一文件夹中。
一般工作流程
每个单独步骤的流程图可以在"文档/流程图"下找到。
脚本选项
一般选项
-h, --help
Show a help message and exit
--name
Prefix to use when naming the output files. defaults to the dataset filename.
-i, --input
The table of trajectories to cluster. Must be an excel file or csv/tsv file.
The delimiter will be inferred from the file extension.
-o, --output
The output folder to save the files to.
--threads [2]
The number of processes to use. This is only relevant for very large datasets.
-d, --detection
The uncertainty to apply when performing
frequency-based calculations. For
example, a frequency at a given timepoint
is considered undetected if it falls
below 0 + `detection`.
--fixed
The minimum frequency at which to
consider a mutation fixed. Defaults to
1 - `uncertainty`
-s, --significant
[0.15] The frequency at which to consider a genotype
significantly greater than zero.
-f, --frequencies
[0.10] The frequency cutoff or step to use when sorting genotypes.
May be a comma-separated string of frequencies, or a set inverval
to use when generating the frequency breakpoints. This affects
the filtering step and the nesting step.
For example, a value of 0.15 will use the frequencies 0,.15,.30,.45...
--genotypes Indicates that the input table contains genotypes rather
than mutational trajectories. This will skip the filtering and clustering steps.
--sheetname
Specifies the sheet to use when the input is an excel file. Defaults to
the first sheet in the spreadsheet.
--gene-alias ALIAS_FILENAME
An optional two-column file with more accurate gene
names. This is useful when using a reference
annotated via prokka.
过滤选项
pip install muller0
群集选项
pip install muller1
嵌套选项
pip install muller2
图形选项
pip install muller3
输入数据集
该脚本在一个表上操作,该表列出了每个时间点上的所有突变及其对应频率(在该脚本中称为"轨迹"),或一个表中列出了每个时间点上的每个基因型和频率(例如examples文件夹中的基因型表)。
该表必须有一个名为tracky
的列,其中包含每个变异轨迹的标签(或在使用--general
时的general
)和每个时间点的整数列。标签仅用于识别属于特定基因型的轨迹,并且必须是整数。在计算基因型和基因型簇时,所有其他列都将被忽略。
频率可以表示为0-1之间的数字,
介于0-100之间或以百分比表示的数字。
轨迹
和基因型
列可以包含任何类型的标签,但对于每个轨迹/基因型必须是唯一的。
输出
如果未填充--name
参数,则所有文件都以原始输入表的名称作为前缀。
表格
TimeSeries表
- .muller u基因型.tsv
- .muller.trajectories.tsv
- tables/.muller-u基因型.original.tsv
- tables/.trajectories.original.tsv
列出分析中遇到的基因型和轨迹的表格。轨迹表还将每个轨迹与其各自的基因型相关联。这些表格有两个版本:一个是原始输入轨迹和初始计算基因型的集合,另一个是过滤步骤后分析中留下的最终轨迹和基因型的集合。轨迹表包括输入轨迹表中的所有列以及分析中使用的时间序列和注释列。
基因型表示例:
<表><广告>ggmuller的表格
- tables/.ggmuller.populations.tsv
- tables/.ggmuller.edges.tsv
这些表是为与ggmuller r包一起使用而设计的。种群
表描述了每个时间点每个基因型的种群/丰度,边
表描述了基因型之间的祖先关系。
链接矩阵
- tables/.linkagematrix.tsv
此表是使用scipypython包生成的。它从单个轨迹开始描述集群的聚集,以及每个集群的平均值、方差和轨迹计数。 栏目:
左
,右
:两个子群集合并以创建当前群集cluster id
:分配给此群集的ID。请注意,由于表中不包括各个基因型,因此按1+基因型总数的顺序对聚类进行编号。距离
:两个子簇之间的距离。观测值
:该簇中包含的变异轨迹数。
链接矩阵示例:
<表><广告>距离矩阵
- tables/.distance.tsv
每条轨迹之间的成对距离值表。
米勒表
- tables/.muller.tsv
用于生成muller图的.ggmuller.populations.tsv
和.ggmuller.edges.tsv
的转换形式。此文件是从r脚本创建的,如所述后来,
图形
每个输出图对基因型和轨迹使用相同的调色板。染成蓝色的基因型将在描述该基因型的所有图形和图表中共享该颜色。有两个调色板:一个用于在遗传学中指示每个分支,另一个用于容易区分不同基因型。每个图形都是用两个调色板创建的,有些以多种格式提供,以方便使用。
穆勒图
- .muller.annotated.png
- graphics/clade/.muller.annotated.svg
- graphics/clade/.muller.annotated.png
- graphics/clade/.muller.unnotated.png
- graphics/district/.muller.annotated.district.png
- graphics/district/.muller.annotated.district.svg
muller图的主要价值是在进化实验过程中快速可视化基因型的丰富度和遗传学。
/p>
沿袭图
- 沿袭.png
- graphics/.lineage.distributive.png
这些简单的流程图显示了基因型和分支之间的关系。每个分支的原始基因型都出现在根背景"基因型-0"中。然后显示所有其他基因型的祖先与这些分支的关系。
时间序列图
- 基因型.png
- 。基因型。筛选。png
- 轨迹.distributive.png
时间序列图显示每个轨迹和基因型在每个时间点的频率。轨迹是根据它们所属的基因型来着色的。.genypenes.filtered.png文件包含在过滤步骤中过滤掉的轨迹(clored black)。
距离热图
- graphics/.heatmap.distance.png
两个变异轨迹之间计算距离的成对比较。轨迹按最终基因型分组。如果分析中的总轨迹少于30条,则将用距离值对热图进行注释。
树状图
- graphics/.dendrogram.png图
显示簇和成员轨迹之间的排列和距离。不适用于
--method twostep
脚本
- 脚本/示例.r
在分析过程中使用了一个外部脚本。r脚本基于r中实现的ggmuller包,用于将基因型数据转换为生成muller图所需的格式。这个脚本还生成一个基本的muller图(/graphics/district/.muller.png),尽管所有其他muller图都是用python实现创建的。
补充文件
- 补品y-files/.json
一个json格式的文件,包含分析中使用的所有参数。
- 补充文件/.nestscores.tsv
列出每个基因型和对应的候选祖先基因型之间的得分。高于或等于1的最高分数决定了父基因型。