Skip to content

Commit 426d63b

Browse files
committed
Adds support for local files, resolves #1
1 parent 2d54391 commit 426d63b

File tree

11 files changed

+254
-37
lines changed

11 files changed

+254
-37
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
All notable changes to the "protein-viewer" extension will be documented in this file.
44

5-
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
5+
## 1.0.1
66

7-
## [Unreleased]
7+
* Adds Right-click open from context menu
8+
* Enables opening of multiple panels
9+
* Adds PDB name to panel
810

9-
- Initial release
11+
## 1.0.0
12+
13+
Initial release!

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2017 - now, Arian Jamasb
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1-
<img src="img/logo.png" alt="drawing" width="200"/>
2-
31
# VSCoding-Sequence
42

3+
<img src="img/logo.png" alt="drawing" width="200"/>
4+
55
VSCoding Sequence allows for visualisation of protein structures in the editor, courtesy of the fantastic [Mol*](https://molstar.org/)
66

77
## Features
8-
![](img/usage.gif)
98

10-
Simply call the Start Protein Viewer command, enter a PDB accession code & away you go!
9+
### Loading a Structure from the PDB
10+
11+
![Usage gif](img/usage.gif)
12+
13+
Simply call the `Start Protein Viewer command`, enter a PDB accession code & away you go!
14+
15+
### Loading a Local File
16+
17+
![Local file usage gif](img/local_file.gif)
18+
19+
Right-click on the `.pdb` file in the file editor and select `Launch Protein Viewer from File`
20+
21+
### 1.0.1
22+
23+
* Adds Right-click open from context menu
24+
* Enables opening of multiple panels
25+
* Adds PDB name to panel
26+
1127
### 1.0.0
1228

1329
Initial release!

img/local_file.gif

9.46 MB
Loading

out/extension.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/extension.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/panels/ProteinViewerPanel.js

Lines changed: 78 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/panels/ProteinViewerPanel.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,49 @@
22
"name": "protein-viewer",
33
"displayName": "Protein Viewer",
44
"description": "",
5-
"version": "0.0.1",
5+
"version": "0.0.2",
6+
"publisher": "ArianJamasb",
7+
"author": {
8+
"name": "Arian Jamasb"
9+
},
10+
"icon": "img/logo.png",
611
"engines": {
712
"vscode": "^1.62.0"
813
},
14+
"repository": {
15+
"type": "git",
16+
"url": "https://github.com/a-r-j/vscoding-sequence.git"
17+
},
18+
"license": "MIT",
919
"categories": [
10-
"Other"
20+
"Other",
21+
"Visualization",
22+
"Data Science"
1123
],
1224
"activationEvents": [
13-
"onCommand:protein-viewer.start"
25+
"onCommand:protein-viewer.start",
26+
"onCommand:protein-viewer.activateFromFile"
1427
],
1528
"main": "./out/extension.js",
1629
"contributes": {
1730
"commands": [
1831
{
1932
"command": "protein-viewer.start",
2033
"title": "Start Protein Viewer"
34+
},
35+
{
36+
"command": "protein-viewer.activateFromFile",
37+
"title": "Launch Protein Viewer from File"
2138
}
22-
]
23-
},
39+
],
40+
"menus": {
41+
"explorer/context": [{
42+
"when": "resourceExtname == .pdb",
43+
"command": "protein-viewer.activateFromFile",
44+
"group": "navigation"
45+
}]
46+
}
47+
},
2448
"scripts": {
2549
"vscode:prepublish": "npm run compile",
2650
"compile": "tsc -p ./",

src/extension.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,25 @@
22
// Import the module and reference it with the alias vscode in your code below
33
import * as vscode from 'vscode';
44
import { ProteinViewerPanel } from "./panels/ProteinViewerPanel";
5+
import * as fs from 'fs';
56

67
export function activate(context: vscode.ExtensionContext) {
8+
79
const helloCommand = vscode.commands.registerCommand("protein-viewer.start", () => {
810
showInputBox().then((accession) => {
911
console.log(accession);
1012
ProteinViewerPanel.render(context.extensionUri, accession);
1113
});
1214
});
15+
16+
const activateFromFile = vscode.commands.registerCommand("protein-viewer.activateFromFile", (file_uri: vscode.Uri) => {
17+
ProteinViewerPanel.renderFromFile(context.extensionUri, file_uri);
18+
});
19+
20+
//context.subscriptions.push(...[helloCommand, activateFromFile]);
1321
context.subscriptions.push(helloCommand);
14-
}
22+
context.subscriptions.push(activateFromFile);
23+
}
1524

1625
// this method is called when your extension is deactivated
1726
// export function deactivate() {}
@@ -22,4 +31,4 @@ async function showInputBox() {
2231
placeHolder: 'Enter a PDB accession',
2332
});
2433
return accession;
25-
}
34+
}

0 commit comments

Comments
 (0)