In [1]:
import cPickle as pickle
In [9]:
with open('GPD1_seq.fasta', 'r') as f:
lines = f.readlines()
seq=''
for line in lines:
if line.startswith('>'):
continue
else:
seq=seq + line.rstrip()
print seq
In [14]:
def compute_nt_composition( sequence ):
base_dict = {'A':0,'C':0,'G':0,'T':0}
for elem in sequence:
base_dict[elem]+=1
return base_dict
In [20]:
result = compute_nt_composition(seq)
print result
In [18]:
with open('save.p', 'w') as f:
pickle.dump(result, f)
In [22]:
%matplotlib inline
from pylab import *
In [35]:
xv=[0.7,1.7,2.7,3.7]; yv=[324,240,336,276]
mybar=bar(xv,yv,width=0.7)
xticks(range(1,5),['A','B','C','D'])
setp(mybar,color='g',edgecolor='k')
Out[35]:
In [ ]: