In [2]:
dresser = []
for i in range(10):
    drawer = []
    for j in range(5):
        drawer.append(i*j)
    dresser.append(drawer)
dresser
Out[2]:
[[0, 0, 0, 0, 0],
 [0, 1, 2, 3, 4],
 [0, 2, 4, 6, 8],
 [0, 3, 6, 9, 12],
 [0, 4, 8, 12, 16],
 [0, 5, 10, 15, 20],
 [0, 6, 12, 18, 24],
 [0, 7, 14, 21, 28],
 [0, 8, 16, 24, 32],
 [0, 9, 18, 27, 36]]
In [3]:
print(dresser)
[[0, 0, 0, 0, 0], [0, 1, 2, 3, 4], [0, 2, 4, 6, 8], [0, 3, 6, 9, 12], [0, 4, 8, 12, 16], [0, 5, 10, 15, 20], [0, 6, 12, 18, 24], [0, 7, 14, 21, 28], [0, 8, 16, 24, 32], [0, 9, 18, 27, 36]]
In [4]:
%cd ../data/
/home/explorer/BMS270/data
In [5]:
!ls
GSE88801_kallisto_TPMs_thresh10.cdt  sample_table.csv  SRR7541452.6M.fastq.gz
In [8]:
from csv import reader, excel_tab
names = []
orfs = []
data = []
fp = reader(open("GSE88801_kallisto_TPMs_thresh10.cdt"),
                      dialect = excel_tab)
header = next(fp)
for row in fp:
    orfs.append(row[0])
    names.append(row[1])
    cols = []
    for i in row[2:]:
        cols.append(float(i))
    data.append(cols)
In [13]:
x = list(range(10))
In [11]:
from random import shuffle, sample, seed
In [16]:
seed(42)
y = sample(x,len(x))
x, y
Out[16]:
([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 0, 4, 9, 6, 5, 8, 2, 3, 7])
In [17]:
shuffle(x)
x
Out[17]:
[5, 3, 2, 8, 4, 6, 7, 1, 9, 0]
In [9]:
%%timeit
print("hi")
hi
CPU times: user 0 ns, sys: 0 ns, total: 0 ns
Wall time: 3.01 ms
In [ ]:
%%time
c = correlation_matrix(whatever)