diff --git a/src/atom.py b/src/atom.py index dce7983..a9cb136 100644 --- a/src/atom.py +++ b/src/atom.py @@ -8,12 +8,13 @@ class Atom: def __init__(self, atom_id, atom_name, res_name, chain_id, - res_seq_nb, coordinates): + res_seq_nb, insertion_code, coordinates): self.atom_id = atom_id self.atom_name = atom_name self.res_name = res_name self.chain_id = chain_id self.res_seq_nb = res_seq_nb + self.insertion_code = insertion_code self.coord_x = coordinates[0] self.coord_y = coordinates[1] self.coord_z = coordinates[2] @@ -27,6 +28,7 @@ class Residue: self.resid = atom.res_seq_nb self.res_name = atom.res_name self.chain_id = atom.chain_id + self.insertion_code = atom.insertion_code def h_bond(self, res2): diff --git a/src/pdb.py b/src/pdb.py index 9e9e2c5..19615da 100644 --- a/src/pdb.py +++ b/src/pdb.py @@ -39,8 +39,9 @@ class PDBFile: atom = Atom(atom_id = int(line[6:11].strip()), atom_name = line[12:16].strip(), res_name = line[17:20].strip(), - chain_id = line[21:22].strip(), + chain_id = line[21:22], res_seq_nb = int(line[22:26].strip()), + insertion_code = line[26:27], coordinates = [float(line[30:38].strip()), float(line[38:46].strip()), float(line[46:54].strip()), @@ -91,6 +92,7 @@ class PDBFile: res_name = resi.res_name, chain_id = resi.chain_id, res_seq_nb = resi.resid, + insertion_code = resi.insertion_code, coordinates = [hydrogen[2], hydrogen[3], hydrogen[4]]) diff --git a/src/structure.py b/src/structure.py index 048fdb5..8d48c02 100644 --- a/src/structure.py +++ b/src/structure.py @@ -121,8 +121,8 @@ def get_helix(residues, turns): k+=1 temp_res.append(residues[i]) if(k>2): - print(k,"- HELIX at", i) - helix.append(Helix(temp_res,i)) + print(k,"- HELIX at", residues[i].resid) + helix.append(Helix(temp_res,residues[i].resid)) i = i+k else: i+=1 @@ -140,7 +140,7 @@ def get_bends(residues): vectors_substr(position_vector(residues[i+2].atoms["CA"].coords), position_vector(residues[i].atoms["CA"].coords))) if(angle>70): - print("angle", i+1, angle) + print("angle", residues[i].resid, angle) return(bends) def vecteur_deux_points (a, b): @@ -175,9 +175,9 @@ def position_vector(c): return vector def vectors_substr(v1, v2): - return ([v2[0]-v1[0], - v2[1]-v1[1], - v2[2]-v1[2]]) + return ([v1[0]-v2[0], + v1[1]-v2[1], + v1[2]-v2[2]]) def vector_angles(v1,v2): dot_prod = dot_product(v1,v2)