import{m as R,o as T,r as u,R as e,b as B,E as A,F as m,a2 as P,P as p,G as g,K as D,a as F}from"./rpcWorker-CVTx5FIM.js";const I=R()(n=>({paper:{padding:n.spacing(2),margin:n.spacing(2)},field:{margin:n.spacing(2)}})),L=["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 b(n){const{flag:t=0,setFlag:r}=n;return e.createElement(e.Fragment,null,e.createElement(g,{type:"number",value:t,onChange:s=>{r(+s.target.value)}}),L.map((s,o)=>{const a=t&1<<o,l=`${s}_${a}`;return e.createElement("div",{key:l},e.createElement("input",{type:"checkbox",checked:!!a,onChange:d=>{d.target.checked?r(t|1<<o):r(t&~(1<<o))}}),e.createElement("label",{htmlFor:l},s))}))}const $=T(function(n){var t,r;const{model:s,handleClose:o}=n,{classes:a}=I(),{filterBy:l}=s,[d,x]=u.useState(l.flagInclude),[v,N]=u.useState(l.flagExclude),[i,k]=u.useState(((t=l.tagFilter)===null||t===void 0?void 0:t.tag)||""),[E,C]=u.useState(((r=l.tagFilter)===null||r===void 0?void 0:r.value)||""),[f,S]=u.useState(l.readName||""),h=/^[A-Za-z][A-Za-z0-9]$/.exec(i),y="https://broadinstitute.github.io/picard/explain-flags.html";return e.createElement(B.Dialog,{open:!0,onClose:o,title:"Filter options"},e.createElement(A,null,e.createElement(m,null,"Set filter bitmask options. Refer to ",e.createElement(P,{href:y},y)," ","for details"),e.createElement(p,{className:a.paper,variant:"outlined"},e.createElement("div",{style:{display:"flex"}},e.createElement("div",null,e.createElement(m,null,"Read must have ALL these flags"),e.createElement(b,{flag:d,setFlag:x})),e.createElement("div",null,e.createElement(m,null,"Read must have NONE of these flags"),e.createElement(b,{flag:v,setFlag:N})))),e.createElement(p,{className:a.paper,variant:"outlined"},e.createElement(m,null,"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"),e.createElement(g,{className:a.field,value:i,onChange:c=>{k(c.target.value)},placeholder:"Enter tag name",error:i.length===2&&!h,helperText:i.length===2&&!h?"Not a valid tag":"",slotProps:{htmlInput:{maxLength:2}}}),e.createElement(g,{className:a.field,value:E,onChange:c=>{C(c.target.value)},placeholder:"Enter tag value"})),e.createElement(p,{className:a.paper,variant:"outlined"},e.createElement(m,null,"Filter by read name"),e.createElement(g,{className:a.field,value:f,onChange:c=>{S(c.target.value)},placeholder:"Enter read name"})),e.createElement(D,null,e.createElement(F,{variant:"contained",color:"primary",autoFocus:!0,type:"submit",onClick:()=>{s.setFilterBy({flagInclude:d,flagExclude:v,readName:f,tagFilter:i!==""?{tag:i,value:E}:void 0}),o()}},"Submit"),e.createElement(F,{variant:"contained",color:"secondary",onClick:()=>{o()}},"Cancel"))))});export{$ as default};
