You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>The JavaScript String prototype has been extended to allow access to the
444
447
format fields for each sample. The string representation of values in
445
448
the sample column are accessible as properties on the string matching
446
-
the sample name named after the <codeclass="docutils literal"><spanclass="pre">FORMAT</span></code> field <codeclass="docutils literal"><spanclass="pre">ID</span></code> These properties can
447
-
be assigned in order to make modifications. This will be undefined for fields
448
-
not declared in the header.</p>
449
+
the sample name named after the <codeclass="docutils literal"><spanclass="pre">FORMAT</span></code> field <codeclass="docutils literal"><spanclass="pre">ID</span></code>.</p>
<p>Note that these properties are only defined for fields that are declared
455
+
in the VCF header (any that are not declared in the header will be
456
+
undefined). See below for how to add new <codeclass="docutils literal"><spanclass="pre">INFO</span></code> or <codeclass="docutils literal"><spanclass="pre">FORMAT</span></code> field
457
+
declarations.</p>
458
+
</div>
459
+
</div>
460
+
<divclass="section" id="vcf-record-modification">
461
+
<h3>VCF record modification<aclass="headerlink" href="#vcf-record-modification" title="Permalink to this headline">¶</a></h3>
462
+
<p>Most components of VCF records can be written or updated in a fairly
463
+
natural manner by direct assignment in order to make modifications. For
464
+
example:</p>
465
+
<divclass="highlight-text"><divclass="highlight"><pre><span></span>ID = "rs23987382"; // Will change the ID value
466
+
QUAL = "50"; // Will change the QUAL value
467
+
FILTER = "FAIL"; // Will set the FILTER value
468
+
INFO.DPR = "0.01"; // Will change the value of the DPR info field
451
469
'NA12877'.DP = "10"; // Will change the DP field of the NA12877 sample
452
470
</pre></div>
453
471
</div>
472
+
<p>Other components of the VCF record (such as <codeclass="docutils literal"><spanclass="pre">CHROM</span></code>, <codeclass="docutils literal"><spanclass="pre">POS</span></code>, <codeclass="docutils literal"><spanclass="pre">REF</span></code>,
473
+
and <codeclass="docutils literal"><spanclass="pre">ALT</span></code>) are considered immutable and can not currently be altered.</p>
474
+
<p>Direct assignment to <codeclass="docutils literal"><spanclass="pre">ID</span></code> and <codeclass="docutils literal"><spanclass="pre">FILTER</span></code> fields accept either a string
475
+
containing semicolon separated values, or a list of values. For example:</p>
<h3>VCF header modification<aclass="headerlink" href="#vcf-header-modification" title="Permalink to this headline">¶</a></h3>
458
-
<p>Functions are provided that allow the addition of new <codeclass="docutils literal"><spanclass="pre">INFO</span></code> or <codeclass="docutils literal"><spanclass="pre">FORMAT</span></code>
459
-
fields to the header and records. It is recommended that the following
460
-
functions only be used within the run-once portion of <codeclass="docutils literal"><spanclass="pre">--javascript</span></code>.
461
-
They may be called on every record, but this will be slow.</p>
503
+
<p>Functions are provided that allow the addition of new <codeclass="docutils literal"><spanclass="pre">FILTER</span></code>,
504
+
<codeclass="docutils literal"><spanclass="pre">INFO</span></code> and <codeclass="docutils literal"><spanclass="pre">FORMAT</span></code>fields to the header and records. It is
505
+
recommended that the following functions only be used within the
506
+
run-once portion of <codeclass="docutils literal"><spanclass="pre">--javascript</span></code>.</p>
<h4>ensureFormatHeader(FORMAT_HEADER_STRING)<aclass="headerlink" href="#ensureformatheader-format-header-string" title="Permalink to this headline">¶</a></h4>
464
509
<p>Add a new <codeclass="docutils literal"><spanclass="pre">FORMAT</span></code> field to the VCF if it is not already present. This
<h4>ensureFilterHeader(FILTER_HEADER_STRING)<aclass="headerlink" href="#ensurefilterheader-filter-header-string" title="Permalink to this headline">¶</a></h4>
529
+
<p>Add a new <codeclass="docutils literal"><spanclass="pre">FILTER</span></code> field to the VCF header if it is not already
530
+
present. This will add an <codeclass="docutils literal"><spanclass="pre">FILTER</span></code> declaration line to the header.</p>
<h3>Additional information and functions<aclass="headerlink" href="#additional-information-and-functions" title="Permalink to this headline">¶</a></h3>
@@ -495,6 +549,16 @@ <h4>print({STRING})<a class="headerlink" href="#print-string" title="Permalink t
0 commit comments