def buildCorrelationEntries(self, name, gene, weight_db_logic, snps_by_rsid):
weights_in_gene = weight_db_logic.weights_by_gene[gene]
rsids_from_genes = weights_in_gene.keys()
#gather as much data as we can work on
related_rsids, related_data = self.buildRelatedData(rsids_from_genes, snps_by_rsid, weights_in_gene)
if len(related_rsids) == 0:
return []
self.updateFoundCorrelation(gene, name)
#correlation matrix of related SNP's data
array = numpy.array(related_data)
cor = numpy.corrcoef(array)
#translate into sql entries
entries = self.buildMatrixOutputEntries(cor, rsids_from_genes, related_rsids, snps_by_rsid)
if not len(entries):
raise NameError("Couldn not build correlation entries for (%s,%s)" %(name,gene))
return entries
M01_covariances_correlations.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录