ProteinRibbonFilter

Hello! I have been using the vtkProteinRibbonFilter to render .pdb files. I managed for the visualization to work. A short snippet of what im doing:

    self._molecule_reader = vtk.vtkPDBReader()
    self._molecule_reader.SetFileName(file_path)
    self._molecule_filter = vtk.vtkProteinRibbonFilter()
    self._molecule_filter.SetInputConnection(self._molecule_reader.GetOutputPort())
    self._raw_polydata = self._molecule_filter.GetOutput()
    self._molecule_filter.Update()

I am managing to get the points by doing this:

point_coordinates = dsa.WrapDataObject(self._raw_polydata).Points

this returns a the xyz coordinates for each point in the molecule. However i am not being able to retrieve the remianing data in the pdb file, for example: Atom id, residue or atom name, aminoacid in which the atom is embedded. So to sum up i am failing to get all the remaining info in the pdb file apart from the coordinates. Can anyone shed some light into this? thank you!

Hello Facundo,

I hope you have already figured this out. If not, my colleague (@SunTzunami) and I managed to read the content of the PDBReader in the following way:

reader = vtk.vtkPDBReader()
reader.SetFileName(file_path)
polydata = reader.GetOutput()
reader.Update()

Then you could see the content of the polydata (e.g. print(polydata.GetPointData())) which will look like this:

vtkPointData (0x55fd420da540)
  Debug: Off
  Modified Time: 1364
  Reference Count: 2
  Registered Events: 
    Registered Observers:
      vtkObserver (0x55fd4215e330)
        Event: 33
        EventName: ModifiedEvent
        Command: 0x55fd42102b00
        Priority: 0
        Tag: 1
  Number Of Arrays: 10
  Array 0 name = atom_type
  Array 1 name = atom_types
  Array 2 name = residue
  Array 3 name = chain
  Array 4 name = secondary_structures
  Array 5 name = secondary_structures_begin
  Array 6 name = secondary_structures_end
  Array 7 name = ishetatm
  Array 8 name = rgb_colors
  Array 9 name = radius
  Number Of Components: 14
  Number Of Tuples: 458
  Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 1 1 1 )
  Interpolate Flags: ( 1 1 1 1 1 0 0 1 1 1 1 )
  Pass Through Flags: ( 1 1 1 1 1 1 1 1 1 1 1 )
  Scalars: 
    Debug: Off
    Modified Time: 1354
    Reference Count: 2
    Registered Events: (none)
    Name: rgb_colors
    Data type: unsigned char

Where, as you can see the names of the arrays match with the arrays used in the ProteinRibbonFilter (VTK/vtkProteinRibbonFilter.cxx at master · Kitware/VTK · GitHub).

Hope this helps.

1 Like