Skip to content

Commit 5d95907

Browse files
committed
Update RTG User Manual.
1 parent 9ea7b46 commit 5d95907

File tree

13 files changed

+549
-217
lines changed

13 files changed

+549
-217
lines changed
Binary file not shown.

installer/resources/tools/RTGOperationsManual/_sources/appendix.rst.txt

Lines changed: 89 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ column of the same name.
351351
352352
CHROM; // "1"
353353
POS; // "11259340"
354+
ID; // "."
354355
REF; // "G"
356+
QUAL; // "."
355357
356358
ALT, FILTER
357359
```````````
@@ -378,32 +380,86 @@ declared in the header.
378380
INFO.DP; // "795"
379381
INFO.ABC; // "4,5"
380382
381-
INFO.DPR = "0.01"; // Will change the value of the DPR info field
382-
383383
384384
{SAMPLE\_NAME}.{FORMAT\_FIELD}
385385
``````````````````````````````
386386

387387
The JavaScript String prototype has been extended to allow access to the
388388
format fields for each sample. The string representation of values in
389389
the sample column are accessible as properties on the string matching
390-
the sample name named after the ``FORMAT`` field ``ID`` These properties can
391-
be assigned in order to make modifications. This will be undefined for fields
392-
not declared in the header.
390+
the sample name named after the ``FORMAT`` field ``ID``.
393391

394392
.. code-block:: text
395393
396394
'NA12877'.GT; // "1/2"
397395
'NA12878'.GT; // "1/0"
396+
397+
Note that these properties are only defined for fields that are declared
398+
in the VCF header (any that are not declared in the header will be
399+
undefined). See below for how to add new ``INFO`` or ``FORMAT`` field
400+
declarations.
401+
402+
403+
VCF record modification
404+
~~~~~~~~~~~~~~~~~~~~~~~
405+
406+
Most components of VCF records can be written or updated in a fairly
407+
natural manner by direct assignment in order to make modifications. For
408+
example:
409+
410+
.. code-block:: text
411+
412+
ID = "rs23987382"; // Will change the ID value
413+
QUAL = "50"; // Will change the QUAL value
414+
FILTER = "FAIL"; // Will set the FILTER value
415+
INFO.DPR = "0.01"; // Will change the value of the DPR info field
398416
'NA12877'.DP = "10"; // Will change the DP field of the NA12877 sample
399417
418+
Other components of the VCF record (such as ``CHROM``, ``POS``, ``REF``,
419+
and ``ALT``) are considered immutable and can not currently be altered.
420+
421+
Direct assignment to ``ID`` and ``FILTER`` fields accept either a string
422+
containing semicolon separated values, or a list of values. For example:
423+
424+
.. code-block:: text
425+
426+
ID = 'rs23987382;COSM3805';
427+
ID = ['rs23987382', 'COSM3805'];
428+
FILTER = 'BAZ;BANG';
429+
FILTER = ['BAZ', 'BANG'];
430+
431+
432+
Note that although the ``FILTER`` field returns an array when read, any
433+
changes made to this array directly are not reflected back into the VCF
434+
record.
435+
436+
Adding a filter to existing filters is a common operation and can be
437+
accomplished by the above assignment methods, for example by adding a
438+
value to the existing list and then setting the result:
439+
440+
.. code-block:: text
441+
442+
var f = FILTER;
443+
f.push('BOING');
444+
FILTER = f;
445+
446+
However, since this is a little unwieldy, a convenience function called
447+
`add()` can be used (and may be chained):
448+
449+
.. code-block:: text
450+
451+
FILTER.add('BOING');
452+
FILTER.add(['BOING', 'DOING');
453+
FILTER.add('BOING').add('DOING');
454+
455+
400456
VCF header modification
401457
~~~~~~~~~~~~~~~~~~~~~~~
402458

403-
Functions are provided that allow the addition of new ``INFO`` or ``FORMAT``
404-
fields to the header and records. It is recommended that the following
405-
functions only be used within the run-once portion of ``--javascript``.
406-
They may be called on every record, but this will be slow.
459+
Functions are provided that allow the addition of new ``FILTER``,
460+
``INFO`` and ``FORMAT`` fields to the header and records. It is
461+
recommended that the following functions only be used within the
462+
run-once portion of ``--javascript``.
407463

408464
ensureFormatHeader(FORMAT\_HEADER\_STRING)
409465
``````````````````````````````````````````
@@ -429,6 +485,17 @@ corresponding accessor methods for use in record processing.
429485
ensureInfoHeader('##INFO=<ID=CT,Number=1,Type=Integer,' +
430486
'Description="Coverage threshold that was applied">');
431487
488+
ensureFilterHeader(FILTER\_HEADER\_STRING)
489+
``````````````````````````````````````````
490+
491+
Add a new ``FILTER`` field to the VCF header if it is not already
492+
present. This will add an ``FILTER`` declaration line to the header.
493+
494+
.. code-block:: text
495+
496+
ensureFilterHeader('##INFO=<ID=FAIL_VAL,' +
497+
'Description="Failed validation">');
498+
432499
Additional information and functions
433500
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
434501

@@ -450,6 +517,19 @@ Writes the provided string to standard output.
450517
451518
print('The samples are: ' + SAMPLES);
452519
520+
checkMinVersion(RTG_MINIMUM_VERSION)
521+
````````````````````````````````````
522+
523+
Checks the version of RTG that the script is running under, and exits
524+
with an error message if the version of RTG does not meet the minimum
525+
required version. This is useful when distributing scripts that make use
526+
of features that are not present in earlier versions of RTG.
527+
528+
.. code-block:: text
529+
530+
checkMinVersion('3.9.2');
531+
532+
453533
.. seealso::
454534
For javascript filtering usage and examples see :ref:`vcffilter`
455535

installer/resources/tools/RTGOperationsManual/_static/bizstyle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ $(window).resize(function(){
3636
$("li.nav-item-0 a").text("Top");
3737
}
3838
else {
39-
$("li.nav-item-0 a").text("RTG Tools Operations Manual v3.9");
39+
$("li.nav-item-0 a").text("RTG Tools Operations Manual v3.10");
4040
}
4141
});

installer/resources/tools/RTGOperationsManual/administration.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
<head>
88
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
99

10-
<title>Administration &amp; Capacity Planning &#8212; RTG Tools Operations Manual v3.9</title>
10+
<title>Administration &amp; Capacity Planning &#8212; RTG Tools Operations Manual v3.10</title>
1111

1212
<link rel="stylesheet" href="_static/bizstyle.css" type="text/css" />
1313
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
1414

1515
<script type="text/javascript">
1616
var DOCUMENTATION_OPTIONS = {
1717
URL_ROOT: './',
18-
VERSION: '3.9',
18+
VERSION: '3.10',
1919
COLLAPSE_INDEX: false,
2020
FILE_SUFFIX: '.html',
2121
HAS_SOURCE: true,
@@ -48,7 +48,7 @@ <h3>Navigation</h3>
4848
<li class="right" >
4949
<a href="product_usage.html" title="RTG product usage - baseline progressions"
5050
accesskey="P">previous</a> |</li>
51-
<li class="nav-item nav-item-0"><a href="index.html">RTG Tools Operations Manual v3.9</a> &#187;</li>
51+
<li class="nav-item nav-item-0"><a href="index.html">RTG Tools Operations Manual v3.10</a> &#187;</li>
5252
</ul>
5353
</div>
5454
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
@@ -377,7 +377,7 @@ <h3>Navigation</h3>
377377
<li class="right" >
378378
<a href="product_usage.html" title="RTG product usage - baseline progressions"
379379
>previous</a> |</li>
380-
<li class="nav-item nav-item-0"><a href="index.html">RTG Tools Operations Manual v3.9</a> &#187;</li>
380+
<li class="nav-item nav-item-0"><a href="index.html">RTG Tools Operations Manual v3.10</a> &#187;</li>
381381
</ul>
382382
</div>
383383
<div class="footer" role="contentinfo">

installer/resources/tools/RTGOperationsManual/appendix.html

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
<head>
88
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
99

10-
<title>Appendix &#8212; RTG Tools Operations Manual v3.9</title>
10+
<title>Appendix &#8212; RTG Tools Operations Manual v3.10</title>
1111

1212
<link rel="stylesheet" href="_static/bizstyle.css" type="text/css" />
1313
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
1414

1515
<script type="text/javascript">
1616
var DOCUMENTATION_OPTIONS = {
1717
URL_ROOT: './',
18-
VERSION: '3.9',
18+
VERSION: '3.10',
1919
COLLAPSE_INDEX: false,
2020
FILE_SUFFIX: '.html',
2121
HAS_SOURCE: true,
@@ -44,7 +44,7 @@ <h3>Navigation</h3>
4444
<li class="right" >
4545
<a href="administration.html" title="Administration &amp; Capacity Planning"
4646
accesskey="P">previous</a> |</li>
47-
<li class="nav-item nav-item-0"><a href="index.html">RTG Tools Operations Manual v3.9</a> &#187;</li>
47+
<li class="nav-item nav-item-0"><a href="index.html">RTG Tools Operations Manual v3.10</a> &#187;</li>
4848
</ul>
4949
</div>
5050
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
@@ -66,14 +66,17 @@ <h3><a href="index.html">Table Of Contents</a></h3>
6666
<li><a class="reference internal" href="#sample-name-format-field">{SAMPLE_NAME}.{FORMAT_FIELD}</a></li>
6767
</ul>
6868
</li>
69+
<li><a class="reference internal" href="#vcf-record-modification">VCF record modification</a></li>
6970
<li><a class="reference internal" href="#vcf-header-modification">VCF header modification</a><ul>
7071
<li><a class="reference internal" href="#ensureformatheader-format-header-string">ensureFormatHeader(FORMAT_HEADER_STRING)</a></li>
7172
<li><a class="reference internal" href="#ensureinfoheader-info-header-string">ensureInfoHeader(INFO_HEADER_STRING)</a></li>
73+
<li><a class="reference internal" href="#ensurefilterheader-filter-header-string">ensureFilterHeader(FILTER_HEADER_STRING)</a></li>
7274
</ul>
7375
</li>
7476
<li><a class="reference internal" href="#additional-information-and-functions">Additional information and functions</a><ul>
7577
<li><a class="reference internal" href="#samples">SAMPLES</a></li>
7678
<li><a class="reference internal" href="#print-string">print({STRING})</a></li>
79+
<li><a class="reference internal" href="#checkminversion-rtg-minimum-version">checkMinVersion(RTG_MINIMUM_VERSION)</a></li>
7780
</ul>
7881
</li>
7982
</ul>
@@ -411,7 +414,9 @@ <h4>CHROM, POS, ID, REF, QUAL<a class="headerlink" href="#chrom-pos-id-ref-qual"
411414
column of the same name.</p>
412415
<div class="highlight-text"><div class="highlight"><pre><span></span>CHROM; // &quot;1&quot;
413416
POS; // &quot;11259340&quot;
417+
ID; // &quot;.&quot;
414418
REF; // &quot;G&quot;
419+
QUAL; // &quot;.&quot;
415420
</pre></div>
416421
</div>
417422
</div>
@@ -433,8 +438,6 @@ <h4>INFO.{INFO_FIELD}<a class="headerlink" href="#info-info-field" title="Permal
433438
declared in the header.</p>
434439
<div class="highlight-text"><div class="highlight"><pre><span></span>INFO.DP; // &quot;795&quot;
435440
INFO.ABC; // &quot;4,5&quot;
436-
437-
INFO.DPR = &quot;0.01&quot;; // Will change the value of the DPR info field
438441
</pre></div>
439442
</div>
440443
</div>
@@ -443,22 +446,64 @@ <h4>{SAMPLE_NAME}.{FORMAT_FIELD}<a class="headerlink" href="#sample-name-format-
443446
<p>The JavaScript String prototype has been extended to allow access to the
444447
format fields for each sample. The string representation of values in
445448
the sample column are accessible as properties on the string matching
446-
the sample name named after the <code class="docutils literal"><span class="pre">FORMAT</span></code> field <code class="docutils literal"><span class="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 <code class="docutils literal"><span class="pre">FORMAT</span></code> field <code class="docutils literal"><span class="pre">ID</span></code>.</p>
449450
<div class="highlight-text"><div class="highlight"><pre><span></span>&#39;NA12877&#39;.GT; // &quot;1/2&quot;
450451
&#39;NA12878&#39;.GT; // &quot;1/0&quot;
452+
</pre></div>
453+
</div>
454+
<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 <code class="docutils literal"><span class="pre">INFO</span></code> or <code class="docutils literal"><span class="pre">FORMAT</span></code> field
457+
declarations.</p>
458+
</div>
459+
</div>
460+
<div class="section" id="vcf-record-modification">
461+
<h3>VCF record modification<a class="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+
<div class="highlight-text"><div class="highlight"><pre><span></span>ID = &quot;rs23987382&quot;; // Will change the ID value
466+
QUAL = &quot;50&quot;; // Will change the QUAL value
467+
FILTER = &quot;FAIL&quot;; // Will set the FILTER value
468+
INFO.DPR = &quot;0.01&quot;; // Will change the value of the DPR info field
451469
&#39;NA12877&#39;.DP = &quot;10&quot;; // Will change the DP field of the NA12877 sample
452470
</pre></div>
453471
</div>
472+
<p>Other components of the VCF record (such as <code class="docutils literal"><span class="pre">CHROM</span></code>, <code class="docutils literal"><span class="pre">POS</span></code>, <code class="docutils literal"><span class="pre">REF</span></code>,
473+
and <code class="docutils literal"><span class="pre">ALT</span></code>) are considered immutable and can not currently be altered.</p>
474+
<p>Direct assignment to <code class="docutils literal"><span class="pre">ID</span></code> and <code class="docutils literal"><span class="pre">FILTER</span></code> fields accept either a string
475+
containing semicolon separated values, or a list of values. For example:</p>
476+
<div class="highlight-text"><div class="highlight"><pre><span></span>ID = &#39;rs23987382;COSM3805&#39;;
477+
ID = [&#39;rs23987382&#39;, &#39;COSM3805&#39;];
478+
FILTER = &#39;BAZ;BANG&#39;;
479+
FILTER = [&#39;BAZ&#39;, &#39;BANG&#39;];
480+
</pre></div>
481+
</div>
482+
<p>Note that although the <code class="docutils literal"><span class="pre">FILTER</span></code> field returns an array when read, any
483+
changes made to this array directly are not reflected back into the VCF
484+
record.</p>
485+
<p>Adding a filter to existing filters is a common operation and can be
486+
accomplished by the above assignment methods, for example by adding a
487+
value to the existing list and then setting the result:</p>
488+
<div class="highlight-text"><div class="highlight"><pre><span></span>var f = FILTER;
489+
f.push(&#39;BOING&#39;);
490+
FILTER = f;
491+
</pre></div>
492+
</div>
493+
<p>However, since this is a little unwieldy, a convenience function called
494+
<cite>add()</cite> can be used (and may be chained):</p>
495+
<div class="highlight-text"><div class="highlight"><pre><span></span>FILTER.add(&#39;BOING&#39;);
496+
FILTER.add([&#39;BOING&#39;, &#39;DOING&#39;);
497+
FILTER.add(&#39;BOING&#39;).add(&#39;DOING&#39;);
498+
</pre></div>
454499
</div>
455500
</div>
456501
<div class="section" id="vcf-header-modification">
457502
<h3>VCF header modification<a class="headerlink" href="#vcf-header-modification" title="Permalink to this headline"></a></h3>
458-
<p>Functions are provided that allow the addition of new <code class="docutils literal"><span class="pre">INFO</span></code> or <code class="docutils literal"><span class="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 <code class="docutils literal"><span class="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 <code class="docutils literal"><span class="pre">FILTER</span></code>,
504+
<code class="docutils literal"><span class="pre">INFO</span></code> and <code class="docutils literal"><span class="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 <code class="docutils literal"><span class="pre">--javascript</span></code>.</p>
462507
<div class="section" id="ensureformatheader-format-header-string">
463508
<h4>ensureFormatHeader(FORMAT_HEADER_STRING)<a class="headerlink" href="#ensureformatheader-format-header-string" title="Permalink to this headline"></a></h4>
464509
<p>Add a new <code class="docutils literal"><span class="pre">FORMAT</span></code> field to the VCF if it is not already present. This
@@ -479,6 +524,15 @@ <h4>ensureInfoHeader(INFO_HEADER_STRING)<a class="headerlink" href="#ensureinfoh
479524
</pre></div>
480525
</div>
481526
</div>
527+
<div class="section" id="ensurefilterheader-filter-header-string">
528+
<h4>ensureFilterHeader(FILTER_HEADER_STRING)<a class="headerlink" href="#ensurefilterheader-filter-header-string" title="Permalink to this headline"></a></h4>
529+
<p>Add a new <code class="docutils literal"><span class="pre">FILTER</span></code> field to the VCF header if it is not already
530+
present. This will add an <code class="docutils literal"><span class="pre">FILTER</span></code> declaration line to the header.</p>
531+
<div class="highlight-text"><div class="highlight"><pre><span></span>ensureFilterHeader(&#39;##INFO=&lt;ID=FAIL_VAL,&#39; +
532+
&#39;Description=&quot;Failed validation&quot;&gt;&#39;);
533+
</pre></div>
534+
</div>
535+
</div>
482536
</div>
483537
<div class="section" id="additional-information-and-functions">
484538
<h3>Additional information and functions<a class="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
495549
<div class="highlight-text"><div class="highlight"><pre><span></span>print(&#39;The samples are: &#39; + SAMPLES);
496550
</pre></div>
497551
</div>
552+
</div>
553+
<div class="section" id="checkminversion-rtg-minimum-version">
554+
<h4>checkMinVersion(RTG_MINIMUM_VERSION)<a class="headerlink" href="#checkminversion-rtg-minimum-version" title="Permalink to this headline"></a></h4>
555+
<p>Checks the version of RTG that the script is running under, and exits
556+
with an error message if the version of RTG does not meet the minimum
557+
required version. This is useful when distributing scripts that make use
558+
of features that are not present in earlier versions of RTG.</p>
559+
<div class="highlight-text"><div class="highlight"><pre><span></span>checkMinVersion(&#39;3.9.2&#39;);
560+
</pre></div>
561+
</div>
498562
<div class="admonition seealso">
499563
<p class="first admonition-title">See also</p>
500564
<p class="last">For javascript filtering usage and examples see <a class="reference internal" href="rtg_command_reference.html#vcffilter"><span class="std std-ref">vcffilter</span></a></p>
@@ -813,7 +877,7 @@ <h3>Navigation</h3>
813877
<li class="right" >
814878
<a href="administration.html" title="Administration &amp; Capacity Planning"
815879
>previous</a> |</li>
816-
<li class="nav-item nav-item-0"><a href="index.html">RTG Tools Operations Manual v3.9</a> &#187;</li>
880+
<li class="nav-item nav-item-0"><a href="index.html">RTG Tools Operations Manual v3.10</a> &#187;</li>
817881
</ul>
818882
</div>
819883
<div class="footer" role="contentinfo">

0 commit comments

Comments
 (0)