Skip to content
Snippets Groups Projects
Commit dda4eb27 authored by Alexander Rose's avatar Alexander Rose
Browse files

wip, common chem comps

parent 1db00af7
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ import { getSecondaryStructureMmCif } from './mmcif/secondary-structure'; ...@@ -24,7 +24,7 @@ import { getSecondaryStructureMmCif } from './mmcif/secondary-structure';
import { getSequence } from './mmcif/sequence'; import { getSequence } from './mmcif/sequence';
import { sortAtomSite } from './mmcif/sort'; import { sortAtomSite } from './mmcif/sort';
import { StructConn } from './mmcif/bonds/struct_conn'; import { StructConn } from './mmcif/bonds/struct_conn';
import { ChemicalComponent, ChemicalComponentMap } from '../properties/chemical-component'; import { ChemicalComponent, ChemicalComponentMap, CommonChemicalComponentMap } from '../properties/chemical-component';
import { ComponentType, getMoleculeType, MoleculeType } from '../types'; import { ComponentType, getMoleculeType, MoleculeType } from '../types';
import mmCIF_Format = Format.mmCIF import mmCIF_Format = Format.mmCIF
...@@ -90,23 +90,28 @@ function getModifiedResidueNameMap(format: mmCIF_Format): Model['properties']['m ...@@ -90,23 +90,28 @@ function getModifiedResidueNameMap(format: mmCIF_Format): Model['properties']['m
} }
function getChemicalComponentMap(format: mmCIF_Format): ChemicalComponentMap { function getChemicalComponentMap(format: mmCIF_Format): ChemicalComponentMap {
const map = new Map<string, ChemicalComponent>(); const { chem_comp } = format.data
const { id, type, name, pdbx_synonyms, formula, formula_weight } = format.data.chem_comp if (chem_comp._rowCount > 0) {
for (let i = 0, il = id.rowCount; i < il; ++i) { const map = new Map<string, ChemicalComponent>();
const _id = id.value(i) const { id, type, name, pdbx_synonyms, formula, formula_weight } = format.data.chem_comp
const _type = type.value(i) for (let i = 0, il = id.rowCount; i < il; ++i) {
const cc: ChemicalComponent = { const _id = id.value(i)
id: _id, const _type = type.value(i)
type: ComponentType[_type], const cc: ChemicalComponent = {
moleculeType: getMoleculeType(_type, _id), id: _id,
name: name.value(i), type: ComponentType[_type],
synonyms: pdbx_synonyms.value(i), moleculeType: getMoleculeType(_type, _id),
formula: formula.value(i), name: name.value(i),
formulaWeight: formula_weight.value(i), synonyms: pdbx_synonyms.value(i),
formula: formula.value(i),
formulaWeight: formula_weight.value(i),
}
map.set(_id, cc)
} }
map.set(_id, cc) return map
} else {
return CommonChemicalComponentMap
} }
return map
} }
function getSaccharideComponentMap(format: mmCIF_Format): SaccharideComponentMap { function getSaccharideComponentMap(format: mmCIF_Format): SaccharideComponentMap {
......
...@@ -16,4 +16,209 @@ export interface ChemicalComponent { ...@@ -16,4 +16,209 @@ export interface ChemicalComponent {
formulaWeight: number formulaWeight: number
} }
export type ChemicalComponentMap = ReadonlyMap<string, ChemicalComponent> export type ChemicalComponentMap = ReadonlyMap<string, ChemicalComponent>
\ No newline at end of file
const CommonChemicalComponents: ChemicalComponent[] = [
{
id: 'ALA',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'ALANINE',
synonyms: [],
formula: 'C3 H7 N O2',
formulaWeight: 89.093
},
{
id: 'ARG',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'ARGININE',
synonyms: [],
formula: 'C6 H15 N4 O2 1',
formulaWeight: 175.209
},
{
id: 'ASN',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'ASPARAGINE',
synonyms: [],
formula: 'C4 H8 N2 O3',
formulaWeight: 132.118
},
{
id: 'ASP',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'ASPARTIC ACID',
synonyms: [],
formula: 'C4 H7 N O4',
formulaWeight: 133.103
},
{
id: 'CYS',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'CYSTEINE',
synonyms: [],
formula: 'C3 H7 N O2 S',
formulaWeight: 121.158
},
{
id: 'GLN',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'GLUTAMINE',
synonyms: [],
formula: 'C5 H10 N2 O3',
formulaWeight: 146.144
},
{
id: 'GLU',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'GLUTAMIC ACID',
synonyms: [],
formula: 'C5 H9 N O4',
formulaWeight: 147.129
},
{
id: 'GLY',
type: ComponentType['peptide linking'],
moleculeType: MoleculeType.protein,
name: 'GLYCINE',
synonyms: [],
formula: 'C2 H5 N O2',
formulaWeight: 75.067
},
{
id: 'HIS',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'HISTIDINE',
synonyms: [],
formula: 'C6 H10 N3 O2 1',
formulaWeight: 156.162
},
{
id: 'ILE',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'ISOLEUCINE',
synonyms: [],
formula: 'C6 H13 N O2',
formulaWeight: 131.173
},
{
id: 'LEU',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'LEUCINE',
synonyms: [],
formula: 'C6 H13 N O2',
formulaWeight: 131.173
},
{
id: 'LYS',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'LYSINE',
synonyms: [],
formula: 'C6 H15 N2 O2 1',
formulaWeight: 147.195
},
{
id: 'MET',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'METHIONINE',
synonyms: [],
formula: 'C5 H11 N O2 S',
formulaWeight: 149.211
},
{
id: 'PHE',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'PHENYLALANINE',
synonyms: [],
formula: 'C9 H11 N O2',
formulaWeight: 165.19
},
{
id: 'PRO',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'PROLINE',
synonyms: [],
formula: 'C5 H9 N O2',
formulaWeight: 115.13
},
{ // 'O' as per IUPAC definition
id: 'PYL',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'PYRROLYSINE',
synonyms: [],
formula: 'C12 H21 N3 O3',
formulaWeight: 255.31
},
{ // 'U' as per IUPAC definition
id: 'SEC',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'SELENOCYSTEINE',
synonyms: [],
formula: 'C3 H7 N O2 Se',
formulaWeight: 168.05
},
{
id: 'SER',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'SERINE',
synonyms: [],
formula: 'C3 H7 N O3',
formulaWeight: 105.09
},
{
id: 'THR',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'THREONINE',
synonyms: [],
formula: 'C4 H9 N O3',
formulaWeight: 119.12
},
{
id: 'TRP',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'TRYPTOPHAN',
synonyms: [],
formula: 'C11 H12 N2 O2',
formulaWeight: 204.22
},
{
id: 'TYR',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'TYROSINE',
synonyms: [],
formula: 'C9 H11 N O3',
formulaWeight: 181.19
},
{
id: 'VAL',
type: ComponentType['L-peptide linking'],
moleculeType: MoleculeType.protein,
name: 'VALINE',
synonyms: [],
formula: 'C5 H11 N O2',
formulaWeight: 117.15
}
]
export const CommonChemicalComponentMap = new Map()
for (let i = 0, il = CommonChemicalComponents.length; i < il; ++i) {
CommonChemicalComponentMap.set(CommonChemicalComponents[i].id, CommonChemicalComponents[i])
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment