Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #include <BALL/FORMAT/PDBFile.h>
  2. #include <BALL/KERNEL/system.h>
  3. #include <BALL/STRUCTURE/secondaryStructureProcessor.h>
  4. #include <BALL/VIEW/KERNEL/mainControl.h>
  5. #include <BALL/VIEW/WIDGETS/scene.h>
  6. #include <BALL/VIEW/MODELS/cartoonModel.h>
  7. #include <BALL/VIEW/MODELS/standardColorProcessor.h>
  8.  
  9. #include <QtGui/QApplication>
  10.  
  11. BALL::System* importPDBFile(const char* fileName)
  12. {
  13. BALL::System* system = new BALL::System();
  14.  
  15. BALL::PDBFile infile;
  16. infile.open(fileName);
  17. infile >> *system;
  18.  
  19. BALL::FragmentDB db("");
  20. system->apply(db.normalize_names);
  21. system->apply(db.build_bonds);
  22.  
  23. BALL::SecondaryStructureProcessor modProc;
  24. system->apply(modProc);
  25.  
  26. return system;
  27. }
  28.  
  29. void showPeptideRepresentation(BALL::System* system, BALL::VIEW::MainControl& control)
  30. {
  31. control.insert(*system, "PDB File", false);
  32.  
  33. auto* scene = new BALL::VIEW::Scene(&control);
  34. control.setCentralWidget(scene);
  35.  
  36. auto& repManager = control.getRepresentationManager();
  37. auto* rep = repManager.createRepresentation();
  38.  
  39. rep->setComposite(system);
  40. rep->setColorProcessor(new BALL::VIEW::SecondaryStructureColorProcessor());
  41. rep->setModelProcessor(new BALL::VIEW::AddCartoonModel());
  42.  
  43. control.update(*rep);
  44.  
  45. repManager.focusRepresentation(*rep);
  46. }
  47.  
  48. int main(int argc, char* argv[])
  49. {
  50. QApplication app(argc, argv);
  51. BALL::VIEW::MainControl control;
  52. control.registerThis();
  53.  
  54. showPeptideRepresentation(importPDBFile(argv[1]), control);
  55. control.show();
  56.  
  57. return app.exec();
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement