(this["webpackJsonp@jbrowse/web"]=this["webpackJsonp@jbrowse/web"]||[]).push([[45,13],{2305:function(e,t,n){"use strict";n.r(t),n.d(t,"parseVcfBuffer",(function(){return s})),n.d(t,"splitVcfFileHeaderAndBody",(function(){return c}));var r=n(251),a=n(1204),u=n(370),o=[{name:"CHROM",type:"Text"},{name:"POS",type:"Number"},{name:"ID",type:"Text"},{name:"REF",type:"Text"},{name:"ALT",type:"Text"},{name:"QUAL",type:"Number"},{name:"FILTER",type:"Text"},{name:"INFO",type:"Text"},{name:"FORMAT",type:"Text"}];function i(e,t,n){var r=e.parseLine(t),u=new a.a({variant:r,parser:e,id:"vcf-".concat(n)}),o=t.split("\t").map((function(e){return"."===e?"":e}));return 8===o.length&&o.push(""),{id:String(n+1),extendedData:{vcfFeature:u.toJSON()},cells:o.map((function(e,t){return{columnNumber:t,text:e}}))}}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{hasColumnNameLine:!1,columnNameLineNumber:0,isValidRefName:function(){return!1}},n=c(Object(u.bufferToString)(e)),a=n.header,s=n.body,m=[],f=new r.a({header:a});a="",s.split("\n").forEach((function(e,t){/\S/.test(e)&&m.push(i(f,e,t))})),s="";for(var l={isLoaded:!0,rows:m},d=[],p=[],h=0;h<o.length;h+=1)d.push(h),p[h]={name:o[h].name,dataType:{type:o[h].type}};for(var v=0;v<f.samples.length;v+=1){var N=o.length+v;d.push(N),p[N]={name:f.samples[v],dataType:{type:"Text"}}}return d.push(d.length),p.unshift({name:"Location",dataType:{type:"LocString"},isDerived:!0,derivationFunctionText:"jexl:{text:row.extendedData.vcfFeature.refName+':'\n\n    +row.extendedData.vcfFeature.start+'..'+row.extendedData.vcfFeature.end, extendedData:\n\n    {refName:row.extendedData.vcfFeature.refName,start:row.extendedData.vcfFeature.start,end:row.extendedData.vcfFeature.end}}"}),{rowSet:l,columnDisplayOrder:d,hasColumnNames:!0,columns:p,assemblyName:t.selectedAssemblyName}}function c(e){for(var t,n=0;n<e.length;n+=1){var r=e[n];if("\n"===t&&"#"!==r)break;t=r}return{header:e.substr(0,n),body:e.substr(n)}}},370:function(e,t,n){"use strict";n.r(t),n.d(t,"bufferToString",(function(){return c})),n.d(t,"parseCsvBuffer",(function(){return p})),n.d(t,"parseTsvBuffer",(function(){return v}));var r=n(89),a=n(29),u=n(86),o=n(83),i=n.n(o),s=n(85);function c(e){return new TextDecoder("utf-8",{fatal:!0}).decode(e)}function m(e){return f.apply(this,arguments)}function f(){return f=Object(u.a)(i.a.mark((function e(t){var a,u,o=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.length>1&&void 0!==o[1]?o[1]:{},e.next=3,n.e(51).then(n.t.bind(null,602,7)).then((function(e){return e.default}));case 3:return u=e.sent,e.abrupt("return",u(Object(r.a)({noheader:!0,output:"csv"},a)).fromString(c(t)));case 5:case"end":return e.stop()}}),e)}))),f.apply(this,arguments)}function l(e,t,n){var r,a=e.rows[0].cells[t].text||"",u="Text";try{r=Object(s.parseLocString)(a,n)}catch(o){}return r&&r.refName&&"number"===typeof r.start?u="LocString":/^\d+(\.\d+)?$/.test(a)&&(u="Number"),u}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{hasColumnNameLine:!1,columnNameLineNumber:1,isValidRefName:function(){return!1}},n=0,r={isLoaded:!0,rows:e.map((function(e,r){var a=r+(t.hasColumnNameLine?0:1);return e.length>n&&(n=e.length),{id:String(a),cells:e.map((function(e,t){return{columnNumber:t,text:e}}))}}))},u={};if(t.hasColumnNameLine&&void 0!==t.columnNameLineNumber){var o=r.rows.splice(t.columnNameLineNumber-1,1),i=Object(a.a)(o,1),c=i[0];c&&c.cells.forEach((function(e,t){u[t]=e.text||""}))}for(var m=[],f=[],d=function(e){f.push(e);var n=l(r,e,t.isValidRefName);"LocString"===n&&r.rows.forEach((function(n){var r=n.cells[e];r.extendedData=Object(s.parseLocString)(r.text,t.isValidRefName)})),m[e]={name:u[e],dataType:{type:n}}},p=0;p<n;p+=1)d(p);return{rowSet:r,columnDisplayOrder:f,hasColumnNames:!!t.hasColumnNameLine,columns:m,assemblyName:t.selectedAssemblyName}}function p(e){return h.apply(this,arguments)}function h(){return h=Object(u.a)(i.a.mark((function e(t){var n,r,a=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{hasColumnNameLine:!1,columnNameLineNumber:1,isValidRefName:function(){return!1}},e.next=3,m(t);case 3:return r=e.sent,e.abrupt("return",d(r,n));case 5:case"end":return e.stop()}}),e)}))),h.apply(this,arguments)}function v(e){return N.apply(this,arguments)}function N(){return N=Object(u.a)(i.a.mark((function e(t){var n,r,a=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{hasColumnNameLine:!1,columnNameLineNumber:1,isValidRefName:function(){return!1}},e.next=3,m(t,{delimiter:"\t"});case 3:return r=e.sent,e.abrupt("return",d(r,n));case 5:case"end":return e.stop()}}),e)}))),N.apply(this,arguments)}}}]);
//# sourceMappingURL=45.fa9deff8.chunk.js.map