生物表型:分析表型数据

本章概述了 Bio.phenotype package included in Biopython. The scope of this package is the analysis of phenotypic data, which means parsing and analyzing growth measurements of cell cultures. In its current state the package is focused on the analysis of high-throughput phenotypic experiments produced by the Phenotype Microarray technology ,但未来的发展可能会包括其他平台和形式。

表型微阵列

Phenotype Microarray 是一项测量细菌和真核细胞在大约2000种化学物质上代谢的技术,这些化学物质分为20个96孔板。该技术测量四氮唑染料的DPD还原,细胞产生的DPD被用作细胞代谢的替代物;由于该染料还原而产生的显色通常每15分钟测量一次。当细胞在维持细胞代谢的培养基中生长时,记录的表型数据类似于S形生长曲线,从中可以检索一系列生长参数。

解析表型微阵列数据

Bio.phenotype package can parse two different formats of Phenotype Microarray data: the CSV (逗号分隔的值)由机器专有软件生成的文件和 JSON 分析软件生成的文件,例如 opmDuctApe .解析器将返回PlateRecord对象的一个或一个生成器,具体取决于是否使用了读方法或解析方法。您可以使用 Plates.csv Biopython源代码提供的文件。

>>> from Bio import phenotype
>>> for record in phenotype.parse("Plates.csv", "pm-csv"):
...     print("%s %i" % (record.id, len(record)))
...
PM01 96
PM01 96
PM09 96
PM09 96

解析器返回一系列PlateRecord对象,每个对象都包含一系列WellRecord对象(保存每个孔的实验数据),排列在8行和12列中;每一行都由从A到H的MIDI字符指示,而列则由两位数字指示,从01到12。有多种方法可以从PlateRecord对象访问WellRecord对象:

井标识符

如果您知道井标识符(行+列标识符),则可以直接访问所需的井。

>>> record["A02"]
WellRecord('(0.0, 12.0), (0.25, 18.0), (0.5, 27.0), (0.75, 35.0), (1.0, 37.0), ..., (71.75, 143.0)')
井板坐标

可以使用行和列号(从0开始的索引)检索相同的井。

>>> from Bio import phenotype
>>> record = list(phenotype.parse("Plates.csv", "pm-csv"))[-1]
>>> print(record[0, 1].id)
A02
行或列坐标

可以通过对PlateRecord对象使用Python列表切片语法批量检索板中彼此相邻的一系列WellRecord对象;行和列使用从0开始的索引进行编号。

>>> print(record[0])
Plate ID: PM09
Well: 12
Rows: 1
Columns: 12
PlateRecord('WellRecord['A01'], WellRecord['A02'], WellRecord['A03'], ..., WellRecord['A12']')
>>> print(record[:, 0])
Plate ID: PM09
Well: 8
Rows: 8
Columns: 1
PlateRecord('WellRecord['A01'], WellRecord['B01'], WellRecord['C01'], ..., WellRecord['H01']')
>>> print(record[:3, :3])
Plate ID: PM09
Well: 9
Rows: 3
Columns: 3
PlateRecord('WellRecord['A01'], WellRecord['A02'], WellRecord['A03'], ..., WellRecord['C03']')

操纵表型微阵列数据

删除原始数据

从PM文件中提取的原始数据由每个孔的一系列二元组组成,包含时间(以小时为单位)和测色测量(以任意单位)。通常,仪器每十五分钟收集一次数据,但不同实验之间的情况可能会有所不同。可以通过迭代WellRecord对象来访问原始数据;在下面的示例中,仅显示前十个时间点。

>>> from Bio import phenotype
>>> record = list(phenotype.parse("Plates.csv", "pm-csv"))[-1]
>>> well = record["A02"]
>>> for time, signal in well:
...     print(time, signal)
...
(0.0, 12.0)
(0.25, 18.0)
(0.5, 27.0)
(0.75, 35.0)
(1.0, 37.0)
(1.25, 41.0)
(1.5, 44.0)
(1.75, 44.0)
(2.0, 44.0)
(2.25, 44.0)
[...]

