BIOM Table-codes

p { margin-bottom: 0.25cm; line-height: 120% }
a:link { }

import numpy

from biom.table import Table

============================================================================================================

# 10*4 matrix, [0, 39]

data = numpy.arange(40).reshape(10, 4)

sample_ids = [‘S%d‘ % i for i in range(4)]

observ_ids = [‘O%d‘ % i for i in range(10)]

sample_metadata = [{‘environment‘: ‘A‘}, {‘environment‘: ‘B‘},

{‘environment‘: ‘A‘}, {‘environment‘: ‘B‘}]

observ_metadata = [{‘taxonomy‘: [‘Bacteria‘, ‘Firmicutes‘]},

{‘taxonomy‘: [‘Bacteria‘, ‘Firmicutes‘]},

{‘taxonomy‘: [‘Bacteria‘, ‘Proteobacteria‘]},

{‘taxonomy‘: [‘Bacteria‘, ‘Proteobacteria‘]},

{‘taxonomy‘: [‘Bacteria‘, ‘Proteobacteria‘]},

{‘taxonomy‘: [‘Bacteria‘, ‘Bacteroidetes‘]},

{‘taxonomy‘: [‘Bacteria‘, ‘Bacteroidetes‘]},

{‘taxonomy‘: [‘Bacteria‘, ‘Firmicutes‘]},

{‘taxonomy‘: [‘Bacteria‘, ‘Firmicutes‘]},

{‘taxonomy‘: [‘Bacteria‘, ‘Firmicutes‘]}]

# construct table

table = Table(data, observ_ids, sample_ids, observ_metadata, sample_metadata, table_id=‘myTestTable‘)

# print info of table

table

print(table)

#
print column names

print(table.ids())

print(table.ids(axis=‘sample‘))

#
print row names

print(table.ids(axis=‘observation‘))

#
print number of non-zero entries. Now it’s 39.

print(table.nnz)

============================================================================================================

data = numpy.asarray([[2, 0], [6, 1]])

table = Table(data, [‘O1‘, ‘O2‘], [‘S1‘, ‘S2‘])

# normalize by ‘sample’(column)

new_table = table.norm(inplace=False)

#
normalize by row

new_table
= table.norm(axis=‘observation‘, inplace=False)

#
if inplace=True, table will change too. Now it stay unchanged. If
set table1 = table before norm, and change table1 now, then table
will change, too(shallow copy).

============================================================================================================

============================================================================================================

p { margin-bottom: 0.25cm; line-height: 120% }
a:link { }

时间: 2024-08-06 07:57:55

BIOM Table-codes的相关文章

python练习册 每天一个小程序 第0002题

1 #-*-coding:utf-8-*- 2 __author__ = 'Deen' 3 ''' 4 题目描述: 5 将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中. 6 ''' 7 """ 8 import MySQLdb as mdb 9 10 config = { 11 'host': '127.0.0.1', 12 'port': 3306, 13 'user': 'root', 14 'passwd': '', 15 'd

Java(JCo3)与SAP系统相互调用

声明:原创作品,转载时请注明文章来自SAP师太技术博客:www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将追究法律责任!原文链接:http://www.cnblogs.com/jiangzhengjun/p/4291479.html 外部系统(Java)调用BAPI函数... 78 安装JCo3. 78 创建JCo3连接... 79 直连... 79 连接池... 81 DestinationDataProvider接口(不需连接属性配置文件)..

[SAP ABAP开发技术总结]BAPI调用

目录导航 声明:原创作品,转载时请注明文章来自SAP师太博客,并以超链接形式标明文章原始出处,否则将追究法律责任!原文出自: 18.3.2.5.           调用BAPI 199 18.3.2.5.1.       BAPI事务处理... 200 18.3.2.5.2.       外部系统(Java)调用BAPI函数... 201 18.3.2.5.2.1.    直连.连接池... 201 18.3.2.5.2.2.    访问结构... 202 18.3.2.5.2.3.    访

14-高级路由:OSPF 5 种LSA

一.实验拓扑:二.命令部署:1.1类.2类LSA命令R1#show ip ospf int f0/0 看接口类型R1#show ip ospf database 查看路由器所学习到的完成的网络拓扑R1#show ip ospf database router 查看ospf数据库路由器 R1(config)#int lo1R1(config-if)#ip ospf network point-to-point 修改为点对点类型,这样Lo1发送到对面是24位的.2.3类LSA查看命令:R3#show

热键虚拟码Virtual-Key Codes

http://msdn.microsoft.com/zh-cn/data/dd375731 Virtual-Key Codes Virtual-Key Codes The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. The codes are

Huffman codes

Huffman codes  compress data very effectively: savings of 20% to 90% are typical, depending on the characteristics of the data being compressed. 功能: huffman 编码能有效的压缩数据. 如何解决: Huffman’s greedy algorithm uses a table giving how often each character occ

Windows Locale Codes - Sortable list(具体一个语言里还可具体细分,中国是2052,法国是1036)

Windows Locale Codes - Sortable list NOTE: Code page is an outdated method for character encoding, yet it is still in use.It is now preferable to use 16 bit character set of Unicode. As defined by Microsoft, a locale is either a language or a languag

语言标准编码( List of ISO 639-1 codes)

ISO 639 is a standardized nomenclature used to classify all known languages. Each language is assigned a 2-letter (639-1) and 3-letter (639-2 and 639-3), lowercase abbreviation, amended in later versions of the nomenclature. The system is highly usef

Windows Error Codes

http://www.briandunning.com/error-codes/?source=Windows Windows Error Codes List All Error Codes | Search Errors: FileMaker Error Codes Lasso Error Codes MySQL Error Codes Windows System Errors About this databaseThis is a free public resource. It is