当前位置: 首页>>代码示例>>Python>>正文


Python Table.add_data_by_column_id方法代码示例

本文整理汇总了Python中pbcommand.models.report.Table.add_data_by_column_id方法的典型用法代码示例。如果您正苦于以下问题:Python Table.add_data_by_column_id方法的具体用法?Python Table.add_data_by_column_id怎么用?Python Table.add_data_by_column_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pbcommand.models.report.Table的用法示例。


在下文中一共展示了Table.add_data_by_column_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: to_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def to_table(motif_records):

    columns = [Column(Constants.C_ID),
               Column(Constants.C_POS),
               Column(Constants.C_TYPE),
               Column(Constants.C_PCT_MOTIF),
               Column(Constants.C_NMOTIF),
               Column(Constants.C_NMOTIF_GEN),
               Column(Constants.C_READSCORE),
               Column(Constants.C_COV),
               Column(Constants.C_PARTNER),
               Column(Constants.C_IPD),
               Column(Constants.C_GRP),
               Column(Constants.C_OBJ_SCORE)]

    # Record attr name ordered by index in columns
    attr_names = ['motif_str', 'center_position',
                  'modification_type',
                  'fraction', 'ndetected',
                  'ngenome', 'mean_score',
                  'mean_coverage', 'partner_motif_str',
                  'mean_ipd_ratio',
                  'group_tag', 'objective_score']

    table = Table(Constants.T_ID, columns=columns)

    for record in motif_records:
        for attr_name, column in zip(attr_names, columns):
            v = getattr(record, attr_name)
            table.add_data_by_column_id(column.id, v)

    return table
开发者ID:natechols,项目名称:pbreports,代码行数:34,代码来源:motifs.py

示例2: _to_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
    def _to_table(self, movie_datum):
        """
        Create a pbreports Table for each movie.

        :param movie_datum: List of

        [(
        movie_name,
        reads,
        mean readlength,
        polymerase readlength
        number of subread bases
        mean subread readlength
        mean subread concordance), ...]
        """

        table = Table(Constants.T_STATS, columns=(Column(c_id)
                                                  for c_id in self.COL_IDS))

        for movie_data in movie_datum:
            if len(movie_data) != len(self.COL_IDS):
                log.error(movie_datum)
                raise ValueError(
                    "Incompatible values. {n} values provided, expected {a}".format(n=len(movie_data), a=len(self.COL_IDS)))

            for value, c_id in zip(movie_data, self.COL_IDS):

                table.add_data_by_column_id(c_id, value)

        log.debug(str(table))
        return table
开发者ID:natechols,项目名称:pbreports,代码行数:33,代码来源:mapping_stats.py

示例3: _to_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
    def _to_table(self, movie_datum):
        """
        Create a pbreports Table for each movie.

        :param movie_datum: List of

        [(
        movie_name,
        reads,
        mean readlength,
        polymerase readlength
        number of subread bases
        mean subread readlength
        mean subread accuracy), ...]
        """
        columns = [Column(k, header=h) for k,h in self.COLUMNS]
        table = Table(Constants.T_STATS,
                      title="Mapping Statistics Summary",
                      columns=columns)

        for movie_data in movie_datum:
            if len(movie_data) != len(columns):
                log.error(movie_datum)
                raise ValueError(
                    "Incompatible values. {n} values provided, expected {a}".format(n=len(movie_data), a=len(columns)))

            for value, c in zip(movie_data, columns):
                table.add_data_by_column_id(c.id, value)

        log.debug(str(table))
        print table
        return table
开发者ID:skinner,项目名称:pbreports,代码行数:34,代码来源:mapping_stats.py

示例4: create_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def create_table(d, barcode):
    """Long Amplicon Analysis results table"""

    columns = []

    if barcode:
        columns.append(Column(Constants.C_BARCODE))

    columns.append(Column(Constants.C_CLUSTER))
    columns.append(Column(Constants.C_PHASE))
    columns.append(Column(Constants.C_LENGTH))
    columns.append(Column(Constants.C_ACCURACY))
    columns.append(Column(Constants.C_COVERAGE))

    t = Table(Constants.T_ID,
              columns=columns)

    for fastaname in sorted(d.fastaname):
        row = d[d.fastaname == fastaname]
        for column in columns:
            # if column.id == "predictedaccuracy":
            #    accuracy = round(100 * row[column.id][0], 2)
            #    t.add_data_by_column_id(column.id, accuracy)
            # else:
            t.add_data_by_column_id(column.id, row[column.id][0])

    log.info(str(t))
    return t
开发者ID:PacificBiosciences,项目名称:pbreports,代码行数:30,代码来源:amplicon_analysis_consensus.py

示例5: run_to_report

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def run_to_report(reads, barcodes, subreads=True, dataset_uuids=()):
    """ Generate a Report instance from a SubreadSet and BarcodeSet.
    :param subreads: If the ccs fofn is given this needs to be set to False
    """

    class MyRow(object):
        def __init__(self, label):
            self.label = label
            self.bases = 0
            self.reads = 0

    label2row = {}

    for label, barcode, read in _labels_reads_iterator(reads, barcodes, subreads=subreads):
        if not label in label2row:
            label2row[label] = MyRow(label)
        label2row[label].bases += len(read)
        label2row[label].reads += 1

    columns = [Column(Constants.C_BARCODE), Column(Constants.C_NREADS), Column(Constants.C_NBASES)]

    table = Table("barcode_table", columns=columns)
    labels = sorted(label2row.keys())
    for label in labels:
        row = label2row[label]
        table.add_data_by_column_id(Constants.C_BARCODE, label)
        table.add_data_by_column_id(Constants.C_NREADS, row.reads)
        table.add_data_by_column_id(Constants.C_NBASES, row.bases)

    report = Report(meta_rpt.id, tables=[table], dataset_uuids=dataset_uuids)
    return meta_rpt.apply_view(report)
开发者ID:mdsmith,项目名称:pbreports,代码行数:33,代码来源:barcode.py

示例6: TestBasicTable

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
class TestBasicTable(unittest.TestCase):

    """Basic Smoke tests"""

    def setUp(self):
        self.columns = [Column('one', header="One"),
                        Column('two', header="Two"),
                        Column('three', header="Three")]
        self.table = Table('my_table_with_values', columns=self.columns)
        datum = {'one': list(xrange(3)), 'two': list('abc'),
                 'three': 'file1 file2 file3'.split()}
        for k, values in datum.iteritems():
            for value in values:
                self.table.add_data_by_column_id(k, value)

    def test_str(self):
        """Smoke test for conversion to str"""
        log.info(str(self.table))
        self.assertIsNotNone(str(self.table))

    def test_columns(self):
        """Test Columns"""
        self.assertEqual(len(self.table.columns), 3)

    def test_column_values(self):
        """Basic check for column values"""
        for column in self.table.columns:
            self.assertEqual(len(column.values), 3)

    def test_to_dict(self):
        """Conversion to dictionary"""
        self.assertTrue(isinstance(self.table.to_dict(), dict))
        log.info(self.table.to_dict())
开发者ID:PacificBiosciences,项目名称:pbcommand,代码行数:35,代码来源:test_models_report_table.py

示例7: create_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def create_table(d, barcode):
    """Long Amplicon Analysis results table"""

    columns = []

    if barcode:
        columns.append(Column("barcodename", header="Barcode"))

    columns.append(Column("coarsecluster", header="Sequence Cluster"))
    columns.append(Column("phase", header="Sequence Phase"))
    columns.append(Column("sequencelength", header="Length (bp)"))
    columns.append(Column("predictedaccuracy", header="Estimated Accuracy"))
    columns.append(Column("totalcoverage", header="Subreads coverage"))

    t = Table("result_table", title="Amplicon Consensus Summary",
              columns=columns)

    for fastaname in sorted(d.fastaname):
        row = d[d.fastaname == fastaname]
        for column in columns:
            #if column.id == "predictedaccuracy":
            #    accuracy = round(100 * row[column.id][0], 2)
            #    t.add_data_by_column_id(column.id, accuracy)
            #else:
            t.add_data_by_column_id(column.id, row[column.id][0])

    log.info(str(t))
    return t
开发者ID:skinner,项目名称:pbreports,代码行数:30,代码来源:amplicon_analysis_consensus.py

示例8: to_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def to_table(motif_records):

    columns = [Column('motif_id', header="Motif"),
               Column('modified_position', header="Modified Position"),
               Column('modification_type', header="Motification Type"),
               Column('percent_motifs_detected',
                      header="% of Motifs Detected"),
               Column('ndetected_motifs', header="# of Motifs Detected"),
               Column('nmotifs_in_genome', header="# of Motifs in Genome"),
               Column('mean_readscore', header='Mean QV'),
               Column('mean_coverage', header="Mean Coverage"),
               Column('partner_motif', header="Partner Motif"),
               Column('mean_ipd_ration', header="Mean IPD ratio"),
               Column('group_tag', header="Group Tag"),
               Column('objective_score', header='Objective Score')]

    # Record attr name ordered by index in columns
    attr_names = ['motif_str', 'center_position',
                  'modification_type',
                  'fraction', 'ndetected',
                  'ngenome', 'mean_score',
                  'mean_coverage', 'partner_motif_str',
                  'mean_ipd_ratio',
                  'group_tag', 'objective_score']

    table = Table(Constants.T_ID, title="Motifs", columns=columns)

    for record in motif_records:
        for attr_name, column in zip(attr_names, columns):
            v = getattr(record, attr_name)
            table.add_data_by_column_id(column.id, v)

    return table
开发者ID:vrainish-pacbio,项目名称:pbreports,代码行数:35,代码来源:motifs.py

示例9: attributesToTable

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def attributesToTable(attributes):
    """Build a report table from Iso-Seq cluster attributes."""
    columns = [Column(x.id, header="") for x in attributes]

    table = Table(Constants.T_ATTR,
                  columns=columns)

    for x in attributes:
        table.add_data_by_column_id(x.id, x.value)

    return table
开发者ID:lpp1985,项目名称:lpp_Script,代码行数:13,代码来源:isoseq_cluster.py

示例10: attributesToTable

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def attributesToTable(attributes):
    """Build a report table from IsoSeq cluster attributes."""
    columns = [Column(x.id, header=x.name) for x in attributes]

    table = Table('isoseq_cluster_table',
                  title="IsoSeq Cluster",
                  columns=columns)

    for x in attributes:
        table.add_data_by_column_id(x.id, x.value)

    return table
开发者ID:vrainish-pacbio,项目名称:pbreports,代码行数:14,代码来源:isoseq_cluster.py

示例11: test_add_data_by_column_id

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
    def test_add_data_by_column_id(self):
        """Added data values by column identifier."""

        columns = [Column('one'), Column('two')]
        table = Table('mytable', columns=columns)

        datum = {'one': 12.0, 'two': 1234.0}

        for k, v in datum.iteritems():
            table.add_data_by_column_id(k, v)

        self.assertTrue(12.0 in table.columns[0].values)
        self.assertTrue(1234.0 in table.columns[1].values)
开发者ID:PacificBiosciences,项目名称:pbcommand,代码行数:15,代码来源:test_models_report_table.py

示例12: _attributes_to_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def _attributes_to_table(attributes):
    """Build a report table from Iso-Seq Classify attributes.

    """
    columns = [Column(x.id) for x in attributes]

    table = Table(Constants.T_ATTR,
                  columns=columns)

    for x in attributes:
        table.add_data_by_column_id(x.id, x.value)

    return table
开发者ID:lpp1985,项目名称:lpp_Script,代码行数:15,代码来源:isoseq_classify.py

示例13: create_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def create_table(tabulated_data):
    """Long Amplicon Analysis results table"""

    columns = []
    columns.append(Column("barcode_col", header=""))
    columns.append(Column("good", header=""))
    columns.append(Column("good_pct", header=""))
    columns.append(Column("chimera", header=""))
    columns.append(Column("chimera_pct", header=""))
    columns.append(Column("noise", header=""))
    columns.append(Column("noise_pct", header=""))

    t = Table(Constants.T_R, columns=columns)

    for barcode, data in tabulated_data.iteritems():
        if barcode != "all":
            t.add_data_by_column_id("barcode_col", barcode)
            for column_id in ["good", "good_pct", "chimera", "chimera_pct", "noise", "noise_pct"]:
                t.add_data_by_column_id(column_id, data[column_id])
    t.add_data_by_column_id("barcode_col", "All")
    for column_id in ["good", "good_pct", "chimera", "chimera_pct", "noise", "noise_pct"]:
        t.add_data_by_column_id(column_id, tabulated_data["all"][column_id])

    log.info(str(t))
    return t
开发者ID:mdsmith,项目名称:pbreports,代码行数:27,代码来源:amplicon_analysis_input.py

示例14: create_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def create_table(tabulated_data):
    """Long Amplicon Analysis results table"""

    columns = []
    columns.append(Column("barcode_col", header="Sample"))
    columns.append(Column("good", header="Good"))
    columns.append(Column("good_pct", header="Good (%)"))
    columns.append(Column("chimera", header="Chimeric"))
    columns.append(Column("chimera_pct", header="Chimeric (%)"))
    columns.append(Column("noise", header="Noise"))
    columns.append(Column("noise_pct", header="Noise (%)"))

    t = Table("result_table",
              title="Amplicon Input Molecule Summary", columns=columns)

    for barcode, data in tabulated_data.iteritems():
        if barcode != 'all':
            t.add_data_by_column_id('barcode_col', barcode)
            for column_id in ['good', 'good_pct', 'chimera', 'chimera_pct', 'noise', 'noise_pct']:
                t.add_data_by_column_id(column_id, data[column_id])
    t.add_data_by_column_id('barcode_col', 'All')
    for column_id in ['good', 'good_pct', 'chimera', 'chimera_pct', 'noise', 'noise_pct']:
        t.add_data_by_column_id(column_id, tabulated_data['all'][column_id])

    log.info(str(t))
    return t
开发者ID:tkerelska,项目名称:pbreports,代码行数:28,代码来源:amplicon_analysis_input.py

示例15: _attributes_to_table

# 需要导入模块: from pbcommand.models.report import Table [as 别名]
# 或者: from pbcommand.models.report.Table import add_data_by_column_id [as 别名]
def _attributes_to_table(attributes):
    """Build a report table from IsoSeq Classify attributes.

    """
    columns = [Column(x.id, header=x.name) for x in attributes]

    table = Table('isoseq_classify_table',
                  title="IsoSeq Transcript Classification",
                  columns=columns)

    for x in attributes:
        table.add_data_by_column_id(x.id, x.value)

    return table
开发者ID:vrainish-pacbio,项目名称:pbreports,代码行数:16,代码来源:isoseq_classify.py


注:本文中的pbcommand.models.report.Table.add_data_by_column_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。