PageSourceSearch

https://zfin.org/dist/4437.8326a0b0d36fc5f79cdc.js

js zfin.org collected 2026-09-24 09:03:24 UTC 2,918 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4437],{4437(e,t,n){n.r(t),n.d(t,{default:()=>y});var r=n(14041),a=n(26219),l=n(21093),i=n(79013),s=n(62526),o=n(65990),c=n(54184),u=n(14538),p=n(69710),m=n(40200),d=n.n(m),g=n(45060),f=n(77099);const h=(0,n(28730).makeStyles)()(e=>({textAreaFont:{fontFamily:"Courier New"},mgap:{display:"flex",flexDirection:"column",gap:e.spacing(4)}}));function y({model:e,handleClose:t}){const{classes:n}=h(),[m,y]=(0,r.useState)(),[E,v]=(0,r.useState)(),[C,w]=(0,r.useState)("");return(0,r.useEffect)(()=>{(async()=>{try{v(void 0);const t=(0,l.getContainingView)(e);if(!t.initialized)return;const{rpcManager:n}=(0,l.getSession)(e),{sources:r,mafFilter:a,adapterConfig:s}=e,o=(0,i.getRpcSessionId)(e),c=await n.call(o,"MultiVariantGetGenotypeMatrix",{regions:t.dynamicBlocks.contentBlocks,sources:r,mafFilter:a,sessionId:o,adapterConfig:s}),u=Object.values(c),p=Object.keys(c),m=`try(library(fastcluster), silent=TRUE)\ninputMatrix<-matrix(c(${u.map(e=>e.genotypes.join(",")).join(",\n")}\n),nrow=${u.length},byrow=TRUE)\nrownames(inputMatrix)<-c(${p.map(e=>`'${e}'`).join(",")})\nresultClusters<-hclust(dist(inputMatrix), method='single')\ncat(resultClusters$order,sep='\\n')`;y(m)}catch(t){!(0,l.isAbortException)(t)&&(0,f.isAlive)(e)&&(console.error(t),v(t))}})()},[e]),r.createElement(a.Dialog,{open:!0,title:"Cluster by genotype",onClose:t},r.createElement(s.A,null,r.createElement("div",{className:n.mgap},r.createElement(o.A,null,"This page will produce an R script that will perform hierarchical clustering on the visible genotype data using `hclust`."),r.createElement(o.A,null,"You can then paste the results in this form to specify the row ordering."),m?r.createElement("div",null,r.createElement("div",null,"Step 1:"," ",r.createElement(c.A,{variant:"contained",onClick:()=>{(0,g.saveAs)(new Blob([m||""],{type:"text/plain;charset=utf-8"}),"cluster.R")}},"Download Rscript")," ","or"," ",r.createElement(c.A,{variant:"contained",onClick:()=>{d()(m||"")}},"Copy Rscript to clipboard"),r.createElement("div",null,r.createElement(u.A,{multiline:!0,fullWidth:!0,variant:"outlined",placeholder:"Step 2. Paste results from Rscript here (sequence of numbers, one per line, specifying the new ordering)",rows:10,value:C,onChange:e=>{w(e.target.value)},slotProps:{input:{classes:{input:n.textAreaFont}}}})))):r.createElement(a.LoadingEllipses,{variant:"h6",title:"Generating genotype matrix"}),E?r.createElement(a.ErrorMessage,{error:E}):null)),r.createElement(p.A,null,r.createElement(c.A,{disabled:!m,variant:"contained",onClick:()=>{const{sources:n}=e;if(n)try{e.setLayout(C.split("\n").map(e=>e.trim()).filter(e=>!!e).map(e=>+e).map(e=>{const t=n[e-1];if(!t)throw new Error(`out of bounds at ${e}`);return t}))}catch(e){console.error(e),v(e)}t()}},"Apply clustering"),r.createElement(c.A,{variant:"contained",color:"secondary",onClick:()=>{t()}},"Cancel")))}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.