I have a file "uniprot.tab" of size 3,8GB.
I'm trying to draw an histogram based on this file, but it never finishes calculating because it is too big.
I have tested my code previously with a small file "mock.tab" and it works correctly.
EDIT: Some lines of "mock.dat" as example:
Entry Status Cross-reference (PDB)
A1WYA9 reviewed
Q6LLK1 reviewed
Q1ACM9 reviewed
P10994 reviewed 1OY8;1OY9;1OY9;1OY9;
Q0HV56 reviewed
Q2NQJ2 reviewed
B7HCE7 reviewed
P0A959 reviewed 4CVQ;
B7HLI3 reviewed
P31224 reviewed 1IWG;1OY6;1OY8;1OY9;4CVQ;
Here you can see the code used on the small file:
import matplotlib.pyplot as plt
occurrences = []
with open('/home/martina/Documents/webstormProj/unpAnalysis/mock.tab', 'r') as f:
next(f) #do not read the heading
for line in f:
col_third = line.split('\t')[2] #take third column
occ = col_third.count(';') # count how many times it finds ; in each line
occurrences.append(occ)
x_min = min(occurrences)
x_max = max(occurrences)
x = [] # x-axis
x = list(range(x_min, x_max + 1))
y = [] # y-axis
for i in x:
y.append(occurrences.count(i))
plt.bar(x,y,align='center') # draw the plot
plt.xlabel('Bins')
plt.ylabel('Frequency')
plt.show()
How can I be able to draw this plot with my large file?