I am working on a secondary project that is scouring the protein data bank for peptides matching specific conditions.
I have a folder containing a large portion of these .pdb files and my game plan is to set this file on the desktop, then use a for-loop to scan through all the files within this folder and bank all necessary data. I am stalled however at the import stage. The file/directory is not being recognized. I am attaching the offending code below:
import os
# - - - - -
#Sector C - Iteration through a folder containing all .pdb files.
for fi in os.listdir('C:/Users/David/Desktop/pdb_Files'):
if os.path.isfile(os.path.join('C:/Users/David/Desktop/pdb_Files', fi)):
listatom,R3_coordinates,posg=[],[],[]
for line in open(fi): # < - - - Issue occurring here.
ist = line.split()
id = ist[0]
if id == 'ATOM':
typ = ist[2]
if Peptide1 == 'PRO':
if typ == 'CA':
res,toc,ac=ist[3:6]
pos = [float(i) for i in ist[6:9]]
if ac >= '0':
listatom.append([int(ist[1]),typ,res,toc,ac,np.array(pos)])
R3_coordinates.append([int(ist[1]),np.array(pos)]) #List of ALL coordinates.
if Plot == True:
posg.append(pos)
All help appreciated.