Browse Source

lipid query and component

Alexander Rose 4 years ago
parent
commit
a937e3c57d

+ 3 - 1
src/mol-model/structure/model/properties/common.ts

@@ -11,7 +11,9 @@ import { EntityIndex } from '../indexing';
 
 export type EntitySubtype = (
     mmCIF_Schema['entity_poly']['type']['T'] |
-    mmCIF_Schema['pdbx_entity_branch']['type']['T']
+    mmCIF_Schema['pdbx_entity_branch']['type']['T'] |
+    'ion' |
+    'lipid'
 )
 export const EntitySubtype = Column.Schema.Aliased<EntitySubtype>(Column.Schema.Str(''));
 

+ 10 - 1
src/mol-model/structure/model/types.ts

@@ -10,6 +10,7 @@ import { SaccharideCompIdMap } from '../structure/carbohydrates/constants';
 import { mmCIF_Schema } from '../../../mol-io/reader/cif/schema/mmcif';
 import { SetUtils } from '../../../mol-util/set';
 import { EntitySubtype, ChemicalComponent } from './properties/common';
+import { LipidNames } from './types/lipids';
 
 const _esCache = (function () {
     const cache = Object.create(null);
@@ -57,6 +58,8 @@ export const enum MoleculeType {
     Water,
     /** Small ionic molecule */
     Ion,
+    /** Lipid molecule */
+    Lipid,
     /** Protein, e.g. component type included in `ProteinComponentTypeNames` */
     Protein,
     /** RNA, e.g. component type included in `RNAComponentTypeNames` */
@@ -224,7 +227,7 @@ export const OtherComponentTypeNames = new Set([
 
 /** Common names for water molecules */
 export const WaterNames = new Set([
-    'SOL', 'WAT', 'HOH', 'H2O', 'W', 'DOD', 'D3O', 'TIP3', 'TIP4', 'SPC'
+    'SOL', 'WAT', 'HOH', 'H2O', 'W', 'DOD', 'D3O', 'TIP', 'TIP3', 'TIP4', 'SPC'
 ]);
 
 export const AminoAcidNamesL = new Set([
@@ -293,6 +296,8 @@ export function getMoleculeType(compType: string, compId: string): MoleculeType
         return MoleculeType.Water;
     } else if (IonNames.has(compId)) {
         return MoleculeType.Ion;
+    } else if (LipidNames.has(compId)) {
+        return MoleculeType.Lipid;
     } else if (OtherComponentTypeNames.has(compType)) {
         if (SaccharideCompIdMap.has(compId)) {
             // trust our saccharide table more than given 'non-polymer' or 'other' component type
@@ -395,6 +400,10 @@ export function getEntitySubtype(compId: string, compType: string): EntitySubtyp
         return 'polyribonucleotide';
     } else if (DnaBaseNames.has(compId)) {
         return 'polydeoxyribonucleotide';
+    } else if (IonNames.has(compId)) {
+        return 'ion';
+    } else if (LipidNames.has(compId)) {
+        return 'lipid';
     } else {
         return 'other';
     }

+ 2 - 0
src/mol-plugin-state/builder/structure/representation-preset.ts

@@ -123,6 +123,7 @@ const polymerAndLigand = StructureRepresentationPresetProvider({
             nonStandard: await presetStaticComponent(plugin, structureCell, 'non-standard'),
             branched: await presetStaticComponent(plugin, structureCell, 'branched', { label: 'Carbohydrate' }),
             water: await presetStaticComponent(plugin, structureCell, 'water'),
+            lipid: await presetStaticComponent(plugin, structureCell, 'lipid'),
             coarse: await presetStaticComponent(plugin, structureCell, 'coarse')
         };
 
@@ -139,6 +140,7 @@ const polymerAndLigand = StructureRepresentationPresetProvider({
             branchedBallAndStick: builder.buildRepresentation(update, components.branched, { type: 'ball-and-stick', typeParams: { ...typeParams, alpha: 0.3 }, color }, { tag: 'branched-ball-and-stick' }),
             branchedSnfg3d: builder.buildRepresentation(update, components.branched, { type: 'carbohydrate', typeParams, color }, { tag: 'branched-snfg-3d' }),
             water: builder.buildRepresentation(update, components.water, { type: 'ball-and-stick', typeParams: { ...typeParams, alpha: 0.6 }, color }, { tag: 'water' }),
+            lipid: builder.buildRepresentation(update, components.lipid, { type: 'ball-and-stick', typeParams: { ...typeParams, alpha: 0.6 }, color, colorParams: { carbonByChainId: false } }, { tag: 'lipid' }),
             coarse: builder.buildRepresentation(update, components.coarse, { type: 'spacefill', typeParams, color: color || 'chain-id' }, { tag: 'coarse' })
         };
 

+ 2 - 0
src/mol-plugin-state/helpers/structure-component.ts

@@ -22,6 +22,7 @@ export const StaticStructureComponentTypes = [
     'protein',
     'nucleic',
     'water',
+    'lipid',
 
     'branched',
     'ligand',
@@ -60,6 +61,7 @@ export function createStructureComponent(a: Structure, params: StructureComponen
                 case 'protein': query = StructureSelectionQueries.protein.query; label = 'Protein'; break;
                 case 'nucleic': query = StructureSelectionQueries.nucleic.query; label = 'Nucleic'; break;
                 case 'water': query = Queries.internal.water(); label = 'Water'; break;
+                case 'lipid': query = StructureSelectionQueries.lipid.query; label = 'Lipid'; break;
 
                 case 'branched': query = StructureSelectionQueries.branchedPlusConnected.query; label = 'Branched'; break;
                 case 'ligand': query = StructureSelectionQueries.ligandPlusConnected.query; label = 'Ligand'; break;

+ 15 - 1
src/mol-plugin-state/helpers/structure-selection-query.ts

@@ -268,6 +268,18 @@ const water = StructureSelectionQuery('Water', MS.struct.modifier.union([
     })
 ]), { category: StructureSelectionCategory.Type });
 
+const ion = StructureSelectionQuery('Ion', MS.struct.modifier.union([
+    MS.struct.generator.atomGroups({
+        'entity-test': MS.core.rel.eq([MS.ammp('entitySubtype'), 'ion'])
+    })
+]), { category: StructureSelectionCategory.Type });
+
+const lipid = StructureSelectionQuery('Lipid', MS.struct.modifier.union([
+    MS.struct.generator.atomGroups({
+        'entity-test': MS.core.rel.eq([MS.ammp('entitySubtype'), 'lipid'])
+    })
+]), { category: StructureSelectionCategory.Type });
+
 const branched = StructureSelectionQuery('Carbohydrate', MS.struct.modifier.union([
     MS.struct.generator.atomGroups({
         'entity-test': MS.core.logic.or([
@@ -306,7 +318,7 @@ const ligand = StructureSelectionQuery('Ligand', MS.struct.modifier.union([
                         MS.core.rel.neq([MS.ammp('entityPrdId'), ''])
                     ]),
                     MS.core.logic.not([MS.core.str.match([
-                        MS.re('oligosaccharide', 'i'),
+                        MS.re('(oligosaccharide|lipid)', 'i'),
                         MS.ammp('entitySubtype')
                     ])])
                 ]),
@@ -608,6 +620,8 @@ export const StructureSelectionQueries = {
     helix,
     beta,
     water,
+    ion,
+    lipid,
     branched,
     branchedPlusConnected,
     branchedConnectedOnly,