I'm trying to print out the measured distances for each .pdbqt file, and then write a new output file for each .pdbqt, using the original name of the .pdbqt file as the new .txt file name. Below is the script.
I'm using python3 & I'm trying to do this via Linux CLI.
from pymol import stored
stored.a, stored.b, stored.c, stored.d = [],[],[],[]
cmd.iterate_state(1, "r55_01///UNL`1/N*", "stored.a.append(ID)")
cmd.iterate_state(1, "r55_01///UNL`1/O*", "stored.b.append(ID)")
cmd.iterate_state(1, "r55_01//R/ASP`113/OD2", "stored.c.append(ID)")
cmd.iterate_state(1, "r55_01//R/ASN`312/ND2", "stored.d.append(ID)")
f=open("tt.txt", 'w')
for a in stored.a:
for c in stored.c:
d1=cmd.distance("id %s" % a, "id %s" % c,cutoff=5)
f.write("%s D113 %s\n" % (a,d1))
print(d1)
for b in stored.b:
for d in stored.d:
d2 = cmd.distance("id %s" % b, "id %s" % d, cutoff=5)
f.write("%s N312 %s\n" % (b,d2))
print(d2)
f.close()
My folder looks something like this
.
├── dst6.txt
├── sp
│ ├── r55_01.pdbqt
│ ├── r55_02.pdbqt
│ ├── r55_03.pdbqt
│ ├── r55_04.pdbqt
│ ├── r55_05.pdbqt
│ ├── r55_06.pdbqt
│ ├── r55_07.pdbqt
│ ├── r55_08.pdbqt
│ ├── r55_09.pdbqt
│ ├── r55_10.pdbqt
│ ├── r56_01.pdbqt
│ ├── r56_02.pdbqt
│ ├── r56_03.pdbqt
│ ├── r56_04.pdbqt
│ ├── r56_05.pdbqt
│ ├── r56_06.pdbqt
│ ├── r56_07.pdbqt
│ ├── r56_08.pdbqt
│ ├── r56_09.pdbqt
│ └── r56_10.pdbqt
└── t6.py
THANKS IN ADVANCE!!