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
18ed7862
Commit
18ed7862
authored
7 years ago
by
Zepei Xu
Browse files
Options
Downloads
Patches
Plain Diff
move files to right place
parent
30f72c4d
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
src/mol-io/reader/_spec/mol2.spec.ts
+0
-0
0 additions, 0 deletions
src/mol-io/reader/_spec/mol2.spec.ts
src/mol-io/reader/mol2/parser.ts
+26
-26
26 additions, 26 deletions
src/mol-io/reader/mol2/parser.ts
with
26 additions
and
26 deletions
src/reader/spec/mol2.spec.ts
→
src/
mol-io/
reader/
_
spec/mol2.spec.ts
+
0
−
0
View file @
18ed7862
File moved
This diff is collapsed.
Click to expand it.
src/reader/mol2/parser.ts
→
src/
mol-io/
reader/mol2/parser.ts
+
26
−
26
View file @
18ed7862
...
...
@@ -4,12 +4,12 @@
// but not
// const undefPooledStr = UndefinedColumn(molecule.num_atoms, ColumnType.pooledStr);
// because latter actuall return a column of zeros
import
{
Column
}
from
'
mol-data/db
'
import
Tokenizer
from
'
../common/text/tokenizer
'
import
FixedColumn
from
'
../common/text/column/fixed
'
import
{
ColumnType
,
UndefinedColumn
}
from
'
../common/column
'
import
*
as
Schema
from
'
./schema
'
import
Result
from
'
../result
'
import
Computation
from
'
../../
util
s
/computation
'
import
Computation
from
'
mol-
util/computation
'
interface
State
{
tokenizer
:
Tokenizer
,
...
...
@@ -51,7 +51,7 @@ function State(tokenizer: Tokenizer, ctx: Computation.Context): State {
function
handleMolecule
(
state
:
State
)
{
const
{
tokenizer
,
molecule
}
=
state
;
Tokenizer
.
markLine
(
tokenizer
);
// skip the line '@<TRIPOS>MOLECULE'
Tokenizer
.
markLine
(
tokenizer
);
Tokenizer
.
markLine
(
tokenizer
);
let
name
=
Tokenizer
.
getTokenString
(
tokenizer
);
molecule
.
mol_name
=
name
;
...
...
@@ -111,29 +111,25 @@ async function handleAtoms(state: State): Promise<Schema.Atoms> {
}
const
col
=
FixedColumn
(
lines
);
const
undefInt
=
Undefined
Column
(
molecule
.
num_atoms
,
Column
Type
.
int
);
const
undefFloat
=
Undefined
Column
(
molecule
.
num_atoms
,
Column
Type
.
float
);
const
undefInt
=
Column
.
Undefined
(
molecule
.
num_atoms
,
Column
.
Schema
.
int
);
const
undefFloat
=
Column
.
Undefined
(
molecule
.
num_atoms
,
Column
.
Schema
.
float
);
//const undefPooledStr = UndefinedColumn(molecule.num_atoms, ColumnType.pooledStr);
// created below column to pass unit tests
const
undefStr
=
Undefined
Column
(
molecule
.
num_atoms
,
Column
Type
.
str
);
const
undefStr
=
Column
.
Undefined
(
molecule
.
num_atoms
,
Column
.
Schema
.
str
);
const
ret
=
{
count
:
molecule
.
num_atoms
,
atom_id
:
col
(
0
,
7
,
Column
Type
.
int
),
atom_name
:
col
(
7
,
9
,
Column
Type
.
pooledS
tr
),
x
:
col
(
16
,
10
,
Column
Type
.
float
),
y
:
col
(
26
,
10
,
Column
Type
.
float
),
z
:
col
(
36
,
10
,
Column
Type
.
float
),
atom_type
:
col
(
46
,
6
,
Column
Type
.
pooledS
tr
),
atom_id
:
col
(
0
,
7
,
Column
.
Schema
.
int
),
atom_name
:
col
(
7
,
9
,
Column
.
Schema
.
s
tr
),
x
:
col
(
16
,
10
,
Column
.
Schema
.
float
),
y
:
col
(
26
,
10
,
Column
.
Schema
.
float
),
z
:
col
(
36
,
10
,
Column
.
Schema
.
float
),
atom_type
:
col
(
46
,
6
,
Column
.
Schema
.
s
tr
),
// optional properties
subst_id
:
hasSubst_id
?
col
(
52
,
6
,
ColumnType
.
int
)
:
undefInt
,
subst_name
:
hasSubst_name
?
col
(
58
,
8
,
ColumnType
.
pooledStr
)
:
undefStr
,
charge
:
hasCharge
?
col
(
66
,
10
,
ColumnType
.
float
)
:
undefFloat
,
// undefPooledStr cannot pass unit tests because it create a column of zeros but not empty strings
//status_bit: hasStatus_bit ? col(76, 100, ColumnType.pooledStr) : undefPooledStr,
// use undefStr instead to pass unit tests
status_bit
:
hasStatus_bit
?
col
(
76
,
100
,
ColumnType
.
pooledStr
)
:
undefStr
,
subst_id
:
hasSubst_id
?
col
(
52
,
6
,
Column
.
Schema
.
int
)
:
undefInt
,
subst_name
:
hasSubst_name
?
col
(
58
,
8
,
Column
.
Schema
.
str
)
:
undefStr
,
charge
:
hasCharge
?
col
(
66
,
10
,
Column
.
Schema
.
float
)
:
undefFloat
,
status_bit
:
hasStatus_bit
?
col
(
76
,
100
,
Column
.
Schema
.
str
)
:
undefStr
,
};
...
...
@@ -160,18 +156,22 @@ async function handleBonds(state: State): Promise<Schema.Bonds> {
const
col
=
FixedColumn
(
lines
);
//const undefPooledStr = UndefinedColumn(molecule.num_bonds, ColumnType.pooledStr);
// created below column to pass unit tests
const
undefStr
=
UndefinedColumn
(
molecule
.
num_atoms
,
ColumnType
.
str
);
const
undefStr
=
Column
.
Undefined
(
molecule
.
num_atoms
,
Column
.
Schema
.
str
);
// if don't want to assume a fixed format, we can access a value of a column at a certain row by
// parse out the whole line at row x, then split the line, and return the yth value that is at the
// index of wanted value.
const
ret
=
{
count
:
molecule
.
num_bonds
,
bond_id
:
col
(
0
,
6
,
Column
Type
.
int
),
origin_atom_id
:
col
(
6
,
6
,
Column
Type
.
int
),
target_atom_id
:
col
(
12
,
6
,
Column
Type
.
int
),
bond_type
:
col
(
18
,
5
,
Column
Type
.
pooledS
tr
),
bond_id
:
col
(
0
,
6
,
Column
.
Schema
.
int
),
origin_atom_id
:
col
(
6
,
6
,
Column
.
Schema
.
int
),
target_atom_id
:
col
(
12
,
6
,
Column
.
Schema
.
int
),
bond_type
:
col
(
18
,
5
,
Column
.
Schema
.
s
tr
),
// optional properties
// undefPooledStr cannot pass unit tests because it create a column of zeros but not empty strings
//status_bits: hasStatus_bit ? col(23, 50, ColumnType.pooledStr) : undefPooledStr,
status_bits
:
hasStatus_bit
?
col
(
23
,
50
,
Column
Type
.
pooledS
tr
)
:
undefStr
,
status_bits
:
hasStatus_bit
?
col
(
23
,
50
,
Column
.
Schema
.
s
tr
)
:
undefStr
,
};
return
ret
;
...
...
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