| View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0016004 | VTK | (No Category) | public | 2016-02-18 08:53 | 2016-07-07 16:52 | ||||
| Reporter | Dmitry Kuznetsov | ||||||||
| Assigned To | Utkarsh Ayachit | ||||||||
| Priority | normal | Severity | minor | Reproducibility | have not tried | ||||
| Status | closed | Resolution | fixed | ||||||
| Platform | OS | OS Version | |||||||
| Product Version | 6.3.0 | ||||||||
| Target Version | Fixed in Version | ||||||||
| Summary | 0016004: PDB reader has been broken | ||||||||
| Description | PDBReader (ATOM and HETATM) has broken. Format for ATOM and HETATM: |--------------------------------------------------------------------------------| |COLUMNS DATA TYPE CONTENTS | |--------------------------------------------------------------------------------| | 1 - 6 Record name "ATOM " | | | | 7 - 11 Integer Atom serial number. | | | |13 - 16 Atom Atom name. | | | |17 Character Alternate location indicator. | | | |18 - 20 Residue name Residue name. | | | |22 Character Chain identifier. | | | |23 - 26 Integer Residue sequence number. | | | |27 AChar Code for insertion of residues. | | | |31 - 38 Real(8.3) Orthogonal coordinates for X in Angstroms. | | | |39 - 46 Real(8.3) Orthogonal coordinates for Y in Angstroms. | | | |47 - 54 Real(8.3) Orthogonal coordinates for Z in Angstroms. | | | |55 - 60 Real(6.2) Occupancy. | | | |61 - 66 Real(6.2) Temperature factor (Default = 0.0). | | | |73 - 76 LString(4) Segment identifier, left-justified. | | | |77 - 78 LString(2) Element symbol, right-justified. | | | |79 - 80 LString(2) Charge on the atom. | |________________________________________________________________________________| We have got a input file: 1 2 3 4 5 6 7 8 12345678901234567890123456789012345678901234567890123456789012345678901234567890 ATOM 1 HN1 THR 1 17.017 14.972 4.068 ATOM 2 HN2 THR 1 16.297 13.912 2.883 ATOM 3 N THR 1 16.982 14.095 3.587 ATOM 4 HN3 THR 1 17.707 14.470 3.008 ATOM 5 CA THR 1 16.949 12.808 4.348 ATOM 6 C THR 1 15.686 12.779 5.142 ATOM 7 O THR 1 15.236 13.827 5.603 ATOM 8 CB THR 1 18.140 12.771 5.349 ATOM 9 OG1 THR 1 19.304 12.851 4.478 ATOM 10 CG2 THR 1 18.163 11.585 6.283 ATOM 11 HOG THR 1 19.613 13.651 4.993 In vtkPDBReader.cxx: ... line 65: while(fgets(linebuf, sizeof linebuf, fp) != NULL && line 66: strncmp("END", linebuf, 3)) line 67: { line 69: char elem[3] = { 0 }; line 70: char c[7] = { 0 }; line 71: sscanf(&linebuf[0],"%6s", c); line 72: std::string command = c; line 73: StdStringToUpper(command); line 74: line 75: if (command == "ATOM" || command == "HETATM") line 76: { line 77: sscanf(&linebuf[12], "%4s", dum1); line 78: sscanf(&linebuf[17], "%3s", dum2); line 79: chain = linebuf[21]; line 80: sscanf(&linebuf[22], "%d", &resi); line 81: sscanf(&linebuf[30],"%8f%8f%8f", x, x+1, x+2); line 82: sscanf(&linebuf[76], "%2s", elem); line 83: line 84: if (elem[0] == '\0') line 85: { line 86: strncpy(elem, dum1, 2); line 87: } line 88: line 89: if (!((elem[0]=='H' || elem[0]=='h') && elem[1]=='\0')) ... On line 82, read the "Element symbol" than on the line 84 "elem[0] == '\0'". But in our case, "elem" has a garbage value. Maybe add check for attributes (55 >)? ... line 82: if (strlen(linebuf) > 55) line 83: sscanf(&linebuf[76], "%2s", elem); ... Patch file attached. | ||||||||
| Tags | No tags attached. | ||||||||
| Project | TBD | ||||||||
| Type | incorrect functionality | ||||||||
| Attached Files | |||||||||
| Relationships | |
| Relationships |
| Notes | |
|
(0035749) Dmitry Kuznetsov (reporter) 2016-02-18 08:57 edited on: 2016-02-18 08:59 |
Message text was broken PDBReader (ATOM and HETATM) has been broken. Format for ATOM and HETATM: |--------------------------------------------------------------------------------| |COLUMNS DATA TYPE CONTENTS | |--------------------------------------------------------------------------------| | 1 - 6 Record name "ATOM " | | | | 7 - 11 Integer Atom serial number. | | | |13 - 16 Atom Atom name. | | | |17 Character Alternate location indicator. | | | |18 - 20 Residue name Residue name. | | | |22 Character Chain identifier. | | | |23 - 26 Integer Residue sequence number. | | | |27 AChar Code for insertion of residues. | | | |31 - 38 Real(8.3) Orthogonal coordinates for X in Angstroms. | | | |39 - 46 Real(8.3) Orthogonal coordinates for Y in Angstroms. | | | |47 - 54 Real(8.3) Orthogonal coordinates for Z in Angstroms. | | | |55 - 60 Real(6.2) Occupancy. | | | |61 - 66 Real(6.2) Temperature factor (Default = 0.0). | | | |73 - 76 LString(4) Segment identifier, left-justified. | | | |77 - 78 LString(2) Element symbol, right-justified. | | | |79 - 80 LString(2) Charge on the atom. | |________________________________________________________________________________| We have got a input file:
1 2 3 4 5 6 7 8
12345678901234567890123456789012345678901234567890123456789012345678901234567890
ATOM 1 HN1 THR 1 17.017 14.972 4.068
ATOM 2 HN2 THR 1 16.297 13.912 2.883
ATOM 3 N THR 1 16.982 14.095 3.587
ATOM 4 HN3 THR 1 17.707 14.470 3.008
ATOM 5 CA THR 1 16.949 12.808 4.348
ATOM 6 C THR 1 15.686 12.779 5.142
ATOM 7 O THR 1 15.236 13.827 5.603
ATOM 8 CB THR 1 18.140 12.771 5.349
ATOM 9 OG1 THR 1 19.304 12.851 4.478
ATOM 10 CG2 THR 1 18.163 11.585 6.283
ATOM 11 HOG THR 1 19.613 13.651 4.993
In vtkPDBReader.cxx:
...
line 65: while(fgets(linebuf, sizeof linebuf, fp) != NULL &&
line 66: strncmp("END", linebuf, 3))
line 67: {
line 69: char elem[3] = { 0 };
line 70: char c[7] = { 0 };
line 71: sscanf(&linebuf[0],"%6s", c);
line 72: std::string command = c;
line 73: StdStringToUpper(command);
line 74:
line 75: if (command == "ATOM" || command == "HETATM")
line 76: {
line 77: sscanf(&linebuf[12], "%4s", dum1);
line 78: sscanf(&linebuf[17], "%3s", dum2);
line 79: chain = linebuf[21];
line 80: sscanf(&linebuf[22], "%d", &resi);
line 81: sscanf(&linebuf[30],"%8f%8f%8f", x, x+1, x+2);
line 82: sscanf(&linebuf[76], "%2s", elem);
line 83:
line 84: if (elem[0] == '\0')
line 85: {
line 86: strncpy(elem, dum1, 2);
line 87: }
line 88:
line 89: if (!((elem[0]=='H' || elem[0]=='h') && elem[1]=='\0'))
...
On line 82, read the "Element symbol" than on the line 84 "elem[0] == '\0'". But in our case, "elem" has a garbage value. Maybe add check for attributes (55 >)? ... line 82: if (strlen(linebuf) > 55) line 83: sscanf(&linebuf[76], "%2s", elem); ... |
|
(0036187) Utkarsh Ayachit (administrator) 2016-07-06 11:53 |
Fixed by: https://gitlab.kitware.com/vtk/vtk/merge_requests/1627 [^] |
| Notes |
| Issue History | |||
| Date Modified | Username | Field | Change |
| 2016-02-18 08:53 | Dmitry Kuznetsov | New Issue | |
| 2016-02-18 08:53 | Dmitry Kuznetsov | File Added: 0003-Fixed_atom_reader_for_PDB_format.patch | |
| 2016-02-18 08:57 | Dmitry Kuznetsov | Note Added: 0035749 | |
| 2016-02-18 08:59 | Dmitry Kuznetsov | Note Edited: 0035749 | |
| 2016-02-19 01:09 | Dmitry Kuznetsov | File Added: 0003-Fixed-atom-reader-for-PDB-format.patch | |
| 2016-07-06 10:43 | Utkarsh Ayachit | Assigned To | => Utkarsh Ayachit |
| 2016-07-06 11:53 | Utkarsh Ayachit | Note Added: 0036187 | |
| 2016-07-06 11:53 | Utkarsh Ayachit | Status | backlog => gerrit review |
| 2016-07-07 16:52 | Utkarsh Ayachit | Status | gerrit review => closed |
| 2016-07-07 16:52 | Utkarsh Ayachit | Resolution | open => fixed |
| Issue History |
| Copyright © 2000 - 2018 MantisBT Team |