Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
fc6f5a03
Unverified
Commit
fc6f5a03
authored
Apr 21, 2020
by
David Sehnal
Committed by
GitHub
Apr 21, 2020
Browse files
Options
Downloads
Plain Diff
Merge pull request #33 from corredD/forkdev
Forkdev
parents
f823a887
dd15a000
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/extensions/cellpack/data.ts
+1
-0
1 addition, 0 deletions
src/extensions/cellpack/data.ts
src/extensions/cellpack/model.ts
+20
-7
20 additions, 7 deletions
src/extensions/cellpack/model.ts
src/extensions/cellpack/util.ts
+5
-2
5 additions, 2 deletions
src/extensions/cellpack/util.ts
with
26 additions
and
9 deletions
src/extensions/cellpack/data.ts
+
1
−
0
View file @
fc6f5a03
...
...
@@ -65,6 +65,7 @@ export interface Ingredient {
principalAxis
?:
Vec3
;
/** offset along membrane */
offset
?:
Vec3
;
ingtype
?:
string
;
}
export
interface
IngredientSource
{
...
...
This diff is collapsed.
Click to expand it.
src/extensions/cellpack/model.ts
+
20
−
7
View file @
fc6f5a03
...
...
@@ -9,7 +9,7 @@ import { PluginContext } from '../../mol-plugin/context';
import
{
PluginStateObject
as
PSO
}
from
'
../../mol-plugin-state/objects
'
;
import
{
ParamDefinition
as
PD
}
from
'
../../mol-util/param-definition
'
;
import
{
Ingredient
,
IngredientSource
,
CellPacking
}
from
'
./data
'
;
import
{
getFromPdb
,
getFromCellPackDB
,
IngredientFiles
,
parseCif
,
parsePDBfile
,
getStructureMean
}
from
'
./util
'
;
import
{
getFromPdb
,
getFromCellPackDB
,
IngredientFiles
,
parseCif
,
parsePDBfile
,
getStructureMean
,
getFromOPM
}
from
'
./util
'
;
import
{
Model
,
Structure
,
StructureSymmetry
,
StructureSelection
,
QueryContext
,
Unit
}
from
'
../../mol-model/structure
'
;
import
{
trajectoryFromMmCIF
,
MmcifFormat
}
from
'
../../mol-model-formats/structure/mmcif
'
;
import
{
trajectoryFromPDB
}
from
'
../../mol-model-formats/structure/pdb
'
;
...
...
@@ -32,7 +32,9 @@ function getCellPackModelUrl(fileName: string, baseUrl: string) {
return
`
${
baseUrl
}
/results/
${
fileName
}
`
;
}
async
function
getModel
(
assetManager
:
AssetManager
,
id
:
string
,
model_id
:
number
,
baseUrl
:
string
,
file
?:
Asset
.
File
)
{
async
function
getModel
(
assetManager
:
AssetManager
,
id
:
string
,
ingredient
:
Ingredient
,
baseUrl
:
string
,
file
?:
Asset
.
File
)
{
const
model_id
=
(
ingredient
.
source
.
model
)
?
parseInt
(
ingredient
.
source
.
model
)
:
0
;
const
surface
=
(
ingredient
.
ingtype
)
?
(
ingredient
.
ingtype
===
'
transmembrane
'
)
:
false
;
let
model
:
Model
;
let
assets
:
Asset
.
Wrapper
[]
=
[];
if
(
file
)
{
...
...
@@ -55,9 +57,21 @@ async function getModel(assetManager: AssetManager, id: string, model_id: number
throw
new
Error
(
`unsupported file type '
${
file
.
name
}
'`
);
}
}
else
if
(
id
.
match
(
/^
[
1-9
][
a-zA-Z0-9
]{3,3}
$/i
))
{
if
(
surface
){
const
data
=
await
getFromOPM
(
id
,
assetManager
);
if
(
data
.
asset
){
assets
.
push
(
data
.
asset
);
model
=
(
await
trajectoryFromPDB
(
data
.
pdb
).
run
())[
model_id
];
}
else
{
const
{
mmcif
,
asset
}
=
await
getFromPdb
(
id
,
assetManager
);
assets
.
push
(
asset
);
model
=
(
await
trajectoryFromMmCIF
(
mmcif
).
run
())[
model_id
];
}
}
else
{
const
{
mmcif
,
asset
}
=
await
getFromPdb
(
id
,
assetManager
);
assets
.
push
(
asset
);
model
=
(
await
trajectoryFromMmCIF
(
mmcif
).
run
())[
model_id
];
}
}
else
{
const
data
=
await
getFromCellPackDB
(
id
,
baseUrl
,
assetManager
);
assets
.
push
(
data
.
asset
);
...
...
@@ -288,8 +302,7 @@ async function getIngredientStructure(assetManager: AssetManager, ingredient: In
}
// model id in case structure is NMR
const
model_id
=
(
ingredient
.
source
.
model
)
?
parseInt
(
ingredient
.
source
.
model
)
:
0
;
const
{
model
,
assets
}
=
await
getModel
(
assetManager
,
source
.
pdb
||
name
,
model_id
,
baseUrl
,
file
);
const
{
model
,
assets
}
=
await
getModel
(
assetManager
,
source
.
pdb
||
name
,
ingredient
,
baseUrl
,
file
);
if
(
!
model
)
return
;
let
structure
:
Structure
;
...
...
This diff is collapsed.
Click to expand it.
src/extensions/cellpack/util.ts
+
5
−
2
View file @
fc6f5a03
...
...
@@ -40,6 +40,11 @@ export async function getFromPdb(pdbId: string, assetManager: AssetManager) {
return
{
mmcif
:
cif
.
blocks
[
0
],
asset
};
}
export
async
function
getFromOPM
(
pdbId
:
string
,
assetManager
:
AssetManager
){
const
asset
=
await
assetManager
.
resolve
(
Asset
.
getUrlAsset
(
assetManager
,
`https://opm-assets.storage.googleapis.com/pdb/
${
pdbId
.
toLowerCase
()}
.pdb`
),
'
string
'
).
run
();
return
{
pdb
:
await
parsePDBfile
(
asset
.
data
,
pdbId
),
asset
};
}
export
async
function
getFromCellPackDB
(
id
:
string
,
baseUrl
:
string
,
assetManager
:
AssetManager
)
{
if
(
id
.
toLowerCase
().
endsWith
(
'
.cif
'
)
||
id
.
toLowerCase
().
endsWith
(
'
.bcif
'
))
{
const
isBinary
=
id
.
toLowerCase
().
endsWith
(
'
.bcif
'
);
...
...
@@ -53,8 +58,6 @@ export async function getFromCellPackDB(id: string, baseUrl: string, assetManage
export
type
IngredientFiles
=
{
[
name
:
string
]:
Asset
.
File
}
//
export
function
getStructureMean
(
structure
:
Structure
)
{
let
xSum
=
0
,
ySum
=
0
,
zSum
=
0
;
for
(
let
i
=
0
,
il
=
structure
.
units
.
length
;
i
<
il
;
++
i
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment