matrix.py 文件源码

python
阅读 45 收藏 0 点赞 0 评论 0

项目:cellranger 作者: 10XGenomics 项目源码 文件源码
def save_barcode_summary_h5(self, filename):
        """ Generate a minimal barcode summary h5 without going through the reporter.
        NOTE: only use this if all genomes have the same set of barcodes, i.e. a raw matrix.
        """
        bc_sequences = None
        bc_table_cols = {}
        for (genome, matrix) in self.matrices.iteritems():
            if bc_sequences is None:
                bc_sequences = np.array(matrix.bcs)
                bc_table_cols[cr_constants.H5_BC_SEQUENCE_COL] = bc_sequences
            conf_mapped_deduped_reads_key = cr_utils.format_barcode_summary_h5_key(genome,
                cr_constants.TRANSCRIPTOME_REGION, cr_constants.CONF_MAPPED_DEDUPED_READ_TYPE)
            conf_mapped_deduped_reads = matrix.get_reads_per_bc()
            if len(bc_sequences) != len(conf_mapped_deduped_reads):
                raise ValueError('Cannot write barcode summary since different genomes have different number of barcodes!')
            bc_table_cols[conf_mapped_deduped_reads_key] = conf_mapped_deduped_reads
        cr_utils.write_h5(filename, bc_table_cols)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号