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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
b90480cb
"src/mol-plugin/git@gitlab.cesnet.cz:madcatxster/molstar.git" did not exist on "5e309c1b87813ff4201735c5e72d288f04067166"
Commit
b90480cb
authored
7 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
sync/await for file reading
parent
858e6640
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package.json
+2
-1
2 additions, 1 deletion
package.json
src/script.ts
+22
-35
22 additions, 35 deletions
src/script.ts
with
24 additions
and
36 deletions
package.json
+
2
−
1
View file @
b90480cb
...
@@ -42,7 +42,8 @@
...
@@ -42,7 +42,8 @@
"
ts-jest
"
:
"
^21.1.2
"
,
"
ts-jest
"
:
"
^21.1.2
"
,
"
tslint
"
:
"
^5.7.0
"
,
"
tslint
"
:
"
^5.7.0
"
,
"
typescript
"
:
"
^2.5.3
"
,
"
typescript
"
:
"
^2.5.3
"
,
"
uglify-js
"
:
"
^3.1.3
"
"
uglify-js
"
:
"
^3.1.3
"
,
"
util.promisify
"
:
"
^1.0.0
"
},
},
"dependencies"
:
{}
"dependencies"
:
{}
}
}
This diff is collapsed.
Click to expand it.
src/script.ts
+
22
−
35
View file @
b90480cb
...
@@ -8,6 +8,9 @@
...
@@ -8,6 +8,9 @@
import
*
as
util
from
'
util
'
import
*
as
util
from
'
util
'
import
*
as
fs
from
'
fs
'
import
*
as
fs
from
'
fs
'
require
(
'
util.promisify
'
).
shim
();
const
readFileAsync
=
util
.
promisify
(
fs
.
readFile
);
import
Gro
from
'
./reader/gro/parser
'
import
Gro
from
'
./reader/gro/parser
'
import
CIF
from
'
./reader/cif/index
'
import
CIF
from
'
./reader/cif/index
'
...
@@ -76,13 +79,9 @@ async function runGro(input: string) {
...
@@ -76,13 +79,9 @@ async function runGro(input: string) {
console
.
log
(
residueNumber
.
length
,
residueNumber
[
0
],
residueNumber
[
residueNumber
.
length
-
1
])
console
.
log
(
residueNumber
.
length
,
residueNumber
[
0
],
residueNumber
[
residueNumber
.
length
-
1
])
}
}
export
function
_gro
()
{
export
async
function
_gro
()
{
fs
.
readFile
(
`./examples/
${
file
}
`
,
'
utf8
'
,
function
(
err
,
input
)
{
const
input
=
await
readFileAsync
(
`./examples/
${
file
}
`
,
'
utf8
'
)
if
(
err
)
{
runGro
(
input
)
return
console
.
log
(
err
);
}
runGro
(
input
)
});
}
}
// _gro()
// _gro()
...
@@ -110,30 +109,22 @@ async function runCIF(input: string | Uint8Array) {
...
@@ -110,30 +109,22 @@ async function runCIF(input: string | Uint8Array) {
console
.
log
(
mmcif
.
pdbx_struct_oper_list
.
matrix
.
value
(
0
));
console
.
log
(
mmcif
.
pdbx_struct_oper_list
.
matrix
.
value
(
0
));
}
}
export
function
_cif
()
{
export
async
function
_cif
()
{
let
path
=
`./examples/1cbs_updated.cif`
;
let
path
=
`./examples/1cbs_updated.cif`
;
path
=
'
../test/3j3q.cif
'
// lets have a relative path for big test files
path
=
'
../test/3j3q.cif
'
// lets have a relative path for big test files
fs
.
readFile
(
path
,
'
utf8
'
,
function
(
err
,
input
)
{
const
input
=
await
readFileAsync
(
path
,
'
utf8
'
)
if
(
err
)
{
console
.
log
(
'
------------------
'
);
return
console
.
log
(
err
);
console
.
log
(
'
Text CIF:
'
);
}
runCIF
(
input
);
console
.
log
(
'
------------------
'
);
console
.
log
(
'
Text CIF:
'
);
runCIF
(
input
);
});
path
=
`./examples/1cbs_full.bcif`
;
path
=
`./examples/1cbs_full.bcif`
;
// const path = 'c:/test/quick/3j3q.cif';
// const path = 'c:/test/quick/3j3q.cif';
fs
.
readFile
(
path
,
function
(
err
,
input
)
{
const
input2
=
await
readFileAsync
(
path
)
if
(
err
)
{
console
.
log
(
'
------------------
'
);
return
console
.
log
(
err
);
console
.
log
(
'
BinaryCIF:
'
);
}
const
data
=
new
Uint8Array
(
input2
.
byteLength
);
console
.
log
(
'
------------------
'
);
for
(
let
i
=
0
;
i
<
input2
.
byteLength
;
i
++
)
data
[
i
]
=
input2
[
i
];
console
.
log
(
'
BinaryCIF:
'
);
runCIF
(
input2
);
const
data
=
new
Uint8Array
(
input
.
byteLength
);
for
(
let
i
=
0
;
i
<
input
.
byteLength
;
i
++
)
data
[
i
]
=
input
[
i
];
runCIF
(
input
);
});
}
}
// _cif();
// _cif();
...
@@ -155,16 +146,12 @@ async function runDic(input: string | Uint8Array) {
...
@@ -155,16 +146,12 @@ async function runDic(input: string | Uint8Array) {
// console.log(util.inspect(Object.keys(schema).length, {showHidden: false, depth: 1}))
// console.log(util.inspect(Object.keys(schema).length, {showHidden: false, depth: 1}))
}
}
export
function
_dic
()
{
export
async
function
_dic
()
{
let
path
=
'
./build/dics/mmcif_pdbx_v50.dic
'
let
path
=
'
./build/dics/mmcif_pdbx_v50.dic
'
fs
.
readFile
(
path
,
'
utf8
'
,
function
(
err
,
input
)
{
const
input
=
await
readFileAsync
(
path
,
'
utf8
'
)
if
(
err
)
{
console
.
log
(
'
------------------
'
);
return
console
.
log
(
err
);
console
.
log
(
'
Text DIC:
'
);
}
runDic
(
input
);
console
.
log
(
'
------------------
'
);
console
.
log
(
'
Text DIC:
'
);
runDic
(
input
);
});
}
}
_dic
();
_dic
();
...
...
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