这种方法虽然提供了一种访问原始数据的方法,但不允许在不同的WellRecord对象之间进行直接比较,这些对象可能在不同的时间点进行测量。

删除内插数据

为了更容易地比较不同的实验,并且总体上允许更直观地处理表型数据,该模块允许定义WellRecord对象中存在的时间点的自定义切片。未直接测量的时间点的测色数据是通过可用数据的线性插值来得出的,否则返回NaN。此方法仅适用于有实际数据的时间间隔。时间间隔可以使用与列表索引相同的语法定义;因此,默认时间间隔为一小时。

>>> well[:10]
[12.0, 37.0, 44.0, 44.0, 44.0, 44.0, 44.0, 44.0, 44.0, 44.0]
>>> well[9.55]
44.0

可以使用不同的时间间隔,例如五分钟:

>>> for value in well[63 : 64 : 5 / 60]:
...     print(f"{value:0.2f}")
...
110.00
111.00
112.00
113.00
113.33
113.67
114.00
114.33
114.67
115.00
115.00
115.00
>>> for value in well[63.33:73.33]:
...     print(f"{value:0.2f}")
...
113.32
117.00
120.32
128.00
129.64
132.96
136.96
140.00
142.00
nan

对照孔减法

许多表型微阵列板包含对照孔(通常是A01),即培养基不应支持任何生长的孔;该孔产生的低信号可以从其他孔中减去。PlateRecord对象有一个专门的函数,该函数返回另一个带有更正数据的PlateRecord对象。

>>> corrected = record.subtract_control(control="A01")
>>> record["A01"][63]
336.0
>>> corrected["A01"][63]
0.0

参数提取

那些观察到代谢活动的井显示出测色数据的S形行为。为了以更简单的方式比较不同的实验,可以将S形曲线匹配到数据上,以便可以提取一系列总结参数并用于比较。可以从曲线中提取的参数有:

  • 最低( min )和最大( max )信号;

  • 平均身高( average_height );

  • 曲线下面积( area );

  • 曲线平台点( plateau );

  • 指数代谢活动期间的曲线斜坡( slope );

  • 曲线滞后时间( lag ).

所有参数(除了 min , maxaverage_height )要求 scipy library 待安装。

fit函数使用三个sigmoid函数:

Gompertz

\(Ae^{-e^{(\frac{\mu_{m}e}{A}(\lambda - t) + 1)}} + y0\)

Logistic

\(\frac{A}{1+e^{(\frac{4\mu_{m}}{A}(\lambda - t) + 2)}} + y_{0}\)

理查兹

\(A(1 + ve^{1 + v} + e^{\frac{\mu_{m}}{A}(1 + v)(1 + \frac{1}{v})(\lambda - t)})^{-\frac{1}{v}} + y0\)

其中:

  • 对应于 plateau

  • 对应于 slope

  • 对应于 lag

这些功能源自 this publication .默认情况下,fit方法首先尝试匹配gompertz函数:如果失败,它将尝试匹配逻辑函数,然后再匹配richards函数。用户还可以指定要应用的三个功能之一。

>>> from Bio import phenotype
>>> record = list(phenotype.parse("Plates.csv", "pm-csv"))[-1]
>>> well = record["A02"]
>>> well.fit()
>>> print("Function fitted: %s" % well.model)
Function fitted: gompertz
>>> for param in ["area", "average_height", "lag", "max", "min", "plateau", "slope"]:
...     print("%s\t%.2f" % (param, getattr(well, param)))
...
area    4414.38
average_height  61.58
lag     48.60
max     143.00
min     12.00
plateau 120.02
slope   4.99

写入表型微阵列数据

PlateRecord对象可以以形式写入文件 JSON 文件,与其他软件包(例如)兼容的格式 opmDuctApe .

>>> phenotype.write(record, "out.json", "pm-json")
1