"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[130],{40130:(e,a,t)=>{t.r(a),t.d(a,{default:()=>j});var l=t(67758),r=t(7552),n=t(67112),s=t(93062),i=t(76218),d=t(61282),o=t(65895),c=t(95054),p=t(30698),h=t(69092),u=t(68446),g=t(75785),m=t(69500);const x=(0,g.n9)()(e=>({paper:{padding:e.spacing(2),margin:e.spacing(2)},field:{margin:e.spacing(2)}})),v=["read paired","read mapped in proper pair","read unmapped","mate unmapped","read reverse strand","mate reverse strand","first in pair","second in pair","not primary alignment","read fails platform/vendor quality checks","read is PCR or optical duplicate","supplementary alignment"];function f(e){const a=(0,l.c)(11),{flag:t,setFlag:r}=e,n=void 0===t?0:t;let i,d,o,c;return a[0]!==r?(i=e=>{r(+e.target.value)},a[0]=r,a[1]=i):i=a[1],a[2]!==n||a[3]!==i?(d=(0,m.jsx)(s.A,{type:"number",value:n,onChange:i}),a[2]=n,a[3]=i,a[4]=d):d=a[4],a[5]!==n||a[6]!==r?(o=v.map((e,a)=>{const t=n&1<<a,l=`${e}_${t}`;return(0,m.jsxs)("div",{children:[(0,m.jsx)("input",{type:"checkbox",checked:Boolean(t),onChange:e=>{e.target.checked?r(n|1<<a):r(n&~(1<<a))}}),(0,m.jsx)("label",{htmlFor:l,children:e})]},l)}),a[5]=n,a[6]=r,a[7]=o):o=a[7],a[8]!==d||a[9]!==o?(c=(0,m.jsxs)(m.Fragment,{children:[d,o]}),a[8]=d,a[9]=o,a[10]=c):c=a[10],c}const j=(0,u.observer)(function(e){const{model:a,handleClose:t}=e,{classes:l}=x(),{filterBy:u}=a,[g,v]=(0,r.useState)(u.flagInclude),[j,A]=(0,r.useState)(u.flagExclude),[b,y]=(0,r.useState)(u.tagFilter?.tag||""),[C,F]=(0,r.useState)(u.tagFilter?.value||""),[k,N]=(0,r.useState)(u.readName||""),S=/^[A-Za-z][A-Za-z0-9]$/.exec(b),w="https://broadinstitute.github.io/picard/explain-flags.html";return(0,m.jsx)(n.Dialog,{open:!0,onClose:t,title:"Filter options",children:(0,m.jsxs)(i.A,{children:[(0,m.jsxs)(d.A,{children:["Set filter bitmask options. Refer to ",(0,m.jsx)(o.A,{href:w,children:w})," ","for details"]}),(0,m.jsx)(c.A,{className:l.paper,variant:"outlined",children:(0,m.jsxs)("div",{style:{display:"flex"},children:[(0,m.jsxs)("div",{children:[(0,m.jsx)(d.A,{children:"Read must have ALL these flags"}),(0,m.jsx)(f,{flag:g,setFlag:v})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)(d.A,{children:"Read must have NONE of these flags"}),(0,m.jsx)(f,{flag:j,setFlag:A})]})]})}),(0,m.jsxs)(c.A,{className:l.paper,variant:"outlined",children:[(0,m.jsx)(d.A,{children:"Filter by tag name and value. Use * in the value field to get all reads containing any value for that tag. Example: filter tag name SA with value * to get all split/supplementary reads. Other examples include HP for haplotype, or RG for read group"}),(0,m.jsx)(s.A,{className:l.field,value:b,onChange:e=>{y(e.target.value)},placeholder:"Enter tag name",error:2===b.length&&!S,helperText:2!==b.length||S?"":"Not a valid tag",slotProps:{htmlInput:{maxLength:2}}}),(0,m.jsx)(s.A,{className:l.field,value:C,onChange:e=>{F(e.target.value)},placeholder:"Enter tag value"})]}),(0,m.jsxs)(c.A,{className:l.paper,variant:"outlined",children:[(0,m.jsx)(d.A,{children:"Filter by read name"}),(0,m.jsx)(s.A,{className:l.field,value:k,onChange:e=>{N(e.target.value)},placeholder:"Enter read name"})]}),(0,m.jsxs)(p.A,{children:[(0,m.jsx)(h.A,{variant:"contained",color:"primary",autoFocus:!0,type:"submit",onClick:()=>{a.setFilterBy({flagInclude:g,flagExclude:j,readName:k,tagFilter:""!==b?{tag:b,value:C}:void 0}),t()},children:"Submit"}),(0,m.jsx)(h.A,{variant:"contained",color:"secondary",onClick:()=>{t()},children:"Cancel"})]})]})})})}}]);
//# sourceMappingURL=130.24c32f81.chunk.js.map