iflen(atom_op3)<1orlen(atom_p)<1:#if no atom p or op3 in this chain
op3_p=np.nan
else:
op3_p=distance(atom_op3[0],atom_p[0])
iflen(last_o3p)<1orlen(atom_p)<1orf!=f_prec:#if the file has changed, do not calculate the distance between o3 'of the previous file and p of the current file
last_o3p_p=None
else:
ifdistance(last_o3p[0],atom_p[0])>3:
last_o3p_p=None
else:
last_o3p_p=distance(last_o3p[0],atom_p[0])#link with the previous nucleotide
iflen(atom_op1)<1orlen(atom_p)<1:
p_op1=None
else:
p_op1=distance(atom_op1[0],atom_p[0])
iflen(atom_op2)<1orlen(atom_p)<1:
p_op2=None
else:
p_op2=distance(atom_op2[0],atom_p[0])
iflen(atom_o5p)<1orlen(atom_p)<1:
p_o5p=None
else:
p_o5p=distance(atom_o5p[0],atom_p[0])
iflen(atom_o5p)<1orlen(atom_c5p)<1:
o5p_c5p=None
else:
o5p_c5p=distance(atom_o5p[0],atom_c5p[0])
iflen(atom_c5p)<1orlen(atom_c4p)<1:
c5p_c4p=None
else:
c5p_c4p=distance(atom_c5p[0],atom_c4p[0])
iflen(atom_c4p)<1orlen(atom_o4p)<1:
c4p_o4p=None
else:
c4p_o4p=distance(atom_c4p[0],atom_o4p[0])
iflen(atom_c4p)<1orlen(atom_c3p)<1:
c4p_c3p=None
else:
c4p_c3p=distance(atom_c4p[0],atom_c3p[0])
iflen(atom_o4p)<1orlen(atom_c1p)<1:
o4p_c1p=None
else:
o4p_c1p=distance(atom_o4p[0],atom_c1p[0])
iflen(atom_c1p)<1orlen(atom_c2p)<1:
c1p_c2p=None
else:
c1p_c2p=distance(atom_c1p[0],atom_c2p[0])
iflen(atom_c2p)<1orlen(atom_o2p)<1:
c2p_o2p=None
else:
c2p_o2p=distance(atom_c2p[0],atom_o2p[0])
iflen(atom_c2p)<1orlen(atom_c3p)<1:
c2p_c3p=None
else:
c2p_c3p=distance(atom_c2p[0],atom_c3p[0])
iflen(atom_c3p)<1orlen(atom_o3p)<1:
c3p_o3p=None
else:
c3p_o3p=distance(atom_c3p[0],atom_o3p[0])
last_o3p=atom_o3p#o3' of this residue becomes the previous o3' of the following
f_prec=f
#different cases for the aromatic cycles
ifres.get_resname()=='A'orres.get_resname()=='G':
'''
computes the distances between atoms of aromatic cycles