Hi Xiang-Jun,
A new "nt_resi" field with the residue number as below would help:
"nts": [
{
"index": 1,
"index_chain": 1,
"chain_name": "A",
"nt_resi": 2,
"nt_name": "DG",
"nt_code": "G",
"nt_id": "A.DG2",
...
}]
This would allow to extract all the essential data with the same block of code. I did not know about the --idstr option which changes the nt_id field to ".A.DG.2.". This one makes pattern matching a safe bet and works as well, but needs a little extra code. So, if you think it is not worth the effort to add an "nt_resi" field, do not worry about it.
Best regards,
Markus