<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pise PUBLIC "pise2.dtd" "pise2.dtd" >
<pise>
 <head>
      <title>PICARD on XSEDE</title>
      <version>2.3.0</version>
      <description>Tools for manipulating high-throughput sequencing (HTS) data and formats</description>
      <authors></authors>
      <reference>http://broadinstitute.github.io/picard/</reference>
      <category>Assembly:Assemble_reads</category>
      <doclink></doclink>
      <doclink></doclink>
</head>
	
<command>picard_xsede</command>
<!-- the commands ignazio asked for are:

picard_sortsam command
java -Xmx16g -Djava.io.tmpdir=/mobyle_share/data/tswv_test_down/jtmp -jar /home/mobyle/bin/picard-tools-1.88/SortSam.jar VALIDATION_STRINGENCY=LENIENT MAX_RECORDS_IN_RAM=7500000 INPUT=/mobyle_share/data/tswv_test_down/A1.sam OUTPUT=/mobyle_share/data/tswv_test_down/A1.bam.sorted.bam SO=coordinate
 
picard_markduplicates command
java -Xmx16g -Djava.io.tmpdir=/mobyle_share/data/tswv_test_down/jtmp -jar /home/mobyle/bin/picard-tools-1.88/picard.jar MarkDuplicates INPUT=/mobyle_share/data/tswv_test_down/A1.bam.sorted.bam OUTPUT=/mobyle_share/data/tswv_test_down/A1.bam.sorted_marked.bam METRICS_FILE=metrics.txt OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 CREATE_INDEX=true TMP_DIR=/tmp
 
picard_addreadgroups command
java -Xmx16g  -jar ~/bin/picard-tools-1.88/AddOrReplaceReadGroups.jar I=A1.bam.sorted_marked.bam O=A1.bam.sorted_marked_readgroups.bam SORT_ORDER=coordinate RGID=A1 RGLB=A1 RGPL=illumina RGPU=A1 RGSM=A1 CREATE_INDEX=True VALIDATION_STRINGENCY=LENIENT

 -->
 
 <!-- new picard options -->
 

  <parameters>
        
<!--  
picard_sortsam command for cipres
java -Xmx16g -Djava.io.tmpdir=/mobyle_share/data/tswv_test_down/jtmp -jar /home/mobyle/bin/picard-tools-1.88/SortSam.jar VALIDATION_STRINGENCY=LENIENT MAX_RECORDS_IN_RAM=7500000 INPUT=/mobyle_share/data/tswv_test_down/A1.sam OUTPUT=/mobyle_share/data/tswv_test_down/A1.bam.sorted.bam SO=coordinate
 
picard_markduplicates command for cipre
java -Xmx16g -Djava.io.tmpdir=/mobyle_share/data/tswv_test_down/jtmp -jar /home/mobyle/bin/picard-tools-1.88/picard.jar MarkDuplicates INPUT=/mobyle_share/data/tswv_test_down/A1.bam.sorted.bam OUTPUT=/mobyle_share/data/tswv_test_down/A1.bam.sorted_marked.bam METRICS_FILE=metrics.txt OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 CREATE_INDEX=true TMP_DIR=/tmp
 
picard_addreadgroups command for cipres
java -Xmx16g -Djava.io.tmpdir=/mobyle_share/data/tswv_test_down/jtmp -jar /home/mobyle/bin/picard-tools-1.88/AddOrReplaceReadGroups.jar I=/mobyle_share/data/tswv_test_down/A1.bam.sorted_marked.bam O=/mobyle_share/data/tswv_test_down/A1.bam.sorted_marked_readgroups.bam TMP_DIR=/mobyle_share/data/tswv_test_down/tmp SORT_ORDER=coordinate RGID=A1 RGLB=A1 RGPL=illumina RGPU=A1 RGSM=A1 CREATE_INDEX=True VALIDATION_STRINGENCY=LENIENT
-->
		<parameter ishidden="1" type="String">
          <name>picard_sortsam</name>
          <attributes>
          		<precond>
          			<language>perl</language>
          			<code>$run_sortsam</code>
          		</precond>
          		<format>
          			<language>perl</language>
<!-- changed from -Xmx16g to -Xmx4g at wayne's suggestion-->
          			<code>"picard_expanse picard VALIDATION_STRINGENCY=LENIENT MAX_RECORDS_IN_RAM=7500000  INPUT=A1.sam OUTPUT=A1.bam.sorted.bam SO=coordinate"</code>
				</format>
				<group>1</group>
			</attributes>
        </parameter>
        
         <parameter ishidden="1" type="String">
          <name>picard_sortsam_and</name>
          <attributes>
          		<precond>
          			<language>perl</language>
          			<code>$run_sortsam &amp;&amp; $run_markduplicates</code>
          		</precond>
          		<format>
          			<language>perl</language>
          			<code>"&amp;&amp;"</code>
				</format>
				<group>2</group>
			</attributes>
        </parameter>  
        
       	<parameter ishidden="1" type="String">
          <name>picard_markduplicates</name>
          <attributes>
          	<precond>
          		<language>perl</language>
          		<code>$run_markduplicates</code>
          	</precond>
          	<format>
          		<language>perl</language>
 <!-- changed from -Xmx16g to -Xmx4g at wayne's suggestion-->
          		<code>"picard_expanse picard MarkDuplicates INPUT=A1.bam.sorted.bam OUTPUT=A1.bam.sorted_marked.bam METRICS_FILE=metrics.txt OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 CREATE_INDEX=true TMP_DIR=/tmp"</code>
          	</format>
          	<group>3</group>
          </attributes>
        </parameter>
        
         <parameter ishidden="1" type="String">
          <name>picard_readgroups_and</name>
          <attributes>
          		<precond>
          			<language>perl</language>
          			<code>$run_addreadgroups &amp;&amp; $run_markduplicates</code>
          		</precond>
          		<format>
          			<language>perl</language>
          			<code>"&amp;&amp;"</code>
				</format>
				<group>4</group>
			</attributes>
       </parameter> 
        
        <parameter ishidden="1" type="String">
          <name>picard_addreadgroups</name>
          <attributes>
          	<precond>
          		<language>perl</language>
          		<code>$run_addreadgroups</code>
          	</precond>
          	<format>
          		<language>perl</language>
 <!-- changed from -Xmx16g to -Xmx4g at wayne's suggestion-->
          		<code>"picard_expanse picard AddOrReplaceReadGroups I=A1.bam.sorted_marked.bam O=A1.bam.sorted_marked_readgroups.bam TMP_DIR=tmp SORT_ORDER=coordinate RGID=$sample RGLB=$sample RGPL=illumina RGPU=$sample RGSM=$sample CREATE_INDEX=True VALIDATION_STRINGENCY=LENIENT"</code>
          	</format>
          	<group>5</group>
          </attributes>
        </parameter>
        
        <parameter isinput="1" type="InFile">
              <name>infile</name>
              <attributes>
             	<prompt >Input fasta file</prompt>
             	<filenames>A1.sam</filenames>
              </attributes>
         </parameter>
         
         <parameter ishidden="1" type="String">
			<name>picard_scheduler</name>
				<attributes>
					<paramfile>scheduler.conf</paramfile>
					<format>
						<language>perl</language>
							<code>
									"threads_per_process=1\\n" .
									"node_exclusive=0\\n" .
									"mem=2G\\n" .
									"nodes=1\\n"
								</code>
					</format>
					<group>0</group>
				</attributes>
		</parameter>
		
		<parameter type="Results">
			<name>allresults</name>
			<attributes>
					<filenames>*</filenames>
			</attributes>
		</parameter>

<!-- Visible parameters -->
<!-- Parameters with visible controls start here -->
		<parameter type="Float" issimple="1" ismandatory="1">
			<name>runtime</name>
			<attributes>
				<group>1</group>
				<paramfile>scheduler.conf</paramfile>
				<prompt>Maximum Hours to Run (click here for help setting this correctly)</prompt>
				<vdef>
					<value>0.25</value>
				</vdef>
				<comment>
<value>Estimate the maximum time your job will need to run. We recommend testimg initially with a &lt; 0.5hr test run because Jobs set for 0.5 h or less depedendably run immediately in the "debug" queue. 
Once you are sure the configuration is correct, you then increase the time. The reason is that jobs &gt; 0.5 h are submitted to the "normal" queue, where jobs configured for 1 or a few hours times may
run sooner than jobs configured for the full 168 hours. 
</value>
				</comment>
				<ctrls>
					<ctrl>
						<message>Maximum Hours to Run must be less than 168</message>
						<language>perl</language>
						<code>$runtime &gt; 168.0</code>
					</ctrl>
					<ctrl>
						<message>Maximum Hours to Run must be greater than 0.1 </message>
						<language>perl</language>
						<code>$runtime &lt; 0.1</code>
					</ctrl>
					<ctrl>
						<message>Sorry, you cannot run SortSam and Addreadgroups unless you also run Markduplicates</message>
						<language>perl</language>
						<code>$run_addreadgroups &amp;&amp; $run_sortsam &amp;&amp; !$run_markduplicates</code>
					</ctrl>   
				</ctrls>
				<warns>
					<warn>
						<message>The job will run on 1 processors as configured. If it runs for the entire configured time, it will consume 1 x $runtime cpu hours</message>
						<language>perl</language>
						<code>defined $runtime</code>
					</warn>
				</warns>
				<format>
					<language>perl</language>
					<code>"runhours=$value\\n"</code>
				</format>
			</attributes>
		</parameter>
 
		<parameter ismandatory="1" type="Switch">
			<name>run_sortsam</name>
			<attributes>
				<prompt>Run SortSam command</prompt>
				<vdef>
					<value>1</value>
				</vdef>
			</attributes>
		</parameter>
			
        
        <parameter ismandatory="1" type="Switch">
			<name>run_markduplicates</name>
			<attributes>
				<prompt>Run Markduplicates command</prompt>
				<vdef>
					<value>1</value>
				</vdef>
			</attributes>		
        </parameter> 
        
        <parameter ismandatory="1"  type="Switch">
			<name>run_addreadgroups</name>
			<attributes>
				<prompt>Run Addreadgroups command</prompt>
				<vdef>
					<value>1</value>
				</vdef>
			</attributes>		
        </parameter>
        
     <parameter type="InFile">
              <name>infile2</name>
              <attributes>
             	<prompt>Select Input for Markduplicates</prompt>
             	<precond>
             		<language>perl</language>
             		<code>$run_markduplicates &amp;&amp; !$run_sortsam</code>
             	</precond>
             	<filenames>A1.bam.sorted.bam</filenames>
             	<ctrls>
             		<ctrl>
             			<message>Please enter a file for the Markduplicates stage</message>
             			<language>perl</language>
             			<code>!defined $infile2 &amp;&amp; $run_markduplicates &amp;&amp; !$run_sortsam</code>
             		</ctrl>
             	</ctrls>
              </attributes>
         </parameter> 
         
           <parameter type="InFile">
              <name>infile3</name>
              <attributes>
             	<prompt >Select Input for Addreadgroups command</prompt>
             	<precond>
             		<language>perl</language>
             		<code>$run_addreadgroups &amp;&amp;  !$run_markduplicates &amp;&amp; !$run_sortsam</code>
             	</precond>
             	<filenames>A1.bam.sorted_marked.bam</filenames>
             	<ctrls>
             		<ctrl>
             			<message>Please enter a file for the Addredgroups stage</message>
             			<language>perl</language>
             			<code>!defined $infile3 &amp;&amp; $run_addreadgroups &amp;&amp; !$run_markduplicates &amp;&amp; !$run_sortsam</code>
             		</ctrl>
             	</ctrls>
              </attributes>
         </parameter>
	
<!--	<parameter type="String">
			<name>outf</name>
			<attributes>
				<prompt>Outfile Name</prompt>
					<filenames></filenames>
					<comment>
<value>This is not the fasta file. This is the sam/bam file.</value>
					</comment>
			</attributes>
        </parameter> -->
    
  	<parameter type="String">
			<name>sample</name>
			<attributes>
			<prompt>sample name</prompt>
			<comment>
				<value>Name of the sample (e.g. A3)</value>
			</comment>
			</attributes>
		</parameter> 		
  </parameters>
  
</pise>