%pwd
%cd ../data
%ls
fp = open("sample_table.csv")
fp.readline()
'run\tdesc\tcondition\n'
print('run\tdesc\tcondition\n')
'run desc condition\n'
fp.readline()
line = fp.readline()
line
type(line)
line.split()
line.split(",")
fields = line.split(",")
type(fields)
line
from csv import reader
fp.close()
fp = open("sample_table.csv")
r = reader(fp)
next(r)
next(r)
from urllib import urlopen
!wget 'http://histo.ucsf.edu/BMS270/BMS270_2019/data/GSE88801_kallisto_TPMs_thresh10.cdt'
%ls
fp2 = open("GSE88801_kallisto_TPMs_thresh10.cdt")
fp2.readline()
from csv import excel_tab
r2 = reader(open("GSE88801_kallisto_TPMs_thresh10.cdt"))
next(r2)
r2 = reader(open("GSE88801_kallisto_TPMs_thresh10.cdt"),dialect=excel_tab)
del excel_tab
r2 = reader(open("GSE88801_kallisto_TPMs_thresh10.cdt"),dialect=excel_tab)
from csv import excel_tab
r2 = reader(open("GSE88801_kallisto_TPMs_thresh10.cdt"),dialect=excel_tab)
header = next(r2)
header
row = next(r2)
row
row[0]
row[1]
row[2]
row[-1]
row[-2]
len(row)
row[37]
row[2:5]
row[:5]
row[30:]
a = ["a","b","c","d"]
b = a
b
b[2]
b[2] = "Hello"
b
a
Make a full copy of b
# Make a full copy of b
a = b[:]
a[2] = "c"
a
b
'a"
"""This is a first line
this is a second line
"""
("this is a first line"
"this is still the first line"
"this too")
row[:5]
float(row[2])
int(float(row[2]))
int(float(row[3]))
a = float(row[2])
int(a)
int(float(row[3])+.5)
int(float(row[2])+.5)
data = []
for i in row:
data.append(float(i))
data = []
for i in row[2:]:
print("hi",i)
data.append(float(i))
data
data[:5]
min(data),max(data)
histogram = [0,0,0,0,0]
for i in data:
#histogram[int(i/2)] = histogram[int(i/2)] + 1
histogram[int(i/2)] += 1
histogram
%matplotlib nbagg
import matplotlib.pyplot as plt
fig = plt.figure()
plt.plot(histogram)
fig.savefig("myplot.png")
fig.savefig("myplot.pdf")
%ls
fig = plt.figure()
plt.hist(data)
fig = plt.figure()
plt.plot(sorted(data))