Python tables.StringCol() Examples
The following are 2
code examples of tables.StringCol().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tables
, or try the search function
.
Example #1
Source File: test_find_intersecting_snps.py From WASP with Apache License 2.0 | 5 votes |
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()
Example #2
Source File: test_find_intersecting_snps.py From WASP with Apache License 2.0 | 5 votes |
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()