@datagrok/bio 2.27.0 → 2.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/287.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[287],{9287(e,o,t){t.d(o,{showAnnotationManagerDialog:()=>d});var n=t(4328),i=t(7389),l=t(6082),a=t(4517),r=t(3736);const s={[a.eI.Structure]:"Structure (FR/CDR)",[a.eI.Liability]:"Liability",[a.eI.PTM]:"Post-translational Modification",[a.eI.Custom]:"Custom"},c={[a.Hq.High]:"High",[a.Hq.Medium]:"Medium",[a.Hq.Low]:"Low",[a.Hq.Info]:"Info"};function d(){const e=n.shell.tv?.dataFrame;if(!e)return void n.shell.warning("No table open");const o=e.columns.bySemTypeAll(l.SEMTYPE.MACROMOLECULE);if(0===o.length)return void n.shell.warning("No macromolecule columns found");let t=o[0];const a=i.input.column("Sequence Column",{table:e,value:t,filter:e=>e.semType===l.SEMTYPE.MACROMOLECULE,onValueChanged:e=>{t=e,u()}}),d=i.divV([],{style:{maxHeight:"380px",overflowY:"auto",paddingRight:"8px"}});function u(){d.innerHTML="";const o=(0,r.Ln)(t);if(0!==o.length)for(const n of o){const o=s[n.category]??n.category,a=n.severity?` [${c[n.severity]??n.severity}]`:"",p=n.start&&n.end?` (${n.start}-${n.end})`:"",g=n.sourceScheme?` ${n.sourceScheme}`:"",h=i.iconFA("trash",()=>{const o=(0,r.Ln)(t).filter(e=>e.id!==n.id);(0,r.fh)(t,o),e.fireValuesChanged(),u()});h.style.cursor="pointer",h.style.color="#999",h.style.marginLeft="8px";const f=n.color??"#ccc";let m=f;const y=i.div([],{style:{width:"12px",height:"12px",borderRadius:"2px",backgroundColor:m,display:"inline-block",marginRight:"6px",flexShrink:"0",cursor:"pointer"}});i.colorPicker(l.Color.fromHtml(n.color??"#ccc"),e=>{m=l.Color.toHtml(e)},y,()=>{const o=(0,r.Ln)(t).map(e=>e.id===n.id?{...e,color:m}:e);(0,r.fh)(t,o),e.fireValuesChanged(),u()},()=>{m=f,y.style.backgroundColor=m});const x=i.divH([y,i.divText(`${n.name}${p}${g}${a}`,{style:{flex:"1",fontSize:"12px",padding:"4px"}}),i.divText(o,{style:{color:"#888",fontSize:"11px",marginRight:"8px"}}),h],{style:{alignItems:"center",padding:"4px 0",borderBottom:"1px solid #eee"}});d.append(x)}else d.append(i.divText("No annotations on this column.",{style:{color:"#888",padding:"8px"}}))}u();const p=i.button("Clear All",()=>{(0,r.OW)(e,t),e.fireValuesChanged(),u(),n.shell.info("All annotations cleared")});i.dialog({title:"Manage Annotations"}).add(i.inputs([a])).add(i.h3("Annotations")).add(d).add(i.divH([p],{style:{marginTop:"8px"}})).onOK(()=>{}).show()}}}]);
1
+ "use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[287],{9287(e,o,t){t.d(o,{showAnnotationManagerDialog:()=>d});var n=t(4328),i=t(7389),l=t(6082),a=t(4517),r=t(3736);const s={[a.eI.Structure]:"Structure (FR/CDR)",[a.eI.Liability]:"Liability",[a.eI.PTM]:"Post-translational Modification",[a.eI.Custom]:"Custom"},c={[a.Hq.High]:"High",[a.Hq.Medium]:"Medium",[a.Hq.Low]:"Low",[a.Hq.Info]:"Info"};function d(){const e=n.shell.tv?.dataFrame;if(!e)return void n.shell.warning("No table open");const o=e.columns.bySemTypeAll(l.SEMTYPE.MACROMOLECULE);if(0===o.length)return void n.shell.warning("No macromolecule columns found");let t=o[0];const a=i.input.column("Sequence Column",{table:e,value:t,filter:e=>e.semType===l.SEMTYPE.MACROMOLECULE,onValueChanged:e=>{t=e,u()}}),d=i.divV([],{style:{maxHeight:"380px",overflowY:"auto",paddingRight:"8px"}});function u(){d.innerHTML="";const o=(0,r.Ln)(t);if(0!==o.length)for(const n of o){const o=s[n.category]??n.category,a=n.severity?` [${c[n.severity]??n.severity}]`:"",p=n.start&&n.end?` (${n.start}-${n.end})`:"",g=n.sourceScheme?` ${n.sourceScheme}`:"",h=i.iconFA("trash",()=>{const o=(0,r.Ln)(t).filter(e=>e.id!==n.id);(0,r.fh)(t,o),e.fireValuesChanged(),u()},"Delete");h.style.cursor="pointer",h.style.color="#999",h.style.marginLeft="8px";const f=n.color??"#ccc";let m=f;const y=i.div([],{style:{width:"12px",height:"12px",borderRadius:"2px",backgroundColor:m,display:"inline-block",marginRight:"6px",flexShrink:"0",cursor:"pointer"}});i.colorPicker(l.Color.fromHtml(n.color??"#ccc"),e=>{m=l.Color.toHtml(e)},y,()=>{const o=(0,r.Ln)(t).map(e=>e.id===n.id?{...e,color:m}:e);(0,r.fh)(t,o),e.fireValuesChanged(),u()},()=>{m=f,y.style.backgroundColor=m});const x=i.divH([y,i.divText(`${n.name}${p}${g}${a}`,{style:{flex:"1",fontSize:"12px",padding:"4px"}}),i.divText(o,{style:{color:"#888",fontSize:"11px",marginRight:"8px"}}),h],{style:{alignItems:"center",padding:"4px 0",borderBottom:"1px solid #eee"}});d.append(x)}else d.append(i.divText("No annotations on this column.",{style:{color:"#888",padding:"8px"}}))}u();const p=i.button("Clear All",()=>{(0,r.OW)(e,t),e.fireValuesChanged(),u(),n.shell.info("All annotations cleared")});i.dialog({title:"Manage Annotations"}).add(i.inputs([a])).add(i.h3("Annotations")).add(d).add(i.divH([p],{style:{marginTop:"8px"}})).onOK(()=>{}).show()}}}]);
2
2
  //# sourceMappingURL=287.js.map
