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

more resilient handling of chemp comp names, isPolymer helper method

parent a3fe5cce
No related branches found
No related tags found
No related merge requests found
...@@ -79,28 +79,28 @@ export enum ComponentType { ...@@ -79,28 +79,28 @@ export enum ComponentType {
/** Chemical component type names for protein */ /** Chemical component type names for protein */
export const ProteinComponentTypeNames = [ export const ProteinComponentTypeNames = [
'D-peptide linking', 'L-peptide linking', 'D-peptide NH3 amino terminus', 'D-PEPTIDE LINKING', 'L-PEPTIDE LINKING', 'D-PEPTIDE NH3 AMINO TERMINUS',
'L-peptide NH3 amino terminus', 'D-peptide COOH carboxy terminus', 'L-PEPTIDE NH3 AMINO TERMINUS', 'D-PEPTIDE COOH CARBOXY TERMINUS',
'L-peptide COOH carboxy terminus', 'peptide linking', 'peptide-like', 'L-PEPTIDE COOH CARBOXY TERMINUS', 'PEPTIDE LINKING', 'PEPTIDE-LIKE',
'L-gamma-peptide, C-delta linking', 'D-gamma-peptide, C-delta linking', 'L-GAMMA-PEPTIDE, C-DELTA LINKING', 'D-GAMMA-PEPTIDE, C-DELTA LINKING',
'L-beta-peptide, C-gamma linking', 'D-beta-peptide, C-gamma linking', 'L-BETA-PEPTIDE, C-GAMMA LINKING', 'D-BETA-PEPTIDE, C-GAMMA LINKING',
] ]
/** Chemical component type names for DNA */ /** Chemical component type names for DNA */
export const DNAComponentTypeNames = [ export const DNAComponentTypeNames = [
'DNA linking', 'L-DNA linking', 'DNA OH 5 prime terminus', 'DNA OH 3 prime terminus', 'DNA LINKING', 'L-DNA LINKING', 'DNA OH 5 PRIME TERMINUS', 'DNA OH 3 PRIME TERMINUS',
] ]
/** Chemical component type names for RNA */ /** Chemical component type names for RNA */
export const RNAComponentTypeNames = [ export const RNAComponentTypeNames = [
'RNA linking', 'L-RNA linking', 'RNA OH 5 prime terminus', 'RNA OH 3 prime terminus', 'RNA LINKING', 'L-RNA LINKING', 'RNA OH 5 PRIME TERMINUS', 'RNA OH 3 PRIME TERMINUS',
] ]
/** Chemical component type names for saccharide */ /** Chemical component type names for saccharide */
export const SaccharideComponentTypeNames = [ export const SaccharideComponentTypeNames = [
'D-saccharide 1,4 and 1,4 linking', 'L-saccharide 1,4 and 1,4 linking', 'D-SACCHARIDE 1,4 AND 1,4 LINKING', 'L-SACCHARIDE 1,4 AND 1,4 LINKING',
'D-saccharide 1,4 and 1,6 linking', 'L-saccharide 1,4 and 1,6 linking', 'L-saccharide', 'D-SACCHARIDE 1,4 AND 1,6 LINKING', 'L-SACCHARIDE 1,4 AND 1,6 LINKING', 'L-SACCHARIDE',
'D-saccharide', 'saccharide', 'D-SACCHARIDE', 'SACCHARIDE',
] ]
/** Common names for water molecules */ /** Common names for water molecules */
...@@ -110,6 +110,8 @@ export const WaterNames = [ ...@@ -110,6 +110,8 @@ export const WaterNames = [
/** get the molecule type from component type and id */ /** get the molecule type from component type and id */
export function getMoleculeType(compType: string, compId: string) { export function getMoleculeType(compType: string, compId: string) {
compType = compType.toUpperCase()
compId = compId.toUpperCase()
if (ProteinComponentTypeNames.includes(compType)) { if (ProteinComponentTypeNames.includes(compType)) {
return MoleculeType.protein return MoleculeType.protein
} else if (RNAComponentTypeNames.includes(compType)) { } else if (RNAComponentTypeNames.includes(compType)) {
...@@ -127,6 +129,10 @@ export function getMoleculeType(compType: string, compId: string) { ...@@ -127,6 +129,10 @@ export function getMoleculeType(compType: string, compId: string) {
} }
} }
export function isPolymer(moleculeType: MoleculeType) {
return moleculeType === MoleculeType.protein || moleculeType === MoleculeType.DNA || moleculeType === MoleculeType.RNA
}
/** /**
* all chemical components with the word "ion" in their name, Sep 2016 * all chemical components with the word "ion" in their name, Sep 2016
* *
......
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