Skip to content

Instantly share code, notes, and snippets.

for i in range(len(df.index.values)):
if df.index.values[i] in list(id2motif.keys()):
one = df.loc[df.index.values[i]]
for j in range(i+1, len(df.index.values)):
if df.index.values[j] in list(id2motif.keys()):
two = df.loc[df.index.values[j]]
print(df.index.values[i],df.index.values[j])
stats.pearsonr(one,two)
# above function wasn't producing results, figured out that it was getting through the "in range" part
@mkcook
mkcook / gist:6326fe1ea37cb7ab13e6e66a5c80fff3
Created November 14, 2018 06:01
Practice Computational Task
# Import libraries up front
import json
# From Table S13 in Plaisier et al., Cell Systems 2016
# These are Entrez IDs (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3013746/)
input = ['430', '1052', '1053', '1385', '84699', '9586', '1871', '1874', '144455', '79733', '1960', '1997', '2002', '2004', '80712', '2114', '2115', '2120', '51513', '2551', '2623', '2624', '2625', '9421', '3232', '10320', '3659', '3662', '3670', '91464', '3726', '10661', '11278', '128209', '10365', '9314', '1316', '51176', '9935', '23269', '4602', '4774', '4790', '7025', '9480', '5468', '5914', '5916', '3516', '5971', '864', '6257', '4093', '6659', '6660', '6662', '25803', '347853', '30009', '9496', '6929', '6925', '8463', '7022', '29842', '10155', '6935', '132625', '23051', '85416', '7707', '7764', '23528', '201516']
# Loading JSON file
# https://www.safaribooksonline.com/library/view/python-cookbook-3rd/9781449357337/ch06s02.html
# Example: