Open WeibinRen opened 3 months ago
I solved this by re-write split
function:
def split(s):
s_list = s.split()
idx = 0
while idx < len(s_list):
item = s_list[idx]
if '-' in item[1:]:
index_minus = item.find('-', 1)
s_list[idx] = item[:index_minus]
s_list.insert(idx+1, item[index_minus:])
idx = 0
else:
idx += 1
return s_list
There should be some better way, I put the code here just hope this can help somebody in case they need this.
Also line 1309 seem not 100% correct to use ==10
Hi, can you rewrite using a fixed string length like said at PDB ATOM record and submit as a pull request?
rec[31:39]
, rec[39:47]
...
I don't know how to test this plugin. If you rewrite like I said, i'll accept as is.
See line 1392 as example,
atom._coords = [ [ float(rec[5]), float(rec[6]), float(rec[7]) ] ]
therec
here comes from line 1308:rec = split(rec)
Sometimes protein PDB file content looks like(protein 2p7a from PDBBind database):ATOM 406 O ASP A 259 66.586 -29.223-100.911 1.00 14.83 O
If directly usestring.split()
here, the number -29.223-100.911 will not be split correctly. It will raise error like:ValueError: could not convert string to float: '-29.223-100.911'