Преглед на файлове

Issue #2: logging by debug util

cycle20 преди 2 години
родител
ревизия
67d10e91d3
променени са 4 файла, в които са добавени 17 реда и са изтрити 17 реда
  1. 3 3
      src/extensions/tmdet/coloring.ts
  2. 8 8
      src/extensions/tmdet/debug-utils.ts
  3. 3 3
      src/extensions/tmdet/prop.ts
  4. 3 3
      src/extensions/tmdet/transformation.ts

+ 3 - 3
src/extensions/tmdet/coloring.ts

@@ -19,8 +19,8 @@ export const StripedResidues = CustomElementProperty.create<number>({
     label: 'TMDet Topology Colors',
     name: 'tmdet-topology-colors',
     getData(model: Model) {
-        // console.log('getData', model.atomicHierarchy.residueAtomSegments);
-        // console.log('getData: auth_comp_id', model.atomicHierarchy.atoms.auth_comp_id.toArray());
+        // DebugUtil.log('getData', model.atomicHierarchy.residueAtomSegments);
+        // DebugUtil.log('getData: auth_comp_id', model.atomicHierarchy.atoms.auth_comp_id.toArray());
         const map = new Map<ElementIndex, number>();
         const residueIndex = model.atomicHierarchy.residueAtomSegments.index;
         for (let i = 0, _i = model.atomicHierarchy.atoms._rowCount; i < _i; i++) {
@@ -28,7 +28,7 @@ export const StripedResidues = CustomElementProperty.create<number>({
             const value = (residueId === 310) ? 2 : residueId % 2;
             map.set(i as ElementIndex, value);
         }
-        // console.log('map', map);
+        // DebugUtil.log('map', map);
         return { value: map };
     },
     coloring: {

+ 8 - 8
src/extensions/tmdet/debug-utils.ts

@@ -45,15 +45,15 @@ export namespace DebugUtil {
 
     export function transformVector(v: Vec3, matrix: Mat4): Vec3 {
         const result = Vec3.transformMat4(Vec3(), v, matrix);
-        console.log("transformVector: Input v & matrix:", v, Mat4.makeTable(matrix));
-        console.log("transformVector: Result vector:", result);
+        log("transformVector: Input v & matrix:", v, Mat4.makeTable(matrix));
+        log("transformVector: Result vector:", result);
         return result;
     }
 
     export function descriptorMxToMat4(matrix: PDBTMTransformationMatrix): Mat4 {
-        console.log("descriptorMxToMat4: Input:", matrix);
+        log("descriptorMxToMat4: Input:", matrix);
         const result = transformationForStateTransform(matrix);
-        console.log("descriptorMxToMat4: Result:", result);
+        log("descriptorMxToMat4: Result:", result);
         return result;
     }
 
@@ -83,7 +83,7 @@ export namespace DebugUtil {
     // in case of mmCIF format
     export function dumpAtomProperties(authAtomId: number) {
         const model: Model|undefined = getModelOfFirstStructure();
-        console.log("First model:", model);
+        log("First model:", model);
         if(!model) {
             return;
         }
@@ -94,7 +94,7 @@ export namespace DebugUtil {
         const atom_site = db.atom_site;
         for (let index = 0; index < rowCount; index++) {
             if (conformation.atomId.value(index) == authAtomId) {
-                console.log("Model Atom Conformation:", {
+                log("Model Atom Conformation:", {
                     atomIdParameter: authAtomId,
                     atomId: conformation.atomId.value(index),
                     coords: [
@@ -105,7 +105,7 @@ export namespace DebugUtil {
                     xyzDefined: conformation.xyzDefined
                 });
 
-                console.log("Atom Source Data (mmCIF database):", {
+                log("Atom Source Data (mmCIF database):", {
                     authId: atom_site.auth_atom_id.value(index),
                     compId: atom_site.auth_comp_id.value(index),
                     authAsymId: atom_site.auth_asym_id.value(index),
@@ -126,7 +126,7 @@ export namespace DebugUtil {
         getCurrentHierarchy().structures.forEach(struct => {
             let cIndex = 0;
             struct.components.forEach(component => {
-                console.log(`struct: ${sIndex}; component: ${cIndex}`, component.cell.cache);
+                log(`struct: ${sIndex}; component: ${cIndex}`, component.cell.cache);
                 cIndex++;
             });
             sIndex++;

+ 3 - 3
src/extensions/tmdet/prop.ts

@@ -97,14 +97,14 @@ export const MembraneOrientationProvider: CustomStructureProperty.Provider<Membr
     defaultParams: MembraneOrientationParams,
 //    getParams: (data: Structure) => MembraneOrientationParams,
     getParams: function(data: Structure) {
-        //window.console.log('getParams:: DEBUG', MembraneOrientationParams);
+        //DebugUtil.log('getParams:: DEBUG', MembraneOrientationParams);
         return MembraneOrientationParams;
     },
     isApplicable: (data: Structure) => true,
     obtain: async (ctx: CustomProperty.Context, data: Structure, props: Partial<MembraneOrientationProps>) => {
-        //window.console.log('obtain:: DEBUG', data.customPropertyDescriptors);
+        //DebugUtil.log('obtain:: DEBUG', data.customPropertyDescriptors);
         let result = membraneOrientation;
-        //console.log("RESULT of 'obtain:'", result);
+        //DebugUtil.log("RESULT of 'obtain:'", result);
         return { value: result };
     }
 });

+ 3 - 3
src/extensions/tmdet/transformation.ts

@@ -105,7 +105,7 @@ export function chainTransformation(plugin: PluginUIContext, transformationMatri
             })
         );
     update.commit();
-    console.log(`${chainId}->${newId} DONE`);
+    DebugUtil.log(`${chainId}->${newId} DONE`);
 }
 
 // function vadd(a: Vec3, b: Vec3): Vec3 {
@@ -148,12 +148,12 @@ export function transformationForStateTransform(tmatrix: PDBTMTransformationMatr
         tmatrix.rowy.t,
         tmatrix.rowz.t
     ));
-    // TODO: console.log('MAT4\n', Mat4.makeTable(mx));
+    // TODO: DebugUtil.log('MAT4\n', Mat4.makeTable(mx));
     return mx;
 }
 
 export function getAtomGroupExpression(chainId: string, auth_array: number[]): Expression {
-    // TODO console.log('auth_array:', auth_array);
+    // TODO DebugUtil.log('auth_array:', auth_array);
     const query: Expression =
         MS.struct.generator.atomGroups({
             'residue-test': MS.core.set.has([MS.set( ...auth_array ), MS.ammp('auth_seq_id')]),