Hi,
I have two files and the content is as follows:
Please only consider the bolded column and the red column. The remaining text is junk and unnecessary. As evident from the two files they are similar in many ways. I am trying to compare the bolded text in file_1 and file_2 (it is not bolded but hope you can make out it is the same column) and if they are different, I want to print out the red text from file_1. I achieved this by the following script:
import string
import itertools
chain_id=[]
for file in os.listdir("."):
basename = os.path.basename(file)
if basename.startswith("d.complex"):
chain_id.append(basename)
for i in chain_id:
print i
g=codecs.open(i, encoding='utf-8')
f=codecs.open("ac_chain_dssp.dssp", encoding='utf-8')
for (x, y) in itertools.izip(g, f):
if y[11]=="C":
if y[35:38]!= "EN":
if y[35:38] != "OTE":
if x[11]=="C":
if x[12] != "C":
if y[35:38] !=x[35:38]:
print x [7:10]
g.close()
f.close()
But the results I got were not what I expected. Now I want to modify the above code in such a way that when I compare the bolded column, if the difference between the values is more than 2, then it has to print out the results. For example, row-1 of bolded column in file_1 is 83 and in file_2 it is 84 since the difference between the two is less than two, I want it to be rejected.
Can someone help me in adding the remaining code? Cheers, Chavanak
PS: This is not homework :)