當前位置: 首頁>>代碼示例>>Python>>正文


Python tables.IsDescription方法代碼示例

本文整理匯總了Python中tables.IsDescription方法的典型用法代碼示例。如果您正苦於以下問題:Python tables.IsDescription方法的具體用法?Python tables.IsDescription怎麽用?Python tables.IsDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tables的用法示例。


在下文中一共展示了tables.IsDescription方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: write_hap_samples

# 需要導入模塊: import tables [as 別名]
# 或者: from tables import IsDescription [as 別名]
def write_hap_samples(self, h5f):
        """Write tables containing sample names to HDF5 file"""
        class SamplesTab(tables.IsDescription):
            name = tables.StringCol(64)

        for chrom_name in self.chrom_names:
            table = h5f.create_table(h5f.root, "samples_%s" % chrom_name,
                                    SamplesTab)

            for samp in self.hap_samples:
                row = table.row
                row['name'] = samp
                row.append()

            table.flush() 
開發者ID:bmvdgeijn,項目名稱:WASP,代碼行數:17,代碼來源:test_find_intersecting_snps.py

示例2: write_snp_tab_h5

# 需要導入模塊: import tables [as 別名]
# 或者: from tables import IsDescription [as 別名]
def write_snp_tab_h5(self):
        snp_tab_h5 = tables.open_file(self.snp_tab_filename, "w")

        class SNPTab(tables.IsDescription):
            name = tables.StringCol(16)
            pos = tables.Int64Col()
            allele1 = tables.StringCol(100)
            allele2 = tables.StringCol(100)

        chrom_tables = {}
        snp_num = 0
        for snp in self.snp_list:
            if snp[0] in chrom_tables:
                table = chrom_tables[snp[0]]
            else:
                table = snp_tab_h5.create_table(snp_tab_h5.root, snp[0], SNPTab)
                chrom_tables[snp[0]] = table

            row = table.row
            snp_num += 1
            row['name'] = "snp%d" % snp_num
            row['pos'] = snp[1]
            row['allele1'] = snp[2]
            row['allele2'] = snp[3]
            row.append()
            table.flush()

        self.write_hap_samples(snp_tab_h5)
        
        snp_tab_h5.close() 
開發者ID:bmvdgeijn,項目名稱:WASP,代碼行數:32,代碼來源:test_find_intersecting_snps.py

示例3: ensure_structure

# 需要導入模塊: import tables [as 別名]
# 或者: from tables import IsDescription [as 別名]
def ensure_structure(self):
        """
        Ensure that our h5f has the appropriate baseline structure as defined in `self.STRUCTURE`

        Checks that all groups and tables are made, makes them if not
        """
        h5f = self.open_hdf()

        for node in self.STRUCTURE:
            try:
                node = h5f.get_node(node[0])
            except tables.exceptions.NoSuchNodeError:
                #pdb.set_trace()
                # try to make it
                # python 3 compatibility
                if sys.version_info >= (3,0):
                    if isinstance(node[3], str):
                        if node[3] == 'group':
                            h5f.create_group(node[1], node[2])
                    elif issubclass(node[3], tables.IsDescription):
                        h5f.create_table(node[1], node[2], description=node[3])

                # python 2
                else:
                    if isinstance(node[3], basestring):
                        if node[3] == 'group':
                            h5f.create_group(node[1], node[2])
                    elif issubclass(node[3], tables.IsDescription):
                        h5f.create_table(node[1], node[2], description=node[3])

        self.close_hdf(h5f) 
開發者ID:wehr-lab,項目名稱:autopilot,代碼行數:33,代碼來源:subject.py


注:本文中的tables.IsDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。