import mdtraj as md
import numpy as np
'''
Render a picture of lysozyme protein with nglview
1. import packages
2. Download 1GWD protein
3. Render it
4. Embed in jupyter notebook
'''
import mdtraj as md
import numpy as np
'''
Render a picture of lysozyme protein with nglview
1. import packages
2. Download 1GWD protein
3. Render it
4. Embed in jupyter notebook
'''
# 1. import packages
import nglview as nv
import mdtraj as md
import numpy as np
# 2. Download 1GWD protein
traj = md.load('1GWD.pdb')
# 3. Render it
view = nv.show_mdtraj(traj)
# 4. Embed in jupyter notebook
view.add_representation('cartoon', selection='protein')
view.add_representation('ball+stick', selection='not protein')
view
# 5. Save the picture
view.png()
# 6. Save the picture with a specific size
view.png(size=(600, 600))
# 7. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 8. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 9. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 10. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 11. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 12. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 13. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 14. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 15. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 16. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 17. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 18. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 19. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 20. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 21. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 22. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 23. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 24. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 25. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 26. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 27. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 28. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 29. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 30. Save the picture with a specific size and transparent background
view.png(size=(600, 600), transparent=True)
# 31. Save the picture with a specific size and transparent background
No such file: 1GWD.pdb
Go to Google Form