<?php

    include '../../../common/include/common.php';
    include_once '../../config.php';
    $module = modules::GATK;
    printHeader($module, "Picard | Tool Documentation Index", "Guide");
?>

<link type='text/css' rel='stylesheet' href='picardDoc.css'>

<div class='row-fluid' id="top">

	<#include "common.html"/>

	<#macro argumentlist name myargs>
		<#if myargs?size != 0>
			<tr>
				<th colspan="4" id="row-divider">${name}</th>
			</tr>
			<#list myargs as arg>
				<tr>
					<td><a href="#${arg.name}">${arg.name}</a><br />
						<#if arg.synonyms != "NA">
							<#if arg.name[2..] != arg.synonyms[1..]>
								&nbsp;<em>${arg.synonyms}</em>
							</#if>
						</#if>
					</td>
					<!--<td>${arg.type}</td> -->
					<td>${arg.defaultValue!"NA"}</td>
					<td>${arg.summary}</td>
				</tr>
			</#list>
		</#if>
	</#macro>

	<#macro argumentDetails arg>
		<hr style="border-bottom: dotted 1px #C0C0C0;" />
		<h3><a name="${arg.name}">${arg.name} </a>
			<#if arg.synonyms??> / <small>${arg.synonyms}</small></#if>
		</h3>
		<p class="args">
			<b>${arg.summary}</b><br />
			${arg.fulltext}
		</p>
		<#if arg.otherArgumentRequired != "NA">
			<p><b>Dependency:</b> This argument requires that you also specify <code>${arg.otherArgumentRequired}</code>.</p>
		</#if>
		<#if arg.exclusiveOf != "NA">
			<p><b>Exclusion:</b> This argument cannot be used at the same time as <code>${arg.exclusiveOf}</code>.</p>
		</#if>
		<#if arg.options?has_content>
			<p>
				The ${arg.name} argument is an enumerated type (${arg.type}), which can have one of the following values:
			<dl class="enum">
				<#list arg.options as option>
					<dt class="enum">${option.name}</dt>
					<dd class="enum">${option.summary}</dd>
				</#list>
			</dl>
			</p>
		</#if>
		<p><#if arg.required != "NA">
			<#if arg.required == "yes">
				<span class="badge badge-important">R</span>
			</#if>
		</#if>
		<span class="label label-info ">${arg.type}</span>
		<#if arg.defaultValue?has_content>
			&nbsp;<span class="label">${arg.defaultValue}</span>
		</#if>
		<#if arg.minValue?is_number>
			&nbsp;<span class="label label-warning">[ [ ${arg.minValue}</span>
		</#if>
		<#if arg.minRecValue?is_number>
			&nbsp;<span class="label label-success">[ ${arg.minRecValue}</span>
		</#if>
		<#if arg.maxRecValue?is_number>
			&nbsp;<span class="label label-success">${arg.maxRecValue} ]</span>
		</#if>
		<#if arg.maxValue?is_number>
			&nbsp;<span class="label label-warning">${arg.maxValue} ] ]</span>
		</#if>
		</p>
	</#macro>

	<?php $group = '${group}'; ?>

	<section class="span4">
		<aside class="well">
			<a href="index.html"><h4><i class='fa fa-chevron-left'></i> Back to Tool Docs Index</h4></a>
		</aside>
		<aside class="well">
			<h2>Categories</h2>
			<@getCategories groups=groups />
		</aside>
		<?php getForumPosts( '${name}' ) ?>

	</section>

	<div class="span8">

		<h1>${name}</h1>

		<p class="lead">${summary}</p>

		<#if group?? >
			<h3>Category
				<small> ${group}</small>
			</h3>
		</#if>
		<#if walkertype?? && walkertype != "">
			<h3>Traversal
				<small>${walkertype}</small>
			</h3>
		</#if>
		<hr>
		<h2>Overview</h2>
		${description}

		<#-- Create references to additional capabilities if appropriate -->
			<#if readFilter?? && readFilter?size != 0>
				<hr>
				<h2>Additional Information</h2>
				<p></p>
			</#if>
			<#if readFilter?? && readFilter?size != 0>
				<h3>Read filters</h3>
				<#if readFilter?size = 1>
					<p>This Read Filter is automatically applied to the data by the Engine before processing by ${name}.</p>
				</#if>
				<#if (readFilter?size > 1) >
					<p>These Read Filters are automatically applied to the data by the Engine before processing by ${name}.</p>
				</#if>
				<ul>
					<#list readFilter as filter>
						<li><a href="${filter.filename}">${filter.name}</a></li>
					</#list>
				</ul>
			</#if>
			<#if extradocs?size != 0>
				<h3>Additional references</h3>
				<p>See these additional references.</p>
				<ul>
					<#list extradocs as extradoc>
						<li><a href="${extradoc.filename}">${extradoc.name}</a></li>
					</#list>
				</ul>
			</#if>

			<#-- Create the argument summary -->
			<#if arguments.all?size != 0>
				<h3>${name} specific arguments</h3>
				<p>This table summarizes the command-line arguments that are specific to this tool. For more details on each argument, see the list further down below the table or click on an argument name to jump directly to that entry in the list.</p>
				<table class="table table-striped table-bordered table-condensed">
					<thead>
					<tr>
						<th>Argument name(s)</th>
						<th>Default value</th>
						<th>Summary</th>
					</tr>
					</thead>
					<tbody>
					<@argumentlist name="Positional Arguments" myargs=arguments.positional/>
					<@argumentlist name="Required Arguments" myargs=arguments.required/>
					<@argumentlist name="Optional Tool Arguments" myargs=arguments.optional/>
					<@argumentlist name="Optional Common Arguments" myargs=arguments.common/>
					<@argumentlist name="Advanced Arguments" myargs=arguments.advanced/>
					<@argumentlist name="Hidden Arguments" myargs=arguments.hidden/>
					<@argumentlist name="Deprecated Arguments" myargs=arguments.deprecated/>
					</tbody>
				</table>
			</#if>

			<#-- List all of the things -->
			<#if arguments.all?size != 0>
				<#-- Create the argument details -->
					<h3>Argument details</h3>
					<p>Arguments in this list are specific to this tool. Keep in mind that other arguments are available that are shared with other tools (e.g. command-line GATK arguments); see Inherited arguments above.</p>
					<#list arguments.all as arg>
						<@argumentDetails arg=arg/>
					</#list>
			</#if>

			<@footerInfo />
			<@footerClose />

	</div>

	<?php printFooter($module); ?>