package/dist/287.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"287.js","mappings":"uLAUA,MAAMA,EAAyC,CAC7C,CAAC,KAAmBC,WAAY,qBAChC,CAAC,KAAmBC,WAAY,YAChC,CAAC,KAAmBC,KAAM,kCAC1B,CAAC,KAAmBC,QAAS,UAGzBC,EAAyC,CAC7C,CAAC,KAAkBC,MAAO,OAC1B,CAAC,KAAkBC,QAAS,SAC5B,CAAC,KAAkBC,KAAM,MACzB,CAAC,KAAkBC,MAAO,QAGrB,SAASC,IACd,MAAMC,EAAK,QAAW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Y,IAAKZ,OAAQ,aAG3B,cAAe,QAASa,SAAS5B,EAAMgB,OAAS,QAAUa,IACxDV,EAAe,QAASW,OAAOD,IAC9BT,EAAa,KACd,MAAMT,GAAU,QAAqB5B,GAAagD,IAAKnB,GAAMA,EAAEC,KAAOb,EAAMa,GAAK,IAAID,EAAGI,MAAOG,GAAgBP,IAC/G,QAAqB7B,EAAa4B,GAClCrC,EAAGwC,oBACHtB,KACC,KACD2B,EAAeD,EACfE,EAAY1B,MAAM8B,gBAAkBL,IAGtC,MAAMa,EAAM,OAAQ,CAClBZ,EACA,UAAW,GAAGpB,EAAMiC,OAAO5B,IAAaG,IAAcL,IAAY,CAACT,MAAO,CAACwC,KAAM,IAAKC,SAAU,OAAQC,QAAS,SACjH,UAAWnC,EAAU,CAACP,MAAO,CAACsB,MAAO,OAAQmB,SAAU,OAAQT,YAAa,SAC5EhB,GACC,CAAChB,MAAO,CAAC2C,WAAY,SAAUD,QAAS,QAASE,aAAc,oBAElE7C,EAAQ8C,OAAOP,EACjB,MA/CEvC,EAAQ8C,OAAO,UAAW,iCAAkC,CAAC7C,MAAO,CAACsB,MAAO,OAAQoB,QAAS,SAgDjG,CAEA5C,IAEA,MAAMgD,EAAW,SAAU,YAAa,MACtC,QAAiBlE,EAAIS,GACrBT,EAAGwC,oBACHtB,IACA,QAAWiD,KAAK,6BAGH,SAAU,CAACC,MAAO,uBAC9BC,IAAI,SAAU,CAAC3D,KACf2D,IAAI,KAAM,gBACVA,IAAIlD,GACJkD,IAAI,OAAQ,CAACH,GAAW,CAAC9C,MAAO,CAACkD,UAAW,UAC5CC,KAAK,QAEDC,MACT,C","sources":["webpack://bio/./src/utils/annotations/annotation-manager-ui.ts"],"sourcesContent":["/* eslint-disable max-len */\nimport * as grok from 'datagrok-api/grok';\nimport * as ui from 'datagrok-api/ui';\nimport * as DG from 'datagrok-api/dg';\n\nimport {\n SeqAnnotation, AnnotationCategory, LiabilitySeverity,\n} from '@datagrok-libraries/bio/src/utils/macromolecule/annotations';\nimport {getColumnAnnotations, setColumnAnnotations, clearAnnotations} from './annotation-manager';\n\nconst categoryLabels: Record<string, string> = {\n [AnnotationCategory.Structure]: 'Structure (FR/CDR)',\n [AnnotationCategory.Liability]: 'Liability',\n [AnnotationCategory.PTM]: 'Post-translational Modification',\n [AnnotationCategory.Custom]: 'Custom',\n};\n\nconst severityLabels: Record<string, string> = {\n [LiabilitySeverity.High]: 'High',\n [LiabilitySeverity.Medium]: 'Medium',\n [LiabilitySeverity.Low]: 'Low',\n [LiabilitySeverity.Info]: 'Info',\n};\n\nexport function showAnnotationManagerDialog(): void {\n const df = grok.shell.tv?.dataFrame;\n if (!df) {\n grok.shell.warning('No table open');\n return;\n }\n\n const seqCols = df.columns.bySemTypeAll(DG.SEMTYPE.MACROMOLECULE);\n if (seqCols.length === 0) {\n grok.shell.warning('No macromolecule columns found');\n return;\n }\n\n let selectedCol = seqCols[0];\n const colInput = ui.input.column('Sequence Column', {\n table: df, value: selectedCol,\n filter: (col: DG.Column) => col.semType === DG.SEMTYPE.MACROMOLECULE,\n onValueChanged: (col) => { selectedCol = col!; refreshList(); },\n });\n\n const listDiv = ui.divV([], {style: {maxHeight: '380px', overflowY: 'auto', paddingRight: '8px'}});\n\n function refreshList(): void {\n listDiv.innerHTML = '';\n const annotations = getColumnAnnotations(selectedCol);\n if (annotations.length === 0) {\n listDiv.append(ui.divText('No annotations on this column.', {style: {color: '#888', padding: '8px'}}));\n return;\n }\n\n for (const annot of annotations) {\n const catLabel = categoryLabels[annot.category] ?? annot.category;\n const sevLabel = annot.severity ? ` [${severityLabels[annot.severity] ?? annot.severity}]` : '';\n const rangeLabel = annot.start && annot.end ? ` (${annot.start}-${annot.end})` : '';\n const schemeLabel = annot.sourceScheme ? ` ${annot.sourceScheme}` : '';\n\n const removeBtn = ui.iconFA('trash', () => {\n const updated = getColumnAnnotations(selectedCol).filter((a) => a.id !== annot.id);\n setColumnAnnotations(selectedCol, updated);\n df.fireValuesChanged();\n refreshList();\n });\n removeBtn.style.cursor = 'pointer';\n removeBtn.style.color = '#999';\n removeBtn.style.marginLeft = '8px';\n const originalColor = annot.color ?? '#ccc';\n let currentColor = originalColor;\n const colorSwatch = ui.div([], {style: {\n width: '12px', height: '12px', borderRadius: '2px',\n backgroundColor: currentColor, display: 'inline-block', marginRight: '6px',\n flexShrink: '0', cursor: 'pointer',\n }});\n\n ui.colorPicker(DG.Color.fromHtml(annot.color ?? '#ccc'), (newColor) => {\n currentColor = DG.Color.toHtml(newColor);\n }, colorSwatch, () => {\n const updated = getColumnAnnotations(selectedCol).map((a) => a.id === annot.id ? {...a, color: currentColor} : a);\n setColumnAnnotations(selectedCol, updated);\n df.fireValuesChanged();\n refreshList();\n }, () => {\n currentColor = originalColor;\n colorSwatch.style.backgroundColor = currentColor;\n });\n\n const row = ui.divH([\n colorSwatch,\n ui.divText(`${annot.name}${rangeLabel}${schemeLabel}${sevLabel}`, {style: {flex: '1', fontSize: '12px', padding: '4px'}}),\n ui.divText(catLabel, {style: {color: '#888', fontSize: '11px', marginRight: '8px'}}),\n removeBtn,\n ], {style: {alignItems: 'center', padding: '4px 0', borderBottom: '1px solid #eee'}});\n\n listDiv.append(row);\n }\n }\n\n refreshList();\n\n const clearBtn = ui.button('Clear All', () => {\n clearAnnotations(df, selectedCol);\n df.fireValuesChanged();\n refreshList();\n grok.shell.info('All annotations cleared');\n });\n\n const dialog = ui.dialog({title: 'Manage Annotations'})\n .add(ui.inputs([colInput]))\n .add(ui.h3('Annotations'))\n .add(listDiv)\n .add(ui.divH([clearBtn], {style: {marginTop: '8px'}}))\n .onOK(() => {});\n\n dialog.show();\n}\n"],"names":["categoryLabels","Structure","Liability","PTM","Custom","severityLabels","High","Medium","Low","Info","showAnnotationManagerDialog","df","tv","dataFrame","warning","seqCols","columns","bySemTypeAll","MACROMOLECULE","length","selectedCol","colInput","column","table","value","filter","col","semType","onValueChanged","refreshList","listDiv","style","maxHeight","overflowY","paddingRight","innerHTML","annotations","annot","catLabel","category","sevLabel","severity","rangeLabel","start","end","schemeLabel","sourceScheme","removeBtn","updated","a","id","fireValuesChanged","cursor","color","marginLeft","originalColor","currentColor","colorSwatch","width","height","borderRadius","backgroundColor","display","marginRight","flexShrink","fromHtml","newColor","toHtml","map","row","name","flex","fontSize","padding","alignItems","borderBottom","append","clearBtn","info","title","add","marginTop","onOK","show"],"sourceRoot":""}
1
+ {"version":3,"file":"287.js","mappings":"uLAUA,MAAMA,EAAyC,CAC7C,CAAC,KAAmBC,WAAY,qBAChC,CAAC,KAAmBC,WAAY,YAChC,CAAC,KAAmBC,KAAM,kCAC1B,CAAC,KAAmBC,QAAS,UAGzBC,EAAyC,CAC7C,CAAC,KAAkBC,MAAO,OAC1B,CAAC,KAAkBC,QAAS,SAC5B,CAAC,KAAkBC,KAAM,MACzB,CAAC,KAAkBC,MAAO,QAGrB,SAASC,IACd,MAAMC,EAAK,QAAWC,IAAIC,UAC1B,IAAKF,EAEH,YADA,QAAWG,QAAQ,iBAIrB,MAAMC,EAAUJ,EAAGK,QAAQC,aAAa,UAAWC,eACnD,GAAuB,IAAnBH,EAAQI,OAEV,YADA,QAAWL,QAAQ,kCAIrB,IAAIM,EAAcL,EAAQ,GAC1B,MAAMM,EAAW,QAASC,OAAO,kBAAmB,CAClDC,MAAOZ,EAAIa,MAAOJ,EAClBK,OAASC,GAAmBA,EAAIC,UAAY,UAAWT,cACvDU,eAAiBF,IAAUN,EAAcM,EAAMG,OAG3CC,EAAU,OAAQ,GAAI,CAACC,MAAO,CAACC,UAAW,QAASC,UAAW,OAAQC,aAAc,SAE1F,SAASL,IACPC,EAAQK,UAAY,GACpB,MAAMC,GAAc,QAAqBhB,GACzC,GAA2B,IAAvBgB,EAAYjB,OAKhB,IAAK,MAAMkB,KAASD,EAAa,CAC/B,MAAME,EAAWtC,EAAeqC,EAAME,WAAaF,EAAME,SACnDC,EAAWH,EAAMI,SAAW,KAAKpC,EAAegC,EAAMI,WAAaJ,EAAMI,YAAc,GACvFC,EAAaL,E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,CAAC7C,MAAO,CAACsB,MAAO,OAAQoB,QAAS,SAgDjG,CAEA5C,IAEA,MAAMgD,EAAW,SAAU,YAAa,MACtC,QAAiBlE,EAAIS,GACrBT,EAAGwC,oBACHtB,IACA,QAAWiD,KAAK,6BAGH,SAAU,CAACC,MAAO,uBAC9BC,IAAI,SAAU,CAAC3D,KACf2D,IAAI,KAAM,gBACVA,IAAIlD,GACJkD,IAAI,OAAQ,CAACH,GAAW,CAAC9C,MAAO,CAACkD,UAAW,UAC5CC,KAAK,QAEDC,MACT,C","sources":["webpack://bio/./src/utils/annotations/annotation-manager-ui.ts"],"sourcesContent":["/* eslint-disable max-len */\nimport * as grok from 'datagrok-api/grok';\nimport * as ui from 'datagrok-api/ui';\nimport * as DG from 'datagrok-api/dg';\n\nimport {\n SeqAnnotation, AnnotationCategory, LiabilitySeverity,\n} from '@datagrok-libraries/bio/src/utils/macromolecule/annotations';\nimport {getColumnAnnotations, setColumnAnnotations, clearAnnotations} from './annotation-manager';\n\nconst categoryLabels: Record<string, string> = {\n [AnnotationCategory.Structure]: 'Structure (FR/CDR)',\n [AnnotationCategory.Liability]: 'Liability',\n [AnnotationCategory.PTM]: 'Post-translational Modification',\n [AnnotationCategory.Custom]: 'Custom',\n};\n\nconst severityLabels: Record<string, string> = {\n [LiabilitySeverity.High]: 'High',\n [LiabilitySeverity.Medium]: 'Medium',\n [LiabilitySeverity.Low]: 'Low',\n [LiabilitySeverity.Info]: 'Info',\n};\n\nexport function showAnnotationManagerDialog(): void {\n const df = grok.shell.tv?.dataFrame;\n if (!df) {\n grok.shell.warning('No table open');\n return;\n }\n\n const seqCols = df.columns.bySemTypeAll(DG.SEMTYPE.MACROMOLECULE);\n if (seqCols.length === 0) {\n grok.shell.warning('No macromolecule columns found');\n return;\n }\n\n let selectedCol = seqCols[0];\n const colInput = ui.input.column('Sequence Column', {\n table: df, value: selectedCol,\n filter: (col: DG.Column) => col.semType === DG.SEMTYPE.MACROMOLECULE,\n onValueChanged: (col) => { selectedCol = col!; refreshList(); },\n });\n\n const listDiv = ui.divV([], {style: {maxHeight: '380px', overflowY: 'auto', paddingRight: '8px'}});\n\n function refreshList(): void {\n listDiv.innerHTML = '';\n const annotations = getColumnAnnotations(selectedCol);\n if (annotations.length === 0) {\n listDiv.append(ui.divText('No annotations on this column.', {style: {color: '#888', padding: '8px'}}));\n return;\n }\n\n for (const annot of annotations) {\n const catLabel = categoryLabels[annot.category] ?? annot.category;\n const sevLabel = annot.severity ? ` [${severityLabels[annot.severity] ?? annot.severity}]` : '';\n const rangeLabel = annot.start && annot.end ? ` (${annot.start}-${annot.end})` : '';\n const schemeLabel = annot.sourceScheme ? ` ${annot.sourceScheme}` : '';\n\n const removeBtn = ui.iconFA('trash', () => {\n const updated = getColumnAnnotations(selectedCol).filter((a) => a.id !== annot.id);\n setColumnAnnotations(selectedCol, updated);\n df.fireValuesChanged();\n refreshList();\n }, 'Delete');\n removeBtn.style.cursor = 'pointer';\n removeBtn.style.color = '#999';\n removeBtn.style.marginLeft = '8px';\n const originalColor = annot.color ?? '#ccc';\n let currentColor = originalColor;\n const colorSwatch = ui.div([], {style: {\n width: '12px', height: '12px', borderRadius: '2px',\n backgroundColor: currentColor, display: 'inline-block', marginRight: '6px',\n flexShrink: '0', cursor: 'pointer',\n }});\n\n ui.colorPicker(DG.Color.fromHtml(annot.color ?? '#ccc'), (newColor) => {\n currentColor = DG.Color.toHtml(newColor);\n }, colorSwatch, () => {\n const updated = getColumnAnnotations(selectedCol).map((a) => a.id === annot.id ? {...a, color: currentColor} : a);\n setColumnAnnotations(selectedCol, updated);\n df.fireValuesChanged();\n refreshList();\n }, () => {\n currentColor = originalColor;\n colorSwatch.style.backgroundColor = currentColor;\n });\n\n const row = ui.divH([\n colorSwatch,\n ui.divText(`${annot.name}${rangeLabel}${schemeLabel}${sevLabel}`, {style: {flex: '1', fontSize: '12px', padding: '4px'}}),\n ui.divText(catLabel, {style: {color: '#888', fontSize: '11px', marginRight: '8px'}}),\n removeBtn,\n ], {style: {alignItems: 'center', padding: '4px 0', borderBottom: '1px solid #eee'}});\n\n listDiv.append(row);\n }\n }\n\n refreshList();\n\n const clearBtn = ui.button('Clear All', () => {\n clearAnnotations(df, selectedCol);\n df.fireValuesChanged();\n refreshList();\n grok.shell.info('All annotations cleared');\n });\n\n const dialog = ui.dialog({title: 'Manage Annotations'})\n .add(ui.inputs([colInput]))\n .add(ui.h3('Annotations'))\n .add(listDiv)\n .add(ui.divH([clearBtn], {style: {marginTop: '8px'}}))\n .onOK(() => {});\n\n dialog.show();\n}\n"],"names":["categoryLabels","Structure","Liability","PTM","Custom","severityLabels","High","Medium","Low","Info","showAnnotationManagerDialog","df","tv","dataFrame","warning","seqCols","columns","bySemTypeAll","MACROMOLECULE","length","selectedCol","colInput","column","table","value","filter","col","semType","onValueChanged","refreshList","listDiv","style","maxHeight","overflowY","paddingRight","innerHTML","annotations","annot","catLabel","category","sevLabel","severity","rangeLabel","start","end","schemeLabel","sourceScheme","removeBtn","updated","a","id","fireValuesChanged","cursor","color","marginLeft","originalColor","currentColor","colorSwatch","width","height","borderRadius","backgroundColor","display","marginRight","flexShrink","fromHtml","newColor","toHtml","map","row","name","flex","fontSize","padding","alignItems","borderBottom","append","clearBtn","info","title","add","marginTop","onOK","show"],"sourceRoot":""}
package/dist/422.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[422],{9422(e,t,i){i.d(t,{showLiabilityScannerDialog:()=>c});var n=i(4328),a=i(7389),o=i(6082),l=i(8012),r=i(4517),d=i(3736);const s=[{id:"deamid-ng",name:"Deamidation (NG)",pattern:/NG/g,length:2,severity:r.Hq.High,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"deamid-ns",name:"Deamidation (NS)",pattern:/NS/g,length:2,severity:r.Hq.Medium,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"deamid-na",name:"Deamidation (NA)",pattern:/NA/g,length:2,severity:r.Hq.Low,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"deamid-nd",name:"Deamidation (ND)",pattern:/ND/g,length:2,severity:r.Hq.Low,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"deamid-nt",name:"Deamidation (NT)",pattern:/NT/g,length:2,severity:r.Hq.Low,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"isom-dg",name:"Isomerization (DG)",pattern:/DG/g,length:2,severity:r.Hq.High,ruleCategory:"isomerization",color:r.D5.liability.isomerization,enabled:!0},{id:"isom-ds",name:"Isomerization (DS)",pattern:/DS/g,length:2,severity:r.Hq.Medium,ruleCategory:"isomerization",color:r.D5.liability.isomerization,enabled:!0},{id:"oxid-m",name:"Oxidation (Met)",pattern:/M/g,length:1,severity:r.Hq.Medium,ruleCategory:"oxidation",color:r.D5.liability.oxidation,enabled:!0},{id:"oxid-w",name:"Oxidation (Trp)",pattern:/W/g,length:1,severity:r.Hq.Low,ruleCategory:"oxidation",color:r.D5.liability.oxidation,enabled:!0},{id:"glyco-nxst",name:"N-glycosylation",pattern:/N[^P][ST]/g,length:3,severity:r.Hq.High,ruleCategory:"glycosylation",color:r.D5.liability.glycosylation,enabled:!0},{id:"free-cys",name:"Free Cysteine",pattern:/C/g,length:1,severity:r.Hq.Info,ruleCategory:"freeCysteine",color:r.D5.liability.freeCysteine,enabled:!1}];function u(e,t){const i=e.getSplitted(t),n=new Array(i.length);for(let e=0;e<i.length;e++)n[e]=i.getOriginal(e);return n.join("")}const g={[r.Hq.High]:"High",[r.Hq.Medium]:"Medium",[r.Hq.Low]:"Low",[r.Hq.Info]:"Info"};function c(){const e=n.shell.tv?.dataFrame;if(!e)return void n.shell.warning("No table open");const t=e.columns.bySemTypeAll(o.SEMTYPE.MACROMOLECULE);if(0===t.length)return void n.shell.warning("No macromolecule columns found");const i=s.map(e=>({...e,pattern:new RegExp(e.pattern.source,"g")})),c=a.input.table("Table",{value:e}),m=a.input.column("Sequence",{table:e,value:t[0],filter:e=>e.semType===o.SEMTYPE.MACROMOLECULE}),y=[],p=a.divV([]);for(const e of i){const t=a.input.bool(e.name,{value:e.enabled,tooltipText:`Severity: ${g[e.severity]??e.severity}`});y.push({rule:e,input:t}),p.append(t.root)}const h=a.input.bool("Highlight in cell renderer",{value:!0}),b=a.input.bool("Create annotation column",{value:!0}),f=a.input.bool("Create summary count column",{value:!1}),v=a.dialog({title:"Scan Sequence Liabilities"}).add(a.inputs([c,m])).add(a.h3("Rules")).add(p).add(a.h3("Output")).add(a.inputs([h,b,f])).onOK(()=>{try{const t=m.value,a=l._package.seqHelper.getSeqHandler(t);for(const{rule:e,input:t}of y)e.enabled=t.value;const o=function(e,t,i){const n=i.filter(e=>e.enabled),a=t.posList,o=new Map,l=new Array(e.length);let d=0;for(let i=0;i<e.length;i++){const e=u(t,i),r=[];for(const t of n){let i;for(t.pattern.lastIndex=0;null!==(i=t.pattern.exec(e));)r.push({annotationId:t.id,positionIndex:i.index,positionName:i.index<a.length?a[i.index]:void 0,matchedMonomers:i[0]}),o.set(t.id,(o.get(t.id)??0)+1),d++}l[i]=r}return{annotations:n.filter(e=>o.has(e.id)).map(e=>({id:e.id,name:e.name,description:`${e.ruleCategory} liability pattern (${o.get(e.id)} hits)`,start:null,end:null,visualType:1===e.length?r.ao.Point:r.ao.Motif,category:r.eI.Liability,color:e.color,severity:e.severity,motifPattern:e.pattern.source,autoGenerated:!0})),rowData:l,totalHits:d}}(t,a,i);(b.value||h.value)&&function(e,t,i){const n=(0,d.Ln)(t).filter(e=>e.category!==r.eI.Liability);(0,d.fh)(t,[...n,...i.annotations]);const a=(0,d.Lz)(e,t);for(let e=0;e<i.rowData.length;e++){const t=(0,d.JG)(a,e)??[];(0,d.z5)(a,e,(0,d.bq)(t,i.rowData[e],!1,!0))}}(e,t,o),f.value&&function(e,t,i){const n=`${t.name}_liability_count`,a=i.rowData.map(e=>e.length),o=e.columns.addNewInt(n);for(let e=0;e<a.length;e++)o.set(e,a[e])}(e,t,o),n.shell.info(`Liability scan: ${o.totalHits} hits found across ${o.annotations.length} rules`),e.fireValuesChanged()}catch(e){n.shell.error(`Liability scan failed: ${e.message??e}`),console.error(e)}});v.show()}}}]);
1
+ "use strict";(self.webpackChunkbio=self.webpackChunkbio||[]).push([[422],{9422(e,t,i){i.d(t,{showLiabilityScannerDialog:()=>c});var n=i(4328),a=i(7389),o=i(6082),l=i(9462),r=i(4517),d=i(3736);const s=[{id:"deamid-ng",name:"Deamidation (NG)",pattern:/NG/g,length:2,severity:r.Hq.High,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"deamid-ns",name:"Deamidation (NS)",pattern:/NS/g,length:2,severity:r.Hq.Medium,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"deamid-na",name:"Deamidation (NA)",pattern:/NA/g,length:2,severity:r.Hq.Low,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"deamid-nd",name:"Deamidation (ND)",pattern:/ND/g,length:2,severity:r.Hq.Low,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"deamid-nt",name:"Deamidation (NT)",pattern:/NT/g,length:2,severity:r.Hq.Low,ruleCategory:"deamidation",color:r.D5.liability.deamidation,enabled:!0},{id:"isom-dg",name:"Isomerization (DG)",pattern:/DG/g,length:2,severity:r.Hq.High,ruleCategory:"isomerization",color:r.D5.liability.isomerization,enabled:!0},{id:"isom-ds",name:"Isomerization (DS)",pattern:/DS/g,length:2,severity:r.Hq.Medium,ruleCategory:"isomerization",color:r.D5.liability.isomerization,enabled:!0},{id:"oxid-m",name:"Oxidation (Met)",pattern:/M/g,length:1,severity:r.Hq.Medium,ruleCategory:"oxidation",color:r.D5.liability.oxidation,enabled:!0},{id:"oxid-w",name:"Oxidation (Trp)",pattern:/W/g,length:1,severity:r.Hq.Low,ruleCategory:"oxidation",color:r.D5.liability.oxidation,enabled:!0},{id:"glyco-nxst",name:"N-glycosylation",pattern:/N[^P][ST]/g,length:3,severity:r.Hq.High,ruleCategory:"glycosylation",color:r.D5.liability.glycosylation,enabled:!0},{id:"free-cys",name:"Free Cysteine",pattern:/C/g,length:1,severity:r.Hq.Info,ruleCategory:"freeCysteine",color:r.D5.liability.freeCysteine,enabled:!1}];function u(e,t){const i=e.getSplitted(t),n=new Array(i.length);for(let e=0;e<i.length;e++)n[e]=i.getOriginal(e);return n.join("")}const g={[r.Hq.High]:"High",[r.Hq.Medium]:"Medium",[r.Hq.Low]:"Low",[r.Hq.Info]:"Info"};function c(){const e=n.shell.tv?.dataFrame;if(!e)return void n.shell.warning("No table open");const t=e.columns.bySemTypeAll(o.SEMTYPE.MACROMOLECULE);if(0===t.length)return void n.shell.warning("No macromolecule columns found");const i=s.map(e=>({...e,pattern:new RegExp(e.pattern.source,"g")})),c=a.input.table("Table",{value:e}),m=a.input.column("Sequence",{table:e,value:t[0],filter:e=>e.semType===o.SEMTYPE.MACROMOLECULE}),y=[],p=a.divV([]);for(const e of i){const t=a.input.bool(e.name,{value:e.enabled,tooltipText:`Severity: ${g[e.severity]??e.severity}`});y.push({rule:e,input:t}),p.append(t.root)}const h=a.input.bool("Highlight in cell renderer",{value:!0}),b=a.input.bool("Create annotation column",{value:!0}),f=a.input.bool("Create summary count column",{value:!1}),v=a.dialog({title:"Scan Sequence Liabilities"}).add(a.inputs([c,m])).add(a.h3("Rules")).add(p).add(a.h3("Output")).add(a.inputs([h,b,f])).onOK(()=>{try{const t=m.value,a=l._package.seqHelper.getSeqHandler(t);for(const{rule:e,input:t}of y)e.enabled=t.value;const o=function(e,t,i){const n=i.filter(e=>e.enabled),a=t.posList,o=new Map,l=new Array(e.length);let d=0;for(let i=0;i<e.length;i++){const e=u(t,i),r=[];for(const t of n){let i;for(t.pattern.lastIndex=0;null!==(i=t.pattern.exec(e));)r.push({annotationId:t.id,positionIndex:i.index,positionName:i.index<a.length?a[i.index]:void 0,matchedMonomers:i[0]}),o.set(t.id,(o.get(t.id)??0)+1),d++}l[i]=r}return{annotations:n.filter(e=>o.has(e.id)).map(e=>({id:e.id,name:e.name,description:`${e.ruleCategory} liability pattern (${o.get(e.id)} hits)`,start:null,end:null,visualType:1===e.length?r.ao.Point:r.ao.Motif,category:r.eI.Liability,color:e.color,severity:e.severity,motifPattern:e.pattern.source,autoGenerated:!0})),rowData:l,totalHits:d}}(t,a,i);(b.value||h.value)&&function(e,t,i){const n=(0,d.Ln)(t).filter(e=>e.category!==r.eI.Liability);(0,d.fh)(t,[...n,...i.annotations]);const a=(0,d.Lz)(e,t);for(let e=0;e<i.rowData.length;e++){const t=(0,d.JG)(a,e)??[];(0,d.z5)(a,e,(0,d.bq)(t,i.rowData[e],!1,!0))}}(e,t,o),f.value&&function(e,t,i){const n=`${t.name}_liability_count`,a=i.rowData.map(e=>e.length),o=e.columns.addNewInt(n);for(let e=0;e<a.length;e++)o.set(e,a[e])}(e,t,o),n.shell.info(`Liability scan: ${o.totalHits} hits found across ${o.annotations.length} rules`),e.fireValuesChanged()}catch(e){n.shell.error(`Liability scan failed: ${e.message??e}`),console.error(e)}});v.show()}}}]);
2
2
  //# sourceMappingURL=422.js.map