{"action":"opened","number":1,"pull_request":{"url":"https://api.github.com/repos/arose/nglview/pulls/1","id":51579519,"html_url":"https://github.com/arose/nglview/pull/1","diff_url":"https://github.com/arose/nglview/pull/1.diff","patch_url":"https://github.com/arose/nglview/pull/1.patch","issue_url":"https://api.github.com/repos/arose/nglview/issues/1","number":1,"state":"open","locked":false,"title":"Simple api","user":{"login":"hainm","id":4451957,"avatar_url":"https://avatars.githubusercontent.com/u/4451957?v=3","gravatar_id":"","url":"https://api.github.com/users/hainm","html_url":"https://github.com/hainm","followers_url":"https://api.github.com/users/hainm/followers","following_url":"https://api.github.com/users/hainm/following{/other_user}","gists_url":"https://api.github.com/users/hainm/gists{/gist_id}","starred_url":"https://api.github.com/users/hainm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hainm/subscriptions","organizations_url":"https://api.github.com/users/hainm/orgs","repos_url":"https://api.github.com/users/hainm/repos","events_url":"https://api.github.com/users/hainm/events{/privacy}","received_events_url":"https://api.github.com/users/hainm/received_events","type":"User","site_admin":false},"body":"This is not a real PR, just want to show my proposal here.\r\n\r\nAll I want is to create a simple Trajectory class so user (developer) can easily plug to. \r\n\r\n- Example from pytraj\r\n\r\n```python\r\nimport pytraj as pt\r\nimport nglview as nv\r\n\r\ntraj = pt.fetch_pdb('1l2y')\r\ntraj[:1].save('test.pdb')\r\n\r\nstructure = nv.load_file('test.pdb')\r\n\r\ntraj = nv.Trajectory(xyz=traj.xyz, topology=structure)\r\n\r\nv = nv.TrajectoryViewer(traj)\r\nv\r\n```\r\n\r\n- Example from mdtraj\r\n\r\n```python\r\nimport mdtraj as md\r\nimport nglview as nv\r\n\r\ntraj = md.load('file.nc', 'file.gro')\r\ntraj[0].save_pdb('test.pdb')\r\n\r\nstructure = nv.load_file('test.pdb')\r\n\r\ntraj = nv.Trajectory(xyz=traj.xyz, topology=structure)\r\n\r\nv = nv.TrajectoryViewer(traj)\r\nv\r\n```\r\n\r\n`nglview.Trajectory` just need to have `xyz` attribute with its topology  (currently I took Structure in nglview).\r\n\r\nFor structure (or Topology), I think we can use the approach from chemview (Topology is a dict)\r\n\r\n\r\n```python\r\ndef to_chemview(traj):\r\n    import pytraj as pt\r\n    top = {}\r\n    top['atom_types'] = [a.element[1] for a in traj.topology.atoms]\r\n    top['atom_names'] = [a.name for a in traj.topology.atoms]\r\n    top['bonds'] = traj.topology.bond_indices\r\n    top['residue_types'] = [r.name for r in traj.topology.residues]\r\n    top['residue_indices'] = [\r\n        list(range(r.first_atom_index, r.last_atom_index))\r\n        for r in traj.topology.residues\r\n    ]\r\n\r\n    return top\r\n```","created_at":"2015-11-23T21:01:34Z","updated_at":"2015-11-23T21:01:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/arose/nglview/pulls/1/commits","review_comments_url":"https://api.github.com/repos/arose/nglview/pulls/1/comments","review_comment_url":"https://api.github.com/repos/arose/nglview/pulls/comments{/number}","comments_url":"https://api.github.com/repos/arose/nglview/issues/1/comments","statuses_url":"https://api.github.com/repos/arose/nglview/statuses/d53f1cc5f8b450013fbb3c2bb617d798bb112ae6","head":{"label":"hainm:simple_api","ref":"simple_api","sha":"d53f1cc5f8b450013fbb3c2bb617d798bb112ae6","user":{"login":"hainm","id":4451957,"avatar_url":"https://avatars.githubusercontent.com/u/4451957?v=3","gravatar_id":"","url":"https://api.github.com/users/hainm","html_url":"https://github.com/hainm","followers_url":"https://api.github.com/users/hainm/followers","following_url":"https://api.github.com/users/hainm/following{/other_user}","gists_url":"https://api.github.com/users/hainm/gists{/gist_id}","starred_url":"https://api.github.com/users/hainm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hainm/subscriptions","organizations_url":"https://api.github.com/users/hainm/orgs","repos_url":"https://api.github.com/users/hainm/repos","events_url":"https://api.github.com/users/hainm/events{/privacy}","received_events_url":"https://api.github.com/users/hainm/received_events","type":"User","site_admin":false},"repo":{"id":46449611,"name":"nglview","full_name":"hainm/nglview","owner":{"login":"hainm","id":4451957,"avatar_url":"https://avatars.githubusercontent.com/u/4451957?v=3","gravatar_id":"","url":"https://api.github.com/users/hainm","html_url":"https://github.com/hainm","followers_url":"https://api.github.com/users/hainm/followers","following_url":"https://api.github.com/users/hainm/following{/other_user}","gists_url":"https://api.github.com/users/hainm/gists{/gist_id}","starred_url":"https://api.github.com/users/hainm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hainm/subscriptions","organizations_url":"https://api.github.com/users/hainm/orgs","repos_url":"https://api.github.com/users/hainm/repos","events_url":"https://api.github.com/users/hainm/events{/privacy}","received_events_url":"https://api.github.com/users/hainm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hainm/nglview","description":"IPython widget to interactively view molecular structures and trajectories","fork":true,"url":"https://api.github.com/repos/hainm/nglview","forks_url":"https://api.github.com/repos/hainm/nglview/forks","keys_url":"https://api.github.com/repos/hainm/nglview/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hainm/nglview/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hainm/nglview/teams","hooks_url":"https://api.github.com/repos/hainm/nglview/hooks","issue_events_url":"https://api.github.com/repos/hainm/nglview/issues/events{/number}","events_url":"https://api.github.com/repos/hainm/nglview/events","assignees_url":"https://api.github.com/repos/hainm/nglview/assignees{/user}","branches_url":"https://api.github.com/repos/hainm/nglview/branches{/branch}","tags_url":"https://api.github.com/repos/hainm/nglview/tags","blobs_url":"https://api.github.com/repos/hainm/nglview/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hainm/nglview/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hainm/nglview/git/refs{/sha}","trees_url":"https://api.github.com/repos/hainm/nglview/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hainm/nglview/statuses/{sha}","languages_url":"https://api.github.com/repos/hainm/nglview/languages","stargazers_url":"https://api.github.com/repos/hainm/nglview/stargazers","contributors_url":"https://api.github.com/repos/hainm/nglview/contributors","subscribers_url":"https://api.github.com/repos/hainm/nglview/subscribers","subscription_url":"https://api.github.com/repos/hainm/nglview/subscription","commits_url":"https://api.github.com/repos/hainm/nglview/commits{/sha}","git_commits_url":"https://api.github.com/repos/hainm/nglview/git/commits{/sha}","comments_url":"https://api.github.com/repos/hainm/nglview/comments{/number}","issue_comment_url":"https://api.github.com/repos/hainm/nglview/issues/comments{/number}","contents_url":"https://api.github.com/repos/hainm/nglview/contents/{+path}","compare_url":"https://api.github.com/repos/hainm/nglview/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hainm/nglview/merges","archive_url":"https://api.github.com/repos/hainm/nglview/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hainm/nglview/downloads","issues_url":"https://api.github.com/repos/hainm/nglview/issues{/number}","pulls_url":"https://api.github.com/repos/hainm/nglview/pulls{/number}","milestones_url":"https://api.github.com/repos/hainm/nglview/milestones{/number}","notifications_url":"https://api.github.com/repos/hainm/nglview/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hainm/nglview/labels{/name}","releases_url":"https://api.github.com/repos/hainm/nglview/releases{/id}","created_at":"2015-11-18T21:47:56Z","updated_at":"2015-11-18T21:47:57Z","pushed_at":"2015-11-23T20:06:30Z","git_url":"git://github.com/hainm/nglview.git","ssh_url":"git@github.com:hainm/nglview.git","clone_url":"https://github.com/hainm/nglview.git","svn_url":"https://github.com/hainm/nglview","homepage":null,"size":4508,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"arose:master","ref":"master","sha":"570b4505adafd5f6c0480406f8de1c115cb87949","user":{"login":"arose","id":272250,"avatar_url":"https://avatars.githubusercontent.com/u/272250?v=3","gravatar_id":"","url":"https://api.github.com/users/arose","html_url":"https://github.com/arose","followers_url":"https://api.github.com/users/arose/followers","following_url":"https://api.github.com/users/arose/following{/other_user}","gists_url":"https://api.github.com/users/arose/gists{/gist_id}","starred_url":"https://api.github.com/users/arose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arose/subscriptions","organizations_url":"https://api.github.com/users/arose/orgs","repos_url":"https://api.github.com/users/arose/repos","events_url":"https://api.github.com/users/arose/events{/privacy}","received_events_url":"https://api.github.com/users/arose/received_events","type":"User","site_admin":false},"repo":{"id":45852176,"name":"nglview","full_name":"arose/nglview","owner":{"login":"arose","id":272250,"avatar_url":"https://avatars.githubusercontent.com/u/272250?v=3","gravatar_id":"","url":"https://api.github.com/users/arose","html_url":"https://github.com/arose","followers_url":"https://api.github.com/users/arose/followers","following_url":"https://api.github.com/users/arose/following{/other_user}","gists_url":"https://api.github.com/users/arose/gists{/gist_id}","starred_url":"https://api.github.com/users/arose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arose/subscriptions","organizations_url":"https://api.github.com/users/arose/orgs","repos_url":"https://api.github.com/users/arose/repos","events_url":"https://api.github.com/users/arose/events{/privacy}","received_events_url":"https://api.github.com/users/arose/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arose/nglview","description":"IPython widget to interactively view molecular structures and trajectories","fork":false,"url":"https://api.github.com/repos/arose/nglview","forks_url":"https://api.github.com/repos/arose/nglview/forks","keys_url":"https://api.github.com/repos/arose/nglview/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arose/nglview/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arose/nglview/teams","hooks_url":"https://api.github.com/repos/arose/nglview/hooks","issue_events_url":"https://api.github.com/repos/arose/nglview/issues/events{/number}","events_url":"https://api.github.com/repos/arose/nglview/events","assignees_url":"https://api.github.com/repos/arose/nglview/assignees{/user}","branches_url":"https://api.github.com/repos/arose/nglview/branches{/branch}","tags_url":"https://api.github.com/repos/arose/nglview/tags","blobs_url":"https://api.github.com/repos/arose/nglview/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arose/nglview/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arose/nglview/git/refs{/sha}","trees_url":"https://api.github.com/repos/arose/nglview/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arose/nglview/statuses/{sha}","languages_url":"https://api.github.com/repos/arose/nglview/languages","stargazers_url":"https://api.github.com/repos/arose/nglview/stargazers","contributors_url":"https://api.github.com/repos/arose/nglview/contributors","subscribers_url":"https://api.github.com/repos/arose/nglview/subscribers","subscription_url":"https://api.github.com/repos/arose/nglview/subscription","commits_url":"https://api.github.com/repos/arose/nglview/commits{/sha}","git_commits_url":"https://api.github.com/repos/arose/nglview/git/commits{/sha}","comments_url":"https://api.github.com/repos/arose/nglview/comments{/number}","issue_comment_url":"https://api.github.com/repos/arose/nglview/issues/comments{/number}","contents_url":"https://api.github.com/repos/arose/nglview/contents/{+path}","compare_url":"https://api.github.com/repos/arose/nglview/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arose/nglview/merges","archive_url":"https://api.github.com/repos/arose/nglview/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arose/nglview/downloads","issues_url":"https://api.github.com/repos/arose/nglview/issues{/number}","pulls_url":"https://api.github.com/repos/arose/nglview/pulls{/number}","milestones_url":"https://api.github.com/repos/arose/nglview/milestones{/number}","notifications_url":"https://api.github.com/repos/arose/nglview/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arose/nglview/labels{/name}","releases_url":"https://api.github.com/repos/arose/nglview/releases{/id}","created_at":"2015-11-09T16:48:57Z","updated_at":"2015-11-18T21:47:09Z","pushed_at":"2015-11-23T14:19:58Z","git_url":"git://github.com/arose/nglview.git","ssh_url":"git@github.com:arose/nglview.git","clone_url":"https://github.com/arose/nglview.git","svn_url":"https://github.com/arose/nglview","homepage":null,"size":4491,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/arose/nglview/pulls/1"},"html":{"href":"https://github.com/arose/nglview/pull/1"},"issue":{"href":"https://api.github.com/repos/arose/nglview/issues/1"},"comments":{"href":"https://api.github.com/repos/arose/nglview/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/arose/nglview/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/arose/nglview/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/arose/nglview/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/arose/nglview/statuses/d53f1cc5f8b450013fbb3c2bb617d798bb112ae6"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":7,"additions":77,"deletions":91,"changed_files":1}}