Sebastian Bittrich hace 5 años
padre
commit
51f88fff71

+ 18 - 7
README.md

@@ -1,4 +1,5 @@
 [![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](./LICENSE)
+[![npm version](https://badge.fury.io/js/molstar.svg)](https://www.npmjs.com/package/molstar)
 [![Build Status](https://travis-ci.org/molstar/molstar.svg?branch=master)](https://travis-ci.org/molstar/molstar)
 [![Gitter](https://badges.gitter.im/molstar/Lobby.svg)](https://gitter.im/molstar/Lobby)
 
@@ -6,11 +7,11 @@
 
 The goal of **Mol\*** (*/'mol-star/*) is to provide a technology stack that will serve as basis for the next-generation data delivery and analysis tools for macromolecular structure data. This is a collaboration between PDBe and RCSB PDB teams and the development will be open source and available to anyone who wants to use it for developing visualisation tools for macromolecular structure data available from [PDB](https://www.wwpdb.org/) and other institutions.
 
-This particular project is a prototype implementation of this technology (still under development).
+This particular project is the implementation of this technology (still under development).
 
 ## Project Overview
 
-The core of Mol* currently consists of these modules:
+The core of Mol* currently consists of these modules (see under `src/`):
 
 - `mol-task` Computation abstraction with progress tracking and cancellation support.
 - `mol-data` Collections (integer based sets, interface to columns/tables, etc.)
@@ -21,8 +22,8 @@ The core of Mol* currently consists of these modules:
 - `mol-model-props` Common "custom properties".
 - `mol-script` A scriting language for creating representations/scenes and querying (includes the [MolQL query language](https://molql.github.io)).
 - `mol-geo` Creating (molecular) geometries.
-- `mol-theme` Molecular representation themeing.
-- `mol-repr` Molecular representations.
+- `mol-theme` Theming for structure, volume and shape representations.
+- `mol-repr` Molecular representations for structures, volumes and shapes.
 - `mol-gl` A wrapper around WebGL.
 - `mol-canvas3d` A low level 3d view component. Uses `mol-geo` to generate geometries.
 - `mol-state` State representation tree with state saving and automatic updates.
@@ -93,15 +94,15 @@ Install CIFTools `npm install ciftools -g`
 ### Other scripts
 **Create chem comp bond table**
 
-    export NODE_PATH="build/src"; node --max-old-space-size=8192 build/src/apps/chem-comp-bond/create-table.js build/data/ccb.bcif -b
+    export NODE_PATH="lib"; node --max-old-space-size=8192 build/src/apps/chem-comp-bond/create-table.js build/data/ccb.bcif -b
 
 **Test model server**
 
-    export NODE_PATH="build/src"; node build/src/servers/model/test.js
+    export NODE_PATH="lib"; node build/src/servers/model/test.js
 
 **State Transformer Docs**
 
-    export NODE_PATH="build/src"; node build/state-docs
+    export NODE_PATH="lib"; node build/state-docs
 
 **Convert any CIF to BinaryCIF**
 
@@ -129,6 +130,16 @@ To get syntax highlighting for shader and graphql files add the following to Vis
         "*.gql.ts": "graphql"
     },
 
+## Publish
+
+## Prerelease
+    npm version prerelease # asumes the current version ends with '-dev.X'
+    npm publish --tag next
+
+## Release
+    npm version 0.X.0 # provide valid semver string
+    npm publish
+
 ## Contributing
 Just open an issue or make a pull request. All contributions are welcome.
 

+ 0 - 88
data/bird-field-names.csv

@@ -1,88 +0,0 @@
-pdbx_reference_molecule.prd_id
-pdbx_reference_molecule.name
-pdbx_reference_molecule.represent_as
-pdbx_reference_molecule.type
-pdbx_reference_molecule.type_evidence_code
-pdbx_reference_molecule.class
-pdbx_reference_molecule.class_evidence_code
-pdbx_reference_molecule.formula
-pdbx_reference_molecule.chem_comp_id
-pdbx_reference_molecule.formula_weight
-pdbx_reference_molecule.release_status
-pdbx_reference_molecule.replaces
-pdbx_reference_molecule.replaced_by
-pdbx_reference_molecule.compound_detail
-pdbx_reference_molecule.description
-pdbx_reference_molecule.representative_PDB_id_code
-
-pdbx_reference_entity_list.prd_id
-pdbx_reference_entity_list.ref_entity_id
-pdbx_reference_entity_list.component_id
-pdbx_reference_entity_list.type
-pdbx_reference_entity_list.details
-
-pdbx_reference_entity_nonpoly.prd_id
-pdbx_reference_entity_nonpoly.ref_entity_id
-pdbx_reference_entity_nonpoly.name
-pdbx_reference_entity_nonpoly.chem_comp_id
-
-pdbx_reference_entity_link.prd_id
-pdbx_reference_entity_link.link_id
-pdbx_reference_entity_link.link_class
-pdbx_reference_entity_link.ref_entity_id_1
-pdbx_reference_entity_link.entity_seq_num_1
-pdbx_reference_entity_link.comp_id_1
-pdbx_reference_entity_link.atom_id_1
-pdbx_reference_entity_link.ref_entity_id_2
-pdbx_reference_entity_link.entity_seq_num_2
-pdbx_reference_entity_link.comp_id_2
-pdbx_reference_entity_link.atom_id_2
-pdbx_reference_entity_link.value_order
-pdbx_reference_entity_link.component_1
-pdbx_reference_entity_link.component_2
-pdbx_reference_entity_link.details
-
-pdbx_reference_entity_poly_link.prd_id
-pdbx_reference_entity_poly_link.ref_entity_id
-pdbx_reference_entity_poly_link.link_id
-pdbx_reference_entity_poly_link.atom_id_1
-pdbx_reference_entity_poly_link.comp_id_1
-pdbx_reference_entity_poly_link.entity_seq_num_1
-pdbx_reference_entity_poly_link.atom_id_2
-pdbx_reference_entity_poly_link.comp_id_2
-pdbx_reference_entity_poly_link.entity_seq_num_2
-pdbx_reference_entity_poly_link.value_order
-pdbx_reference_entity_poly_link.component_id
-
-pdbx_reference_entity_poly.prd_id
-pdbx_reference_entity_poly.ref_entity_id
-pdbx_reference_entity_poly.db_code
-pdbx_reference_entity_poly.db_name
-pdbx_reference_entity_poly.type
-
-pdbx_reference_entity_sequence.prd_id
-pdbx_reference_entity_sequence.ref_entity_id
-pdbx_reference_entity_sequence.type
-pdbx_reference_entity_sequence.NRP_flag
-pdbx_reference_entity_sequence.one_letter_codes
-
-pdbx_reference_entity_poly_seq.prd_id
-pdbx_reference_entity_poly_seq.ref_entity_id
-pdbx_reference_entity_poly_seq.num
-pdbx_reference_entity_poly_seq.mon_id
-pdbx_reference_entity_poly_seq.parent_mon_id
-pdbx_reference_entity_poly_seq.hetero
-pdbx_reference_entity_poly_seq.observed
-
-pdbx_reference_entity_src_nat.prd_id
-pdbx_reference_entity_src_nat.ref_entity_id
-pdbx_reference_entity_src_nat.ordinal
-pdbx_reference_entity_src_nat.taxid
-pdbx_reference_entity_src_nat.organism_scientific
-pdbx_reference_entity_src_nat.db_code
-pdbx_reference_entity_src_nat.db_name
-
-pdbx_prd_audit.prd_id
-pdbx_prd_audit.date
-pdbx_prd_audit.processing_site
-pdbx_prd_audit.action_type

+ 0 - 60
data/ccd-field-names.csv

@@ -1,60 +0,0 @@
-chem_comp.id
-chem_comp.name
-chem_comp.type
-chem_comp.pdbx_type
-chem_comp.formula
-chem_comp.mon_nstd_parent_comp_id
-chem_comp.pdbx_synonyms
-chem_comp.pdbx_formal_charge
-chem_comp.pdbx_initial_date
-chem_comp.pdbx_modified_date
-chem_comp.pdbx_ambiguous_flag
-chem_comp.pdbx_release status
-chem_comp.pdbx_replaced_by
-chem_comp.pdbx_replaces
-chem_comp.formula_weight
-chem_comp.one_letter_code
-chem_comp.three_letter_code
-chem_comp.pdbx_model_coordinates_details
-chem_comp.pdbx_model_coordinates_missing_flag
-chem_comp.pdbx_ideal_coordinates_details
-chem_comp.pdbx_ideal_coordinates_missing_flag
-chem_comp.pdbx_model_coordinates_db_code
-chem_comp.pdbx_processing_site
-
-chem_comp_atom.comp_id
-chem_comp_atom.atom_id
-chem_comp_atom.alt_atom_id
-chem_comp_atom.type_symbol
-chem_comp_atom.charge
-chem_comp_atom.pdbx_align
-chem_comp_atom.pdbx_aromatic_flag
-chem_comp_atom.pdbx_leaving_atom_flag
-chem_comp_atom.pdbx_stereo_config
-chem_comp_atom.model_Cartn_x
-chem_comp_atom.model_Cartn_y
-chem_comp_atom.model_Cartn_z
-chem_comp_atom.pdbx_model_Cartn_x_ideal
-chem_comp_atom.pdbx_model_Cartn_y_ideal
-chem_comp_atom.pdbx_model_Cartn_z_ideal
-chem_comp_atom.pdbx_ordinal
-
-chem_comp_bond.comp_id
-chem_comp_bond.atom_id_1
-chem_comp_bond.atom_id_2
-chem_comp_bond.value_order
-chem_comp_bond.pdbx_aromatic_flag
-chem_comp_bond.pdbx_stereo_config
-chem_comp_bond.pdbx_ordinal
-
-pdbx_chem_comp_descriptor.comp_id
-pdbx_chem_comp_descriptor.type
-pdbx_chem_comp_descriptor.program
-pdbx_chem_comp_descriptor.program_version
-pdbx_chem_comp_descriptor.descriptor
-
-pdbx_chem_comp_identifier.comp_id
-pdbx_chem_comp_identifier.type 
-pdbx_chem_comp_identifier.program
-pdbx_chem_comp_identifier.program_version
-pdbx_chem_comp_identifier.identifier

+ 0 - 705
data/mmcif-field-names.csv

@@ -1,705 +0,0 @@
-atom_sites.entry_id
-atom_sites.fract_transf_matrix
-atom_sites.fract_transf_vector
-
-atom_site.group_PDB
-atom_site.id
-atom_site.type_symbol
-atom_site.label_atom_id
-atom_site.label_alt_id
-atom_site.label_comp_id
-atom_site.label_asym_id
-atom_site.label_entity_id
-atom_site.label_seq_id
-atom_site.pdbx_PDB_ins_code
-atom_site.pdbx_formal_charge
-atom_site.Cartn_x
-atom_site.Cartn_y
-atom_site.Cartn_z
-atom_site.occupancy
-atom_site.B_iso_or_equiv
-atom_site.auth_atom_id
-atom_site.auth_comp_id
-atom_site.auth_asym_id
-atom_site.auth_seq_id
-atom_site.pdbx_PDB_model_num
-atom_site.ihm_model_id
-
-chem_comp.id
-chem_comp.type
-chem_comp.mon_nstd_flag
-chem_comp.name
-chem_comp.pdbx_synonyms
-chem_comp.formula
-chem_comp.formula_weight
-
-chem_comp_bond.comp_id
-chem_comp_bond.pdbx_stereo_config
-chem_comp_bond.pdbx_ordinal
-chem_comp_bond.pdbx_aromatic_flag
-chem_comp_bond.atom_id_1
-chem_comp_bond.atom_id_2
-chem_comp_bond.value_order
-
-pdbx_chem_comp_identifier.comp_id
-pdbx_chem_comp_identifier.type
-pdbx_chem_comp_identifier.program
-pdbx_chem_comp_identifier.program_version
-pdbx_chem_comp_identifier.identifier
-
-pdbx_chem_comp_related.comp_id
-pdbx_chem_comp_related.related_comp_id
-pdbx_chem_comp_related.relationship_type
-pdbx_chem_comp_related.details
-
-pdbx_chem_comp_synonyms.comp_id
-pdbx_chem_comp_synonyms.name
-pdbx_chem_comp_synonyms.provenance
-
-cell.entry_id
-cell.length_a
-cell.length_b
-cell.length_c
-cell.angle_alpha
-cell.angle_beta
-cell.angle_gamma
-cell.Z_PDB
-cell.pdbx_unique_axis
-
-entity.id
-entity.type
-entity.src_method
-entity.pdbx_description
-entity.formula_weight
-entity.pdbx_number_of_molecules
-entity.details
-entity.pdbx_mutation
-entity.pdbx_fragment
-entity.pdbx_ec
-
-entity_poly.entity_id
-entity_poly.type
-entity_poly.nstd_linkage
-entity_poly.nstd_monomer
-entity_poly.pdbx_seq_one_letter_code
-entity_poly.pdbx_seq_one_letter_code_can
-entity_poly.pdbx_strand_id
-entity_poly.pdbx_target_identifier
-
-entity_poly_seq.entity_id
-entity_poly_seq.num
-entity_poly_seq.mon_id
-entity_poly_seq.hetero
-
-entity_src_gen.entity_id
-entity_src_gen.pdbx_src_id
-entity_src_gen.pdbx_alt_source_flag
-entity_src_gen.pdbx_seq_type
-entity_src_gen.pdbx_beg_seq_num
-entity_src_gen.pdbx_end_seq_num
-entity_src_gen.pdbx_gene_src_gene
-
-entity_src_nat.entity_id
-entity_src_nat.pdbx_src_id
-entity_src_nat.pdbx_alt_source_flag
-entity_src_nat.pdbx_beg_seq_num
-entity_src_nat.pdbx_end_seq_num
-
-pdbx_entity_src_syn.entity_id
-pdbx_entity_src_syn.pdbx_src_id
-pdbx_entity_src_syn.pdbx_alt_source_flag
-pdbx_entity_src_syn.pdbx_beg_seq_num
-pdbx_entity_src_syn.pdbx_end_seq_num
-
-pdbx_entity_branch.entity_id
-pdbx_entity_branch.type
-
-pdbx_entity_branch_list.entity_id
-pdbx_entity_branch_list.comp_id
-pdbx_entity_branch_list.num
-pdbx_entity_branch_list.component_comp_id
-pdbx_entity_branch_list.hetero
-
-pdbx_entity_branch_link.link_id
-pdbx_entity_branch_link.entity_id
-pdbx_entity_branch_link.entity_branch_list_num_1
-pdbx_entity_branch_link.comp_id_1
-pdbx_entity_branch_link.atom_id_1
-pdbx_entity_branch_link.leaving_atom_id_1
-pdbx_entity_branch_link.atom_stereo_config_1
-pdbx_entity_branch_link.entity_branch_list_num_2
-pdbx_entity_branch_link.comp_id_2
-pdbx_entity_branch_link.atom_id_2
-pdbx_entity_branch_link.leaving_atom_id_2
-pdbx_entity_branch_link.atom_stereo_config_2
-pdbx_entity_branch_link.value_order
-pdbx_entity_branch_link.details
-
-pdbx_branch_scheme.asym_id
-pdbx_branch_scheme.entity_id
-pdbx_branch_scheme.mon_id
-pdbx_branch_scheme.num
-pdbx_branch_scheme.auth_seq_num
-pdbx_branch_scheme.auth_mon_id
-pdbx_branch_scheme.auth_strand_id
-pdbx_branch_scheme.auth_ins_code
-pdbx_branch_scheme.hetero
-
-pdbx_entity_descriptor.ordinal
-pdbx_entity_descriptor.entity_id
-pdbx_entity_descriptor.descriptor
-pdbx_entity_descriptor.type
-pdbx_entity_descriptor.program
-pdbx_entity_descriptor.program_version
-
-pdbx_nonpoly_scheme.asym_id
-pdbx_nonpoly_scheme.entity_id
-pdbx_nonpoly_scheme.mon_id
-pdbx_nonpoly_scheme.ndb_seq_num
-pdbx_nonpoly_scheme.pdb_seq_num
-pdbx_nonpoly_scheme.auth_seq_num
-pdbx_nonpoly_scheme.pdb_mon_id
-pdbx_nonpoly_scheme.auth_mon_id
-pdbx_nonpoly_scheme.pdb_strand_id
-pdbx_nonpoly_scheme.pdb_ins_code
-
-entry.id
-
-exptl.entry_id
-exptl.method
-
-struct.entry_id
-struct.title
-
-struct_asym.id
-struct_asym.pdbx_blank_PDB_chainid_flag
-struct_asym.pdbx_modified
-struct_asym.entity_id
-struct_asym.details
-
-struct_conf.conf_type_id
-struct_conf.id
-struct_conf.pdbx_PDB_helix_id
-struct_conf.beg_label_comp_id
-struct_conf.beg_label_asym_id
-struct_conf.beg_label_seq_id
-struct_conf.pdbx_beg_PDB_ins_code
-struct_conf.end_label_comp_id
-struct_conf.end_label_asym_id
-struct_conf.end_label_seq_id
-struct_conf.pdbx_end_PDB_ins_code
-struct_conf.beg_auth_comp_id
-struct_conf.beg_auth_asym_id
-struct_conf.beg_auth_seq_id
-struct_conf.end_auth_comp_id
-struct_conf.end_auth_asym_id
-struct_conf.end_auth_seq_id
-struct_conf.pdbx_PDB_helix_class
-struct_conf.details
-struct_conf.pdbx_PDB_helix_length
-
-struct_conn.id
-struct_conn.conn_type_id
-struct_conn.pdbx_PDB_id
-struct_conn.ptnr1_label_asym_id
-struct_conn.ptnr1_label_comp_id
-struct_conn.ptnr1_label_seq_id
-struct_conn.ptnr1_label_atom_id
-struct_conn.pdbx_ptnr1_label_alt_id
-struct_conn.pdbx_ptnr1_PDB_ins_code
-struct_conn.pdbx_ptnr1_standard_comp_id
-struct_conn.ptnr1_symmetry
-struct_conn.ptnr2_label_asym_id
-struct_conn.ptnr2_label_comp_id
-struct_conn.ptnr2_label_seq_id
-struct_conn.ptnr2_label_atom_id
-struct_conn.pdbx_ptnr2_label_alt_id
-struct_conn.pdbx_ptnr2_PDB_ins_code
-struct_conn.ptnr1_auth_asym_id
-struct_conn.ptnr1_auth_comp_id
-struct_conn.ptnr1_auth_seq_id
-struct_conn.ptnr2_auth_asym_id
-struct_conn.ptnr2_auth_comp_id
-struct_conn.ptnr2_auth_seq_id
-struct_conn.ptnr2_symmetry
-struct_conn.pdbx_ptnr3_label_atom_id
-struct_conn.pdbx_ptnr3_label_seq_id
-struct_conn.pdbx_ptnr3_label_comp_id
-struct_conn.pdbx_ptnr3_label_asym_id
-struct_conn.pdbx_ptnr3_label_alt_id
-struct_conn.pdbx_ptnr3_PDB_ins_code
-struct_conn.details
-struct_conn.pdbx_dist_value
-struct_conn.pdbx_value_order
-
-struct_conn_type.id
-struct_conn_type.criteria
-struct_conn_type.reference
-
-struct_keywords.entry_id
-struct_keywords.pdbx_keywords
-struct_keywords.text
-
-struct_ncs_oper.id
-struct_ncs_oper.code
-struct_ncs_oper.matrix
-struct_ncs_oper.vector
-struct_ncs_oper.details
-
-struct_sheet_range.sheet_id
-struct_sheet_range.id
-struct_sheet_range.beg_label_comp_id
-struct_sheet_range.beg_label_asym_id
-struct_sheet_range.beg_label_seq_id
-struct_sheet_range.pdbx_beg_PDB_ins_code
-struct_sheet_range.end_label_comp_id
-struct_sheet_range.end_label_asym_id
-struct_sheet_range.end_label_seq_id
-struct_sheet_range.pdbx_end_PDB_ins_code
-struct_sheet_range.beg_auth_comp_id
-struct_sheet_range.beg_auth_asym_id
-struct_sheet_range.beg_auth_seq_id
-struct_sheet_range.end_auth_comp_id
-struct_sheet_range.end_auth_asym_id
-struct_sheet_range.end_auth_seq_id
-
-struct_site.id
-struct_site.pdbx_evidence_code
-struct_site.pdbx_auth_asym_id
-struct_site.pdbx_auth_comp_id
-struct_site.pdbx_auth_seq_id
-struct_site.pdbx_auth_ins_code
-struct_site.pdbx_num_residues
-struct_site.details
-
-struct_site_gen.id
-struct_site_gen.site_id
-struct_site_gen.pdbx_num_res
-struct_site_gen.label_comp_id
-struct_site_gen.label_asym_id
-struct_site_gen.label_seq_id
-struct_site_gen.pdbx_auth_ins_code
-struct_site_gen.auth_comp_id
-struct_site_gen.auth_asym_id
-struct_site_gen.auth_seq_id
-struct_site_gen.label_atom_id
-struct_site_gen.label_alt_id
-struct_site_gen.symmetry
-struct_site_gen.details
-
-symmetry.entry_id
-symmetry.space_group_name_H-M
-symmetry.pdbx_full_space_group_name_H
-symmetry.cell_setting
-symmetry.Int_Tables_number
-symmetry.space_group_name_Hall
-
-pdbx_molecule.instance_id
-pdbx_molecule.prd_id
-pdbx_molecule.asym_id
-
-pdbx_molecule_features.prd_id
-pdbx_molecule_features.name
-pdbx_molecule_features.type
-pdbx_molecule_features.class
-pdbx_molecule_features.details
-
-pdbx_reference_entity_link.prd_id
-pdbx_reference_entity_link.link_id
-pdbx_reference_entity_link.link_class
-pdbx_reference_entity_link.ref_entity_id_1
-pdbx_reference_entity_link.entity_seq_num_1
-pdbx_reference_entity_link.comp_id_1
-pdbx_reference_entity_link.atom_id_1
-pdbx_reference_entity_link.ref_entity_id_2
-pdbx_reference_entity_link.entity_seq_num_2
-pdbx_reference_entity_link.comp_id_2
-pdbx_reference_entity_link.atom_id_2
-pdbx_reference_entity_link.value_order
-pdbx_reference_entity_link.component_1
-pdbx_reference_entity_link.component_2
-pdbx_reference_entity_link.details
-
-pdbx_reference_entity_list.prd_id
-pdbx_reference_entity_list.ref_entity_id
-pdbx_reference_entity_list.component_id
-pdbx_reference_entity_list.type
-pdbx_reference_entity_list.details
-
-pdbx_reference_entity_poly_link.prd_id
-pdbx_reference_entity_poly_link.ref_entity_id
-pdbx_reference_entity_poly_link.link_id
-pdbx_reference_entity_poly_link.atom_id_1
-pdbx_reference_entity_poly_link.comp_id_1
-pdbx_reference_entity_poly_link.entity_seq_num_1
-pdbx_reference_entity_poly_link.atom_id_2
-pdbx_reference_entity_poly_link.comp_id_2
-pdbx_reference_entity_poly_link.entity_seq_num_2
-pdbx_reference_entity_poly_link.value_order
-pdbx_reference_entity_poly_link.component_id
-
-pdbx_struct_assembly.id
-pdbx_struct_assembly.details
-pdbx_struct_assembly.method_details
-pdbx_struct_assembly.oligomeric_details
-pdbx_struct_assembly.oligomeric_count
-
-pdbx_struct_assembly_gen.assembly_id
-pdbx_struct_assembly_gen.oper_expression
-pdbx_struct_assembly_gen.asym_id_list
-
-pdbx_struct_oper_list.id
-pdbx_struct_oper_list.type
-pdbx_struct_oper_list.name
-pdbx_struct_oper_list.symmetry_operation
-pdbx_struct_oper_list.matrix
-pdbx_struct_oper_list.vector
-
-pdbx_struct_mod_residue.id
-pdbx_struct_mod_residue.label_asym_id
-pdbx_struct_mod_residue.label_seq_id
-pdbx_struct_mod_residue.label_comp_id
-pdbx_struct_mod_residue.auth_asym_id
-pdbx_struct_mod_residue.auth_seq_id
-pdbx_struct_mod_residue.auth_comp_id
-pdbx_struct_mod_residue.PDB_ins_code
-pdbx_struct_mod_residue.parent_comp_id
-pdbx_struct_mod_residue.details
-
-ihm_struct_assembly.ordinal_id
-ihm_struct_assembly.assembly_id
-ihm_struct_assembly.parent_assembly_id
-ihm_struct_assembly.entity_description
-ihm_struct_assembly.entity_id
-ihm_struct_assembly.asym_id
-ihm_struct_assembly.seq_id_begin
-ihm_struct_assembly.seq_id_end
-
-ihm_struct_assembly_details.assembly_id
-ihm_struct_assembly_details.assembly_name
-ihm_struct_assembly_details.assembly_description
-
-ihm_model_representation.ordinal_id
-ihm_model_representation.representation_id
-ihm_model_representation.segment_id
-ihm_model_representation.entity_id
-ihm_model_representation.entity_description
-ihm_model_representation.entity_asym_id
-ihm_model_representation.seq_id_begin
-ihm_model_representation.seq_id_end
-ihm_model_representation.model_object_primitive
-ihm_model_representation.starting_model_id
-ihm_model_representation.model_mode
-ihm_model_representation.model_granularity
-ihm_model_representation.model_object_count
-
-ihm_external_reference_info.reference_id
-ihm_external_reference_info.reference_provider
-ihm_external_reference_info.reference_type
-ihm_external_reference_info.reference
-ihm_external_reference_info.refers_to
-ihm_external_reference_info.associated_url
-
-ihm_external_files.id
-ihm_external_files.reference_id
-ihm_external_files.file_path
-ihm_external_files.content_type
-ihm_external_files.file_size_bytes
-ihm_external_files.details
-
-ihm_dataset_list.id
-ihm_dataset_list.data_type
-ihm_dataset_list.database_hosted
-
-ihm_dataset_group.ordinal_id
-ihm_dataset_group.group_id
-ihm_dataset_group.dataset_list_id
-
-ihm_dataset_external_reference.id
-ihm_dataset_external_reference.dataset_list_id
-ihm_dataset_external_reference.file_id
-
-ihm_dataset_related_db_reference.id
-ihm_dataset_related_db_reference.dataset_list_id
-ihm_dataset_related_db_reference.db_name
-ihm_dataset_related_db_reference.accession_code
-ihm_dataset_related_db_reference.version
-ihm_dataset_related_db_reference.details
-
-ihm_related_datasets.ordinal_id
-ihm_related_datasets.dataset_list_id_derived
-ihm_related_datasets.dataset_list_id_primary
-
-ihm_poly_residue_feature.ordinal_id
-ihm_poly_residue_feature.feature_id
-ihm_poly_residue_feature.entity_id
-ihm_poly_residue_feature.asym_id
-ihm_poly_residue_feature.seq_id_begin
-ihm_poly_residue_feature.comp_id_begin
-ihm_poly_residue_feature.seq_id_end
-ihm_poly_residue_feature.comp_id_end
-
-ihm_feature_list.feature_id
-ihm_feature_list.feature_type
-ihm_feature_list.entity_type
-
-ihm_cross_link_list.id
-ihm_cross_link_list.group_id
-ihm_cross_link_list.entity_description_1
-ihm_cross_link_list.entity_id_1
-ihm_cross_link_list.seq_id_1
-ihm_cross_link_list.comp_id_1
-ihm_cross_link_list.entity_description_2
-ihm_cross_link_list.entity_id_2
-ihm_cross_link_list.seq_id_2
-ihm_cross_link_list.comp_id_2
-ihm_cross_link_list.linker_type
-ihm_cross_link_list.dataset_list_id
-
-ihm_cross_link_restraint.id
-ihm_cross_link_restraint.group_id
-ihm_cross_link_restraint.entity_id_1
-ihm_cross_link_restraint.asym_id_1
-ihm_cross_link_restraint.seq_id_1
-ihm_cross_link_restraint.atom_id_1
-ihm_cross_link_restraint.comp_id_1
-ihm_cross_link_restraint.entity_id_2
-ihm_cross_link_restraint.asym_id_2
-ihm_cross_link_restraint.seq_id_2
-ihm_cross_link_restraint.atom_id_2
-ihm_cross_link_restraint.comp_id_2
-ihm_cross_link_restraint.restraint_type
-ihm_cross_link_restraint.conditional_crosslink_flag
-ihm_cross_link_restraint.model_granularity
-ihm_cross_link_restraint.distance_threshold
-ihm_cross_link_restraint.psi
-ihm_cross_link_restraint.sigma_1
-ihm_cross_link_restraint.sigma_2
-
-ihm_cross_link_result_parameters.ordinal_id
-ihm_cross_link_result_parameters.restraint_id
-ihm_cross_link_result_parameters.model_id
-ihm_cross_link_result_parameters.psi
-ihm_cross_link_result_parameters.sigma_1
-ihm_cross_link_result_parameters.sigma_2
-
-ihm_sas_restraint.ordinal_id
-ihm_sas_restraint.dataset_list_id
-ihm_sas_restraint.model_id
-ihm_sas_restraint.struct_assembly_id
-ihm_sas_restraint.profile_segment_flag
-ihm_sas_restraint.fitting_atom_type
-ihm_sas_restraint.fitting_method
-ihm_sas_restraint.fitting_state
-ihm_sas_restraint.radius_of_gyration
-ihm_sas_restraint.chi_value
-ihm_sas_restraint.details
-
-ihm_derived_distance_restraint.id
-ihm_derived_distance_restraint.group_id
-ihm_derived_distance_restraint.feature_id_1
-ihm_derived_distance_restraint.feature_id_2
-ihm_derived_distance_restraint.group_conditionality
-ihm_derived_distance_restraint.restraint_type
-ihm_derived_distance_restraint.distance_upper_limit
-ihm_derived_distance_restraint.random_exclusion_fraction
-ihm_derived_distance_restraint.dataset_list_id
-
-ihm_2dem_class_average_restraint.id
-ihm_2dem_class_average_restraint.dataset_list_id
-ihm_2dem_class_average_restraint.number_raw_micrographs
-ihm_2dem_class_average_restraint.pixel_size_width
-ihm_2dem_class_average_restraint.pixel_size_height
-ihm_2dem_class_average_restraint.image_resolution
-ihm_2dem_class_average_restraint.image_segment_flag
-ihm_2dem_class_average_restraint.number_of_projections
-ihm_2dem_class_average_restraint.struct_assembly_id
-ihm_2dem_class_average_restraint.details
-
-ihm_2dem_class_average_fitting.ordinal_id
-ihm_2dem_class_average_fitting.restraint_id
-ihm_2dem_class_average_fitting.model_id
-ihm_2dem_class_average_fitting.cross_correlation_coefficient
-ihm_2dem_class_average_fitting.rot_matrix
-ihm_2dem_class_average_fitting.tr_vector
-
-ihm_3dem_restraint.ordinal_id
-ihm_3dem_restraint.dataset_list_id
-ihm_3dem_restraint.fitting_method
-ihm_3dem_restraint.struct_assembly_id
-ihm_3dem_restraint.number_of_gaussians
-ihm_3dem_restraint.model_id
-ihm_3dem_restraint.cross_correlation_coefficient
-
-ihm_predicted_contact_restraint.id
-ihm_predicted_contact_restraint.group_id
-ihm_predicted_contact_restraint.entity_id_1
-ihm_predicted_contact_restraint.asym_id_1
-ihm_predicted_contact_restraint.seq_id_1
-ihm_predicted_contact_restraint.comp_id_1
-ihm_predicted_contact_restraint.atom_id_1
-ihm_predicted_contact_restraint.entity_id_2
-ihm_predicted_contact_restraint.asym_id_2
-ihm_predicted_contact_restraint.seq_id_2
-ihm_predicted_contact_restraint.comp_id_2
-ihm_predicted_contact_restraint.atom_id_2
-ihm_predicted_contact_restraint.restraint_type
-ihm_predicted_contact_restraint.distance_lower_limit
-ihm_predicted_contact_restraint.distance_upper_limit
-ihm_predicted_contact_restraint.probability
-ihm_predicted_contact_restraint.model_granularity
-ihm_predicted_contact_restraint.dataset_list_id
-ihm_predicted_contact_restraint.software_id
-
-ihm_starting_model_details.starting_model_id
-ihm_starting_model_details.entity_id
-ihm_starting_model_details.entity_description
-ihm_starting_model_details.asym_id
-ihm_starting_model_details.seq_id_begin
-ihm_starting_model_details.seq_id_end
-ihm_starting_model_details.starting_model_source
-ihm_starting_model_details.starting_model_auth_asym_id
-ihm_starting_model_details.starting_model_sequence_offset
-ihm_starting_model_details.dataset_list_id
-
-ihm_starting_comparative_models.ordinal_id
-ihm_starting_comparative_models.starting_model_id
-ihm_starting_comparative_models.starting_model_auth_asym_id
-ihm_starting_comparative_models.starting_model_seq_id_begin
-ihm_starting_comparative_models.starting_model_seq_id_end
-ihm_starting_comparative_models.template_auth_asym_id
-ihm_starting_comparative_models.template_seq_id_begin
-ihm_starting_comparative_models.template_seq_id_end
-ihm_starting_comparative_models.template_sequence_identity
-ihm_starting_comparative_models.template_sequence_identity_denominator
-ihm_starting_comparative_models.template_dataset_list_id
-ihm_starting_comparative_models.alignment_file_id
-
-ihm_starting_model_coord.starting_model_id
-ihm_starting_model_coord.group_PDB
-ihm_starting_model_coord.id
-ihm_starting_model_coord.type_symbol
-ihm_starting_model_coord.atom_id
-ihm_starting_model_coord.comp_id
-ihm_starting_model_coord.entity_id
-ihm_starting_model_coord.asym_id
-ihm_starting_model_coord.seq_id
-ihm_starting_model_coord.Cartn_x
-ihm_starting_model_coord.Cartn_y
-ihm_starting_model_coord.Cartn_z
-ihm_starting_model_coord.B_iso_or_equiv
-ihm_starting_model_coord.ordinal_id
-
-ihm_starting_model_seq_dif.ordinal_id
-ihm_starting_model_seq_dif.entity_id
-ihm_starting_model_seq_dif.asym_id
-ihm_starting_model_seq_dif.seq_id
-ihm_starting_model_seq_dif.comp_id
-ihm_starting_model_seq_dif.starting_model_id
-ihm_starting_model_seq_dif.db_asym_id
-ihm_starting_model_seq_dif.db_seq_id
-ihm_starting_model_seq_dif.db_comp_id
-ihm_starting_model_seq_dif.details
-
-ihm_modeling_protocol.ordinal_id
-ihm_modeling_protocol.protocol_id
-ihm_modeling_protocol.step_id
-ihm_modeling_protocol.struct_assembly_id
-ihm_modeling_protocol.dataset_group_id
-ihm_modeling_protocol.struct_assembly_description
-ihm_modeling_protocol.protocol_name
-ihm_modeling_protocol.step_name
-ihm_modeling_protocol.step_method
-ihm_modeling_protocol.num_models_begin
-ihm_modeling_protocol.num_models_end
-ihm_modeling_protocol.multi_scale_flag
-ihm_modeling_protocol.multi_state_flag
-ihm_modeling_protocol.ordered_flag
-
-ihm_modeling_post_process.id
-ihm_modeling_post_process.protocol_id
-ihm_modeling_post_process.analysis_id
-ihm_modeling_post_process.step_id
-ihm_modeling_post_process.type
-ihm_modeling_post_process.feature
-ihm_modeling_post_process.num_models_begin
-ihm_modeling_post_process.num_models_end
-
-ihm_ensemble_info.ensemble_id
-ihm_ensemble_info.ensemble_name
-ihm_ensemble_info.post_process_id
-ihm_ensemble_info.model_group_id
-ihm_ensemble_info.ensemble_clustering_method
-ihm_ensemble_info.ensemble_clustering_feature
-ihm_ensemble_info.num_ensemble_models
-ihm_ensemble_info.num_ensemble_models_deposited
-ihm_ensemble_info.ensemble_precision_value
-ihm_ensemble_info.ensemble_file_id
-
-ihm_localization_density_files.id
-ihm_localization_density_files.file_id
-ihm_localization_density_files.ensemble_id
-ihm_localization_density_files.entity_id
-ihm_localization_density_files.asym_id
-ihm_localization_density_files.seq_id_begin
-ihm_localization_density_files.seq_id_end
-
-ihm_model_list.ordinal_id
-ihm_model_list.model_id
-ihm_model_list.model_group_id
-ihm_model_list.model_name
-ihm_model_list.model_group_name
-ihm_model_list.assembly_id
-ihm_model_list.protocol_id
-ihm_model_list.representation_id
-
-ihm_model_representative.id
-ihm_model_representative.model_group_id
-ihm_model_representative.model_id
-ihm_model_representative.selection_criteria
-
-ihm_sphere_obj_site.ordinal_id
-ihm_sphere_obj_site.entity_id
-ihm_sphere_obj_site.seq_id_begin
-ihm_sphere_obj_site.seq_id_end
-ihm_sphere_obj_site.asym_id
-ihm_sphere_obj_site.Cartn_x
-ihm_sphere_obj_site.Cartn_y
-ihm_sphere_obj_site.Cartn_z
-ihm_sphere_obj_site.object_radius
-ihm_sphere_obj_site.rmsf
-ihm_sphere_obj_site.model_id
-
-ihm_gaussian_obj_site.ordinal_id
-ihm_gaussian_obj_site.entity_id
-ihm_gaussian_obj_site.seq_id_begin
-ihm_gaussian_obj_site.seq_id_end
-ihm_gaussian_obj_site.asym_id
-ihm_gaussian_obj_site.mean_Cartn_x
-ihm_gaussian_obj_site.mean_Cartn_y
-ihm_gaussian_obj_site.mean_Cartn_z
-ihm_gaussian_obj_site.weight
-ihm_gaussian_obj_site.covariance_matrix
-ihm_gaussian_obj_site.model_id
-
-ihm_gaussian_obj_ensemble.ordinal_id
-ihm_gaussian_obj_ensemble.entity_id
-ihm_gaussian_obj_ensemble.seq_id_begin
-ihm_gaussian_obj_ensemble.seq_id_end
-ihm_gaussian_obj_ensemble.asym_id
-ihm_gaussian_obj_ensemble.mean_Cartn_x
-ihm_gaussian_obj_ensemble.mean_Cartn_y
-ihm_gaussian_obj_ensemble.mean_Cartn_z
-ihm_gaussian_obj_ensemble.weight
-ihm_gaussian_obj_ensemble.covariance_matrix
-ihm_gaussian_obj_ensemble.ensemble_id
-
-ihm_multi_state_modeling.ordinal_id
-ihm_multi_state_modeling.state_id
-ihm_multi_state_modeling.state_group_id
-ihm_multi_state_modeling.population_fraction
-ihm_multi_state_modeling.state_type
-ihm_multi_state_modeling.state_name
-ihm_multi_state_modeling.model_group_id
-ihm_multi_state_modeling.experiment_type
-ihm_multi_state_modeling.details

+ 15 - 11
package.json

@@ -1,6 +1,6 @@
 {
   "name": "molstar",
-  "version": "0.1.0",
+  "version": "0.2.1",
   "description": "A comprehensive macromolecular library.",
   "homepage": "https://github.com/molstar/molstar#readme",
   "repository": {
@@ -13,16 +13,24 @@
   "scripts": {
     "lint": "tslint src/**/*.ts",
     "test": "npm run lint && jest",
-    "build": "cpx \"src/**/*.{scss,woff,woff2,ttf,otf,eot,svg,html}\" lib/ && tsc",
-    "postinstall": "npm run build",
-    "watch": "concurrently --kill-others \"npm:watch-ts\" \"npm:watch-extra\" \"npm:watch-webpack\"",
-    "watch-ts": "tsc -watch",
-    "watch-extra": "cpx \"src/**/*.{scss,woff,woff2,ttf,otf,eot,svg,html}\" lib/ --watch",
+    "build": "npm run build-tsc && npm run build-extra && npm run build-webpack",
+    "build-tsc": "tsc",
+    "build-extra": "cpx \"src/**/*.{scss,woff,woff2,ttf,otf,eot,svg,html}\" lib/",
     "build-webpack": "webpack --mode production",
+    "watch": "concurrently --kill-others \"npm:watch-tsc\" \"npm:watch-extra\" \"npm:watch-webpack\"",
+    "watch-tsc": "tsc -watch",
+    "watch-extra": "cpx \"src/**/*.{scss,woff,woff2,ttf,otf,eot,svg,html}\" lib/ --watch",
     "watch-webpack": "webpack -w --mode development --display minimal",
     "model-server": "node lib/servers/model/server.js",
-    "model-server-watch": "nodemon --watch lib lib/servers/model/server.js"
+    "model-server-watch": "nodemon --watch lib lib/servers/model/server.js",
+    "postinstall": "npm run build",
+    "preversion": "npm run test",
+    "postversion": "git push && git push --tags",
+    "prepublishOnly": "npm run test && npm run build"
   },
+  "files": [
+    "lib/"
+  ],
   "nodemonConfig": {
     "ignoreRoot": [
       "./node_modules",
@@ -85,11 +93,9 @@
     "@types/benchmark": "^1.0.31",
     "@types/compression": "0.0.36",
     "@types/express": "^4.16.1",
-    "@types/gl": "^4.1.0",
     "@types/jest": "^24.0.13",
     "@types/node": "^12.0.4",
     "@types/node-fetch": "^2.3.4",
-    "@types/pngjs": "^3.3.2",
     "@types/react": "^16.8.19",
     "@types/react-dom": "^16.8.4",
     "@types/swagger-ui-dist": "3.0.0",
@@ -97,11 +103,9 @@
     "argparse": "^1.0.10",
     "compression": "^1.7.4",
     "express": "^4.17.1",
-    "gl": "^4.3.3",
     "graphql": "^14.3.1",
     "immutable": "^3.8.2",
     "node-fetch": "^2.6.0",
-    "pngjs": "^3.4.0",
     "react": "^16.8.6",
     "react-dom": "^16.8.6",
     "rxjs": "^6.5.2",

+ 0 - 81
src/apps/cif2bcif/converter.ts

@@ -1,81 +0,0 @@
-/**
- * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author David Sehnal <david.sehnal@gmail.com>
- */
-
-import { CIF, CifCategory, getCifFieldType, CifField } from '../../mol-io/reader/cif'
-import { CifWriter } from '../../mol-io/writer/cif'
-import * as fs from 'fs'
-import { Progress, Task, RuntimeContext } from '../../mol-task';
-import { classifyFloatArray, classifyIntArray } from '../../mol-io/common/binary-cif';
-
-function showProgress(p: Progress) {
-    process.stdout.write(`\r${new Array(80).join(' ')}`);
-    process.stdout.write(`\r${Progress.format(p)}`);
-}
-
-async function getCIF(ctx: RuntimeContext, path: string) {
-    const str = fs.readFileSync(path, 'utf8');
-    const parsed = await CIF.parseText(str).runInContext(ctx);
-    if (parsed.isError) {
-        throw new Error(parsed.toString());
-    }
-    return parsed.result;
-}
-
-function getCategoryInstanceProvider(cat: CifCategory, fields: CifWriter.Field[]): CifWriter.Category {
-    return {
-        name: cat.name,
-        instance: () => CifWriter.categoryInstance(fields, { data: cat, rowCount: cat.rowCount })
-    };
-}
-
-function classify(name: string, field: CifField): CifWriter.Field {
-    const type = getCifFieldType(field);
-    if (type['@type'] === 'str') {
-        return { name, type: CifWriter.Field.Type.Str, value: field.str, valueKind: field.valueKind };
-    } else if (type['@type'] === 'float') {
-        const encoder = classifyFloatArray(field.toFloatArray({ array: Float64Array }));
-        return CifWriter.Field.float(name, field.float, { valueKind: field.valueKind, encoder, typedArray: Float64Array });
-    } else {
-        const encoder = classifyIntArray(field.toIntArray({ array: Int32Array }));
-        return CifWriter.Field.int(name, field.int, { valueKind: field.valueKind, encoder, typedArray: Int32Array });
-    }
-}
-
-export default function convert(path: string, asText = false) {
-    return Task.create<Uint8Array>('BinaryCIF', async ctx => {
-        const cif = await getCIF(ctx, path);
-
-        const encoder = CifWriter.createEncoder({ binary: !asText, encoderName: 'mol* cif2bcif' });
-
-        let maxProgress = 0;
-        for (const b of cif.blocks) {
-            maxProgress += b.categoryNames.length;
-            for (const c of b.categoryNames) maxProgress += b.categories[c].fieldNames.length;
-        }
-
-        let current = 0;
-        for (const b of cif.blocks) {
-            encoder.startDataBlock(b.header);
-            for (const c of b.categoryNames) {
-                const cat = b.categories[c];
-                const fields: CifWriter.Field[] = [];
-                for (const f of cat.fieldNames) {
-                    fields.push(classify(f, cat.getField(f)!))
-                    current++;
-                    if (ctx.shouldUpdate) await ctx.update({ message: 'Encoding...', current, max: maxProgress });
-                }
-
-                encoder.writeCategory(getCategoryInstanceProvider(b.categories[c], fields));
-                current++;
-                if (ctx.shouldUpdate) await ctx.update({ message: 'Encoding...', current, max: maxProgress });
-            }
-        }
-        await ctx.update('Exporting...');
-        const ret = encoder.getData() as Uint8Array;
-        await ctx.update('Done.');
-        return ret;
-    }).run(showProgress, 250);
-}

+ 0 - 20
src/apps/cif2bcif/index.ts

@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author David Sehnal <david.sehnal@gmail.com>
- */
-
-import * as fs from 'fs'
-import convert from './converter'
-
-(async function () {
-    if (process.argv.length !== 4) {
-        console.log('Usage:\nnode cif2bcif input.cif output.bcif');
-        return;
-    }
-    const src = process.argv[2];
-    const out = process.argv[3];
-
-    const res = await convert(src);
-    fs.writeFileSync(out, res);
-}());

+ 0 - 137
src/apps/image-generator/index.ts

@@ -1,137 +0,0 @@
-/**
- * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- */
-
-import * as argparse from 'argparse'
-import createContext = require('gl')
-import fs = require('fs')
-import { PNG } from 'pngjs'
-import { Canvas3D, Canvas3DParams } from '../../mol-canvas3d/canvas3d';
-import InputObserver from '../../mol-util/input/input-observer';
-import { ColorTheme } from '../../mol-theme/color';
-import { SizeTheme } from '../../mol-theme/size';
-import { CartoonRepresentationProvider } from '../../mol-repr/structure/representation/cartoon';
-import { CIF, CifFrame } from '../../mol-io/reader/cif'
-import { trajectoryFromMmCIF } from '../../mol-model-formats/structure/mmcif';
-import { Model, Structure } from '../../mol-model/structure';
-import { ajaxGet } from '../../mol-util/data-source';
-import { ColorNames } from '../../mol-util/color/tables';
-
-const width = 2048
-const height = 1536
-const gl = createContext(width, height, {
-    alpha: false,
-    antialias: true,
-    depth: true,
-    preserveDrawingBuffer: true
-})
-
-const input = InputObserver.create()
-const canvas3d = Canvas3D.create(gl, input, {
-    multiSample: {
-        mode: 'on',
-        sampleLevel: 3
-    },
-    renderer: {
-        ...Canvas3DParams.renderer.defaultValue,
-        lightIntensity: 0,
-        ambientIntensity: 1,
-        backgroundColor: ColorNames.white
-    },
-    postprocessing: {
-        ...Canvas3DParams.postprocessing.defaultValue,
-        occlusionEnable: true,
-        outlineEnable: true
-    }
-})
-canvas3d.animate()
-
-const reprCtx = {
-    wegbl: canvas3d.webgl,
-    colorThemeRegistry: ColorTheme.createRegistry(),
-    sizeThemeRegistry: SizeTheme.createRegistry()
-}
-function getCartoonRepr() {
-    return CartoonRepresentationProvider.factory(reprCtx, CartoonRepresentationProvider.getParams)
-}
-
-async function parseCif(data: string|Uint8Array) {
-    const comp = CIF.parse(data);
-    const parsed = await comp.run();
-    if (parsed.isError) throw parsed;
-    return parsed.result;
-}
-
-async function downloadCif(url: string, isBinary: boolean) {
-    const data = await ajaxGet({ url, type: isBinary ? 'binary' : 'string' }).run();
-    return parseCif(data);
-}
-
-async function downloadFromPdb(pdb: string) {
-    const parsed = await downloadCif(`https://files.rcsb.org/download/${pdb}.cif`, false);
-    // const parsed = await downloadCif(`https://webchem.ncbr.muni.cz/ModelServer/static/bcif/${pdb}`, true);
-    return parsed.blocks[0];
-}
-
-async function getModels(frame: CifFrame) {
-    return await trajectoryFromMmCIF(frame).run();
-}
-
-async function getStructure(model: Model) {
-    return Structure.ofModel(model);
-}
-
-async function run(id: string, out: string) {
-    try {
-        const cif = await downloadFromPdb(id)
-        const models = await getModels(cif)
-        const structure = await getStructure(models[0])
-
-        const cartoonRepr = getCartoonRepr()
-        cartoonRepr.setTheme({
-            color: reprCtx.colorThemeRegistry.create('sequence-id', { structure }),
-            size: reprCtx.sizeThemeRegistry.create('uniform', { structure })
-        })
-        await cartoonRepr.createOrUpdate({ ...CartoonRepresentationProvider.defaultValues, quality: 'auto' }, structure).run()
-
-        canvas3d.add(cartoonRepr)
-        canvas3d.resetCamera()
-    } catch (e) {
-        console.log(e)
-        process.exit(1)
-    }
-
-    setTimeout(() => {
-        const pixelData = canvas3d.getPixelData('color')
-        const png = new PNG({ width, height })
-        png.data = Buffer.from(pixelData.array)
-        png.pack().pipe(fs.createWriteStream(out)).on('finish', () => {
-            process.exit()
-        })
-    }, 2000)
-}
-
-//
-
-const parser = new argparse.ArgumentParser({
-    addHelp: true,
-    description: 'render image as PNG (work in progress)'
-});
-parser.addArgument([ '--id', '-i' ], {
-    required: true,
-    help: 'PDB ID'
-});
-parser.addArgument([ '--out', '-o' ], {
-    required: true,
-    help: 'image output path'
-});
-
-interface Args {
-    id: string
-    out: string
-}
-const args: Args = parser.parseArgs();
-
-run(args.id, args.out)

+ 0 - 140
src/apps/schema-generator/schema-from-cif-dic.ts

@@ -1,140 +0,0 @@
-/**
- * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- */
-
-import * as argparse from 'argparse'
-// import * as util from 'util'
-import * as fs from 'fs'
-import fetch from 'node-fetch'
-
-import { parseCsv } from '../../mol-io/reader/csv/parser'
-import { CIF, CifFrame } from '../../mol-io/reader/cif'
-import { generateSchema } from './util/cif-dic'
-import { generate } from './util/generate'
-import { Filter } from './util/schema'
-
-async function runGenerateSchema(name: string, fieldNamesPath?: string, typescript = false, out?: string) {
-    await ensureMmcifDicAvailable()
-    const mmcifDic = await CIF.parseText(fs.readFileSync(MMCIF_DIC_PATH, 'utf8')).run();
-    if (mmcifDic.isError) throw mmcifDic
-
-    await ensureIhmDicAvailable()
-    const ihmDic = await CIF.parseText(fs.readFileSync(IHM_DIC_PATH, 'utf8')).run();
-    if (ihmDic.isError) throw ihmDic
-
-    await ensureCarbBranchDicAvailable()
-    const carbBranchDic = await CIF.parseText(fs.readFileSync(CARB_BRANCH_DIC_PATH, 'utf8')).run();
-    if (carbBranchDic.isError) throw carbBranchDic
-
-    await ensureCarbCompDicAvailable()
-    const carbCompDic = await CIF.parseText(fs.readFileSync(CARB_COMP_DIC_PATH, 'utf8')).run();
-    if (carbCompDic.isError) throw carbCompDic
-
-    const mmcifDicVersion = CIF.schema.dic(mmcifDic.result.blocks[0]).dictionary.version.value(0)
-    const ihmDicVersion = CIF.schema.dic(ihmDic.result.blocks[0]).dictionary.version.value(0)
-    const carbDicVersion = 'draft'
-    const version = `Dictionary versions: mmCIF ${mmcifDicVersion}, IHM ${ihmDicVersion}, CARB ${carbDicVersion}.`
-
-    const frames: CifFrame[] = [...mmcifDic.result.blocks[0].saveFrames, ...ihmDic.result.blocks[0].saveFrames, ...carbBranchDic.result.blocks[0].saveFrames, ...carbCompDic.result.blocks[0].saveFrames]
-    const schema = generateSchema(frames)
-
-    const filter = fieldNamesPath ? await getFieldNamesFilter(fieldNamesPath) : undefined
-    const output = typescript ? generate(name, version, schema, filter) : JSON.stringify(schema, undefined, 4)
-
-    if (out) {
-        fs.writeFileSync(out, output)
-    } else {
-        console.log(output)
-    }
-}
-
-async function getFieldNamesFilter(fieldNamesPath: string): Promise<Filter> {
-    const fieldNamesStr = fs.readFileSync(fieldNamesPath, 'utf8')
-    const parsed = await parseCsv(fieldNamesStr, { noColumnNames: true }).run();
-    if (parsed.isError) throw parser.error
-    const csvFile = parsed.result;
-
-    const fieldNamesCol = csvFile.table.getColumn('0')
-    if (!fieldNamesCol) throw 'error getting fields columns'
-    const fieldNames = fieldNamesCol.toStringArray()
-
-    const filter: Filter = {}
-    fieldNames.forEach((name, i) => {
-        const [ category, field ] = name.split('.')
-        // console.log(category, field)
-        if (!filter[ category ]) filter[ category ] = {}
-        filter[ category ][ field ] = true
-    })
-    // console.log(filter)
-    return filter
-}
-
-async function ensureMmcifDicAvailable() { await ensureDicAvailable(MMCIF_DIC_PATH, MMCIF_DIC_URL) }
-async function ensureIhmDicAvailable() { await ensureDicAvailable(IHM_DIC_PATH, IHM_DIC_URL) }
-async function ensureCarbBranchDicAvailable() { await ensureDicAvailable(CARB_BRANCH_DIC_PATH, CARB_BRANCH_DIC_URL) }
-async function ensureCarbCompDicAvailable() { await ensureDicAvailable(CARB_COMP_DIC_PATH, CARB_COMP_DIC_URL) }
-
-async function ensureDicAvailable(dicPath: string, dicUrl: string) {
-    if (FORCE_DIC_DOWNLOAD || !fs.existsSync(dicPath)) {
-        const name = dicUrl.substr(dicUrl.lastIndexOf('/') + 1)
-        console.log(`downloading ${name}...`)
-        const data = await fetch(dicUrl)
-        if (!fs.existsSync(DIC_DIR)) {
-            fs.mkdirSync(DIC_DIR);
-        }
-        fs.writeFileSync(dicPath, await data.text())
-        console.log(`done downloading ${name}`)
-    }
-}
-
-const DIC_DIR = './build/dics'
-const MMCIF_DIC_PATH = `${DIC_DIR}/mmcif_pdbx_v50.dic`
-const MMCIF_DIC_URL = 'http://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic'
-const IHM_DIC_PATH = `${DIC_DIR}/ihm-extension.dic`
-const IHM_DIC_URL = 'https://raw.githubusercontent.com/ihmwg/IHM-dictionary/master/ihm-extension.dic'
-const CARB_BRANCH_DIC_PATH = `${DIC_DIR}/entity_branch-extension.dic`
-const CARB_BRANCH_DIC_URL = 'https://raw.githubusercontent.com/pdbxmmcifwg/carbohydrate-extension/master/dict/entity_branch-extension.dic'
-const CARB_COMP_DIC_PATH = `${DIC_DIR}/chem_comp-extension.dic`
-const CARB_COMP_DIC_URL = 'https://raw.githubusercontent.com/pdbxmmcifwg/carbohydrate-extension/master/dict/chem_comp-extension.dic'
-
-const parser = new argparse.ArgumentParser({
-  addHelp: true,
-  description: 'Create schema from mmcif dictionary (v50 plus IHM and entity_branch extensions, downloaded from wwPDB)'
-});
-parser.addArgument([ '--name', '-n' ], {
-    defaultValue: 'mmCIF',
-    help: 'Schema name'
-});
-parser.addArgument([ '--out', '-o' ], {
-    help: 'Generated schema output path, if not given printed to stdout'
-});
-parser.addArgument([ '--typescript', '-ts' ], {
-    action: 'storeTrue',
-    help: 'Output schema as TypeScript instead of as JSON'
-});
-parser.addArgument([ '--fieldNamesPath', '-fn' ], {
-    defaultValue: '',
-    help: 'Field names to include'
-});
-parser.addArgument([ '--forceDicDownload', '-f' ], {
-    action: 'storeTrue',
-    help: 'Force download of dictionaries'
-});
-interface Args {
-    name: string
-    forceDicDownload: boolean
-    fieldNamesPath: string
-    typescript: boolean
-    out: string
-}
-const args: Args = parser.parseArgs();
-
-const FORCE_DIC_DOWNLOAD = args.forceDicDownload
-
-if (args.name) {
-    runGenerateSchema(args.name, args.fieldNamesPath, args.typescript, args.out).catch(e => {
-        console.error(e)
-    })
-}

+ 0 - 344
src/apps/schema-generator/util/cif-dic.ts

@@ -1,344 +0,0 @@
-/**
- * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- */
-
-import { Database, Column, EnumCol, StrCol, IntCol, ListCol, FloatCol, CoordCol, MatrixCol, VectorCol } from './schema'
-import * as Data from '../../../mol-io/reader/cif/data-model'
-import { CifFrame } from '../../../mol-io/reader/cif/data-model';
-
-export function getFieldType (type: string, description: string, values?: string[]): Column {
-    switch (type) {
-        case 'code':
-        case 'ucode':
-        case 'line':
-        case 'uline':
-        case 'text':
-        case 'char':
-        case 'uchar3':
-        case 'uchar1':
-        case 'boolean':
-            return values && values.length ? EnumCol(values, 'str', description) : StrCol(description)
-        case 'aliasname':
-        case 'name':
-        case 'idname':
-        case 'any':
-        case 'atcode':
-        case 'fax':
-        case 'phone':
-        case 'email':
-        case 'code30':
-        case 'seq-one-letter-code':
-        case 'author':
-        case 'orcid_id':
-        case 'sequence_dep':
-        case 'pdb_id':
-        case 'emd_id':
-        // todo, consider adding specialised fields
-        case 'yyyy-mm-dd':
-        case 'yyyy-mm-dd:hh:mm':
-        case 'yyyy-mm-dd:hh:mm-flex':
-        case 'int-range':
-        case 'float-range':
-        case 'binary':
-        case 'operation_expression':
-        case 'point_symmetry':
-        case '4x3_matrix':
-        case '3x4_matrices':
-        case 'point_group':
-        case 'point_group_helical':
-        case 'symmetry_operation':
-        case 'date_dep':
-        case 'url':
-        case 'symop':
-        case 'exp_data_doi':
-        case 'asym_id':
-            return StrCol(description)
-        case 'int':
-        case 'non_negative_int':
-        case 'positive_int':
-           return values && values.length ? EnumCol(values, 'int', description) : IntCol(description)
-        case 'float':
-            return FloatCol(description)
-        case 'ec-type':
-        case 'ucode-alphanum-csv':
-        case 'id_list':
-            return ListCol('str', ',', description)
-        case 'id_list_spc':
-            return ListCol('str', ' ', description)
-    }
-    console.log(`unknown type '${type}'`)
-    return StrCol(description)
-}
-
-type FrameCategories = { [category: string]: Data.CifFrame }
-type FrameLinks = { [k: string]: string }
-
-interface FrameData {
-    categories: FrameCategories
-    links: FrameLinks
-}
-
-// get field from given or linked category
-function getField (category: string, field: string, d: Data.CifFrame, ctx: FrameData): Data.CifField|undefined {
-    const { categories, links } = ctx
-
-    const cat = d.categories[category]
-    if (cat) {
-        return cat.getField(field)
-    } else {
-        if (d.header in links) {
-            const linkName = links[d.header]
-            if (linkName in categories) {
-                return getField(category, field, categories[linkName], ctx)
-            } else {
-                console.log(`link '${linkName}' not found`)
-            }
-        } else {
-            // console.log(`no links found for '${d.header}'`)
-        }
-    }
-}
-
-function getEnums (d: Data.CifFrame, ctx: FrameData) {
-    const value = getField('item_enumeration', 'value', d, ctx)
-    const enums: string[] = []
-    if (value) {
-        for (let i = 0; i < value.rowCount; ++i) {
-            enums.push(value.str(i))
-            // console.log(value.str(i))
-        }
-        return enums
-    } else {
-        // console.log(`item_enumeration.value not found for '${d.header}'`)
-    }
-}
-
-function getCode (d: Data.CifFrame, ctx: FrameData): [string, string[]|undefined]|undefined {
-    const code = getField('item_type', 'code', d, ctx)
-    if (code) {
-        return [ code.str(0), getEnums(d, ctx) ]
-    } else {
-        console.log(`item_type.code not found for '${d.header}'`)
-    }
-}
-
-function getSubCategory (d: Data.CifFrame, ctx: FrameData): string|undefined {
-    const value = getField('item_sub_category', 'id', d, ctx)
-    if (value) {
-        return value.str(0)
-    }
-}
-
-function getDescription (d: Data.CifFrame, ctx: FrameData): string|undefined {
-    const value = getField('item_description', 'description', d, ctx)
-    if (value) {
-        // trim (after newlines) and remove references to square brackets
-        return value.str(0).trim()
-            .replace(/(\r\n|\r|\n)([ \t]+)/g, '\n')
-            .replace(/(\[[1-3]\])+ element/, 'elements')
-            .replace(/(\[[1-3]\])+/, '')
-    }
-}
-
-const reMatrixField = /\[[1-3]\]\[[1-3]\]/
-const reVectorField = /\[[1-3]\]/
-
-const FORCE_INT_FIELDS = [
-    '_atom_site.id',
-    '_atom_site.auth_seq_id',
-    '_pdbx_struct_mod_residue.auth_seq_id',
-    '_struct_conf.beg_auth_seq_id',
-    '_struct_conf.end_auth_seq_id',
-    '_struct_conn.ptnr1_auth_seq_id',
-    '_struct_conn.ptnr2_auth_seq_id',
-    '_struct_sheet_range.beg_auth_seq_id',
-    '_struct_sheet_range.end_auth_seq_id',
-];
-
-const COMMA_SEPARATED_LIST_FIELDS = [
-    '_atom_site.pdbx_struct_group_id',
-    '_chem_comp.mon_nstd_parent_comp_id',
-    '_diffrn_radiation.pdbx_wavelength_list',
-    '_diffrn_source.pdbx_wavelength_list',
-    '_em_diffraction.tilt_angle_list', // 20,40,50,55
-    '_em_entity_assembly.entity_id_list',
-    '_entity.pdbx_description', // Endolysin,Beta-2 adrenergic receptor
-    '_entity.pdbx_ec',
-    '_entity_poly.pdbx_strand_id', // A,B
-    '_entity_src_gen.pdbx_gene_src_gene', // ADRB2, ADRB2R, B2AR
-    '_pdbx_depui_entry_details.experimental_methods',
-    '_pdbx_depui_entry_details.requested_accession_types',
-    '_pdbx_soln_scatter_model.software_list', // INSIGHT II, HOMOLOGY, DISCOVERY, BIOPOLYMER, DELPHI
-    '_pdbx_soln_scatter_model.software_author_list', // MSI
-    '_pdbx_soln_scatter_model.entry_fitting_list', // Odd example: 'PDB CODE 1HFI, 1HCC, 1HFH, 1VCC'
-    '_pdbx_struct_assembly_gen.entity_inst_id',
-    '_pdbx_struct_assembly_gen.asym_id_list',
-    '_pdbx_struct_assembly_gen.auth_asym_id_list',
-    '_pdbx_struct_assembly_gen_depositor_info.asym_id_list',
-    '_pdbx_struct_assembly_gen_depositor_info.chain_id_list',
-    '_pdbx_struct_group_list.group_enumeration_type',
-    '_reflns.pdbx_diffrn_id',
-    '_refine.pdbx_diffrn_id',
-    '_reflns_shell.pdbx_diffrn_id',
-    '_struct_keywords.text',
-];
-
-const SPACE_SEPARATED_LIST_FIELDS = [
-    '_chem_comp.pdbx_subcomponent_list', // TSM DPH HIS CHF EMR
-    '_pdbx_soln_scatter.data_reduction_software_list', // OTOKO
-    '_pdbx_soln_scatter.data_analysis_software_list', // SCTPL5 GNOM
-];
-
-const SEMICOLON_SEPARATED_LIST_FIELDS = [
-    '_chem_comp.pdbx_synonyms' // GLYCERIN; PROPANE-1,2,3-TRIOL
-]
-
-/**
- * Useful when a dictionary extension will add enum values to an existing dictionary.
- * By adding them here, the dictionary extension can be tested before the added enum
- * values are available in the existing dictionary.
- */
-const EXTRA_ENUM_VALUES: { [k: string]: string[] } = {
-
-}
-
-export function generateSchema (frames: CifFrame[]) {
-    const schema: Database = {}
-
-    const categories: FrameCategories = {}
-    const links: FrameLinks = {}
-    const ctx = { categories, links }
-
-    // get category metadata
-    frames.forEach(d => {
-        if (d.header[0] === '_') return
-        const categoryKeyNames = new Set<string>()
-        const categoryKey = d.categories['category_key']
-        if (categoryKey) {
-            const categoryKey_names = categoryKey.getField('name')
-            if (categoryKey_names) {
-                for (let i = 0, il = categoryKey_names.rowCount; i < il; ++i) {
-                    categoryKeyNames.add(categoryKey_names.str(i))
-                }
-            }
-        }
-        let description = ''
-        const category = d.categories['category']
-        if (category) {
-            const category_description = category.getField('description')
-            if (category_description) {
-                description = category_description.str(0).trim()
-                    .replace(/(\r\n|\r|\n)([ \t]+)/g, '\n') // remove padding after newlines
-            } else {
-                console.log(`no description given for category '${category}'`)
-            }
-        }
-        if (categoryKeyNames.size === 0) {
-            console.log(`no key given for category '${category}'`)
-        }
-        schema[d.header] = { description, key: categoryKeyNames, columns: {} }
-        // console.log('++++++++++++++++++++++++++++++++++++++++++')
-        // console.log('name', d.header)
-        // console.log('desc', description)
-        // console.log('key', categoryKeyNames)
-    })
-
-    // build list of links between categories
-    frames.forEach(d => {
-        if (d.header[0] !== '_') return
-        categories[d.header] = d
-        const item_linked = d.categories['item_linked']
-        if (item_linked) {
-            const child_name = item_linked.getField('child_name')
-            const parent_name = item_linked.getField('parent_name')
-            if (child_name && parent_name) {
-                for (let i = 0; i < item_linked.rowCount; ++i) {
-                    const childName = child_name.str(i)
-                    const parentName = parent_name.str(i)
-                    if (childName in links && links[childName] !== parentName) {
-                        console.log(`${childName} linked to ${links[childName]}, ignoring link to ${parentName}`)
-                    }
-                    links[childName] = parentName
-                }
-            }
-        }
-    })
-
-    // get field data
-    Object.keys(categories).forEach(fullName => {
-        const d = categories[fullName]
-        if (!d) {
-            console.log(`${fullName} not found, moving on`)
-            return
-        }
-        const categoryName = d.header.substring(1, d.header.indexOf('.'))
-        const itemName = d.header.substring(d.header.indexOf('.') + 1)
-        let fields: { [k: string]: Column }
-        if (categoryName in schema) {
-            fields = schema[categoryName].columns
-        } else {
-            console.log(`category '${categoryName}' has no metadata`)
-            fields = {}
-            schema[categoryName] = {
-                description: '',
-                key: new Set(),
-                columns: fields
-            }
-        }
-
-        const description = getDescription(d, ctx) || ''
-
-        // need to use regex to check for matrix or vector items
-        // as sub_category assignment is missing for some entries
-        const subCategory = getSubCategory(d, ctx)
-        if (subCategory === 'cartesian_coordinate' || subCategory === 'fractional_coordinate') {
-            fields[itemName] = CoordCol(description)
-        } else if (FORCE_INT_FIELDS.includes(d.header)) {
-            fields[itemName] = IntCol(description)
-            console.log(`forcing int: ${d.header}`)
-        } else if (subCategory === 'matrix') {
-            fields[itemName.replace(reMatrixField, '')] = MatrixCol(3, 3, description)
-        } else if (subCategory === 'vector') {
-            fields[itemName.replace(reVectorField, '')] = VectorCol(3, description)
-        } else {
-            if (itemName.match(reMatrixField)) {
-                fields[itemName.replace(reMatrixField, '')] = MatrixCol(3, 3, description)
-                console.log(`${d.header} should have 'matrix' _item_sub_category.id`)
-            } else if (itemName.match(reVectorField)) {
-                fields[itemName.replace(reVectorField, '')] = VectorCol(3, description)
-                console.log(`${d.header} should have 'vector' _item_sub_category.id`)
-            } else {
-                const code = getCode(d, ctx)
-                if (code) {
-                    let fieldType = getFieldType(code[0], description, code[1]);
-                    if (fieldType.type === 'str') {
-                        if (COMMA_SEPARATED_LIST_FIELDS.includes(d.header)) {
-                            fieldType = ListCol('str', ',', description)
-                            console.log(`forcing comma separated: ${d.header}`)
-                        } else if (SPACE_SEPARATED_LIST_FIELDS.includes(d.header)) {
-                            fieldType = ListCol('str', ' ', description)
-                            console.log(`forcing space separated: ${d.header}`)
-                        } else if (SEMICOLON_SEPARATED_LIST_FIELDS.includes(d.header)) {
-                            fieldType = ListCol('str', ';', description)
-                            console.log(`forcing space separated: ${d.header}`)
-                        }
-                    }
-                    if (d.header in EXTRA_ENUM_VALUES) {
-                        if (fieldType.type === 'enum') {
-                            fieldType.values.push(...EXTRA_ENUM_VALUES[d.header])
-                        } else {
-                            console.warn(`expected enum: ${d.header}`)
-                        }
-                    }
-                    fields[itemName] = fieldType
-                } else {
-                    console.log(`could not determine code for '${d.header}'`)
-                }
-            }
-        }
-    })
-
-    return schema
-}

+ 0 - 112
src/apps/schema-generator/util/generate.ts

@@ -1,112 +0,0 @@
-/**
- * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- */
-
-import { Database, Filter, Column } from './schema'
-import { indentString } from '../../../mol-util/string';
-
-function header (name: string, info: string, importDatabasePath = 'mol-data/db') {
-    return `/**
- * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * Code-generated '${name}' schema file. ${info}
- *
- * @author mol-star package (src/apps/schema-generator/generate)
- */
-
-import { Database, Column } from '${importDatabasePath}'
-
-import Schema = Column.Schema`
-}
-
-function footer (name: string) {
-    return `
-export type ${name}_Schema = typeof ${name}_Schema;
-export interface ${name}_Database extends Database<${name}_Schema> {}`
-}
-
-function getTypeShorthands(schema: Database, fields?: Filter) {
-    const types = new Set<string>()
-    Object.keys(schema).forEach(table => {
-        if (fields && !fields[table]) return
-        const { columns} = schema[table]
-        Object.keys(columns).forEach(columnName => {
-            if (fields && !fields[table][columnName]) return
-            types.add(schema[table].columns[columnName].type)
-        })
-    })
-    const shorthands: string[] = []
-    types.forEach(type => {
-        switch (type) {
-            case 'str': shorthands.push('const str = Schema.str;'); break
-            case 'int': shorthands.push('const int = Schema.int;'); break
-            case 'float': shorthands.push('const float = Schema.float;'); break
-            case 'coord': shorthands.push('const coord = Schema.coord;'); break
-            case 'enum': shorthands.push('const Aliased = Schema.Aliased;'); break
-            case 'matrix': shorthands.push('const Matrix = Schema.Matrix;'); break
-            case 'vector': shorthands.push('const Vector = Schema.Vector;'); break
-            case 'list': shorthands.push('const List = Schema.List;'); break
-        }
-    })
-    return shorthands.join('\n')
-}
-
-function getTypeDef(c: Column): string {
-    switch (c.type) {
-        case 'str': return 'str'
-        case 'int': return 'int'
-        case 'float': return 'float'
-        case 'coord': return 'coord'
-        case 'enum':
-            return `Aliased<'${c.values.map(v => v.replace(/'/g, '\\\'')).join(`' | '`)}'>(${c.subType})`
-        case 'matrix':
-            return `Matrix(${c.rows}, ${c.columns})`
-        case 'vector':
-            return `Vector(${c.length})`
-        case 'list':
-            if (c.subType === 'int') {
-                return `List('${c.separator}', x => parseInt(x, 10))`
-            } else if (c.subType === 'float' || c.subType === 'coord') {
-                return `List('${c.separator}', x => parseFloat(x))`
-            } else {
-                return `List('${c.separator}', x => x)`
-            }
-    }
-}
-
-const reSafePropertyName = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/
-function safePropertyString(name: string) { return name.match(reSafePropertyName) ? name : `'${name}'` }
-
-function doc(description: string, spacesCount: number) {
-    const spaces = ' '.repeat(spacesCount)
-    return [
-        `${spaces}/**`,
-        `${indentString(description, 1, `${spaces} * `)}`.replace(/ +\n/g, '\n'),
-        `${spaces} */`
-    ].join('\n')
-}
-
-export function generate (name: string, info: string, schema: Database, fields?: Filter, importDatabasePath?: string) {
-    const codeLines: string[] = []
-
-    codeLines.push(`export const ${name}_Schema = {`)
-    Object.keys(schema).forEach(table => {
-        if (fields && !fields[table]) return
-        const { description, columns} = schema[table]
-        if (description) codeLines.push(doc(description, 4))
-        codeLines.push(`    ${safePropertyString(table)}: {`)
-        Object.keys(columns).forEach(columnName => {
-            if (fields && !fields[table][columnName]) return
-            const c = columns[columnName]
-            const typeDef = getTypeDef(c)
-            if (c.description) codeLines.push(doc(c.description, 8))
-            codeLines.push(`        ${safePropertyString(columnName)}: ${typeDef},`)
-        })
-        codeLines.push('    },')
-    })
-    codeLines.push('}')
-
-    return `${header(name, info, importDatabasePath)}\n\n${getTypeShorthands(schema, fields)}\n\n${codeLines.join('\n')}\n${footer(name)}`
-}

+ 0 - 74
src/apps/schema-generator/util/schema.ts

@@ -1,74 +0,0 @@
-/**
- * Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- */
-
-export interface Database { [ tableName: string ]: Table }
-export interface Table {
-    description: string
-    key: Set<string>
-    columns: { [ columnName: string ]: Column }
-}
-export type Column = IntCol | StrCol | FloatCol | CoordCol | EnumCol | VectorCol | MatrixCol | ListCol
-
-type BaseCol = { description: string }
-
-export type IntCol = { type: 'int' } & BaseCol
-export function IntCol(description: string): IntCol { return { type: 'int', description } }
-
-export type StrCol = { type: 'str' } & BaseCol
-export function StrCol(description: string): StrCol { return { type: 'str', description } }
-
-export type FloatCol = { type: 'float' } & BaseCol
-export function FloatCol(description: string): FloatCol { return { type: 'float', description } }
-
-export type CoordCol = { type: 'coord' } & BaseCol
-export function CoordCol(description: string): CoordCol { return { type: 'coord', description } }
-
-export type EnumCol = { type: 'enum', subType: 'int' | 'str', values: string[] } & BaseCol
-export function EnumCol(values: string[], subType: 'int' | 'str', description: string): EnumCol {
-    return { type: 'enum', description, values, subType }
-}
-
-export type VectorCol = { type: 'vector', length: number } & BaseCol
-export function VectorCol(length: number, description: string): VectorCol {
-    return { type: 'vector', description, length }
-}
-
-export type MatrixCol = { type: 'matrix', rows: number, columns: number } & BaseCol
-export function MatrixCol(columns: number, rows: number, description: string): MatrixCol {
-    return { type: 'matrix', description, columns, rows }
-}
-
-export type ListCol = { type: 'list', subType: 'int' | 'str' | 'float' | 'coord', separator: string } & BaseCol
-export function ListCol(subType: 'int' | 'str' | 'float' | 'coord', separator: string, description: string): ListCol {
-    return { type: 'list', description, separator, subType }
-}
-
-export type Filter = { [ table: string ]: { [ column: string ]: true } }
-
-export function mergeFilters (...filters: Filter[]) {
-    const n = filters.length
-    const mergedFilter: Filter = {}
-    const fields: Map<string, number> = new Map()
-    filters.forEach(filter => {
-        Object.keys(filter).forEach(category => {
-            Object.keys(filter[ category ]).forEach(field => {
-                const key = `${category}.${field}`
-                const value = fields.get(key) || 0
-                fields.set(key, value + 1)
-            })
-        })
-    })
-    fields.forEach((v, k) => {
-        if (v !== n) return
-        const [categoryName, fieldName] = k.split('.')
-        if (categoryName in mergedFilter) {
-            mergedFilter[categoryName][fieldName] = true
-        } else {
-            mergedFilter[categoryName] = { fieldName: true }
-        }
-    })
-    return mergedFilter
-}

+ 1 - 1
src/mol-io/common/binary-cif/array-encoder.ts

@@ -172,7 +172,7 @@ export namespace ArrayEncoding {
         for (let i = 0, n = data.length; i < n; i++) {
             const v = data[i];
             if (v <= min) output[i] = 0;
-            else if (v >= max) output[i] = numSteps;
+            else if (v >= max) output[i] = numSteps - 1;
             else output[i] = (Math.round((v - min) / delta)) | 0;
         }