How To Read Enzyme Code And E-Value From File And Write To A Matrix?
HI all, How can I built matrix by reading whole files.I just need two things from file that enzyme code and E VALUES scores. Both characters are in two columns in 1000 lines. for this I wrote this code but it is not working.
f=open("output.txt")
data=f.readlines()
label=1
label_dictionary = {}
for lines in data:
print lines,
columns= lines.split()
print columns
if columns [1] not in label_dictionary:
label_dictionary[columns[1]]=label
label=label+1
if columns [-1] not in label_dictionary:
label_dictionary[columns[-1]] = label
label=label+1
print label_dictionary
print label_dictionary,[columns[1]],label_dictionary,[columns[-1]]
• 2,210 views
•
link
0 answers
No answers yet.
Log in to answer this question.
can you add an example showing 4 lines from the file and the 4 by 4 (?) matrix is would create?
You will learn more about Python if you ask your fellow students, your tutors or supervisor about this. Here on BioStar you will get a ready made solution, which surely will help you out now, but you will not have learned anything from the task you are trying to solve.
Hello Azam!
We believe that this post does not fit the main topic of this site.
Inactive for >2 years
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!