<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pise PUBLIC "pise2.dtd" "pise2.dtd" >
<pise>
    <head>
      <title>G-PhoCS on XSEDE</title>
      <version>1.3.2</version>
      <description>A Generalized Phylogenetic Coalescent Sampler</description>
      <authors>Gronau I, Hubisz MJ, Gulko B, Danko CG, Siepel A.</authors>
      <reference>Gronau I, Hubisz MJ, Gulko B, Danko CG, Siepel A. Bayesian inference of ancient human demography from individual genome sequences.  Nature Genetics 43 1031–1034.   2011 </reference>
      <category>Phylogeny / Alignment</category>
      <doclink></doclink>
      <doclink></doclink>
  </head>
	
	<command>gphocs_xsede</command>
	
<!-- ***********************************  created 2/7/2017 or thereabouts by mamiller ****************************************************************
G-PhoCS is implemented in C, developed and tested on Linux. For Linux users, we provide source code and build instructions, and for Windows and Mac users, we do provide ready-made binaries. 
 -*h returns
 **********************************************************************
*                G-Phocs ver 1.2.3        Sept 2015                  *
**********************************************************************

Usage: ./bin/G-PhoCS-1-2-3 <control-file-name> [secondary-control-file-name] [options].
-v, -*verbose     Print more information at the beginning of the program
-h, -*help
See manual for more help.
—
Expanse rules:
[cipres@login01| /expanse/projects/ngbt/opt/benchmarks/rules]> cat G-PhoCS.Expanse.rules
Rules for running G-PhoCS via the CIPRES gateway

All runs are on a single node of Expanse.

- Let the user specify a value for the number of cores between 6 and 24.

- Set

  memory = <floor(cores*248/128)>G
  CIPRES_NP = 1
  CIPRES_THREADSPP = <cores>

- Include the following in the Slurm run script.

  #SBATCH -p shared
  #SBATCH -qos=shared-cipres
  #SBATCH -N 1
  #SBATCH -*ntasks-per-node=1
  #SBATCH -*cpus-per-task=<cores>
  #SBATCH -*mem=<memory>
  ...
  srun -n $CIPRES_NP -*mpi=pmi2 <wrapper> -v -n $CIPRES_THREADSPP
   -->

<parameters> 

        <parameter isinput="1" type="InFile">
			<name>infile</name>
			<attributes>
				<prompt>Input sequence file</prompt>
				<filenames>sequences.txt</filenames>
<!-- ref.fasta was chosen as input because it is required in all of the steps -->
			</attributes>
		</parameter>

		<parameter ishidden="1" type="String">
			<name>gphocs_invocation</name>
			<attributes>
				<format>
					<language>perl</language>
					<code>"convertFile.sh ctrlfile.ctrl;g-phocs_1.3.2_expanse ctrlfile.ctrl"</code> 
				</format>
				<group>1</group>
			</attributes>
		</parameter>
				
		<parameter ishidden="1" type="String">
			<name>gphocs_invocation3</name>
			<attributes>
				<format>
					<language>perl</language>
					<code>" -n $numthreads -v"</code> 
				</format>
				<group>80</group>
			</attributes>
		</parameter>
		
		<parameter ishidden="1" type="String">
			<name>gphocs_scheduler</name>
				<attributes>
					<paramfile>scheduler.conf</paramfile>
<!--  					<precond>
						<language>perl</language>
						<code>$numthreads &lt; 24</code>
					</precond>-->
					<format>
						<language>perl</language>
							<code>
									"threads_per_process=$numthreads\\n" .
									"mem=" . (int(($numthreads)*(248/128))) . "G\\n" .
									"node_exclusive=0\\n" .
									"nodes=1\\n"
								</code>
					</format>
					<group>0</group>
				</attributes>
		</parameter>
		
<!-- 		<parameter ishidden="1" type="String">
			<name>gphocs_scheduler2</name>
				<attributes>
					<paramfile>scheduler.conf</paramfile>
					<precond>
						<language>perl</language>
						<code>$numthreads &gt; 23</code>
					</precond>
					<format>
						<language>perl</language>
							<code>
									"threads_per_process=$numthreads\\n" .
									"node_exclusive=1\\n" .
									"mem=" . (int(($numthreads)*(248/128))) . "G\\n" .
									"nodes=1\\n"
								</code>
					</format>
					<group>0</group>
				</attributes>
		</parameter> -->

<!-- return absolutely everything -->
		<parameter type="Results">
			<name>all_output</name>
			<attributes>
				<prompt>All output</prompt>
				<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>
				<format>
					<language>perl</language>
					<code>"runhours=$value\\n"</code>
				</format>
				<vdef>
					<value>0.25</value>
				</vdef>
				<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>
				</ctrls>
				<warns>
					<warn>
						<message>The job will run on $numthreads processors as configured. If it runs for the entire configured time, it will consume $numthreads x $runtime cpu hours</message>
						<language>perl</language>
						<code>$runtime ne 0 </code>
					</warn>
				</warns>
								<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>
			</attributes>
		</parameter>

		<parameter issimple="1" ismandatory="1" type="InFile">
			<name>primary_ctrlfile</name>
			<attributes>
				<prompt>Select CTRL file (it must name the input file sequences.txt)</prompt>
				<filenames>ctrlfile.ctrl</filenames>
				<warns>
					<warn>
						<message>Plese make sure your ctrl file specifies that the seq-file name is	sequences.txt </message>
						<language>perl</language>
						<code>defined $primary_ctrlfile</code>
					</warn>
				</warns>
			</attributes>
		</parameter>
		
		<parameter issimple="1" type="InFile">
			<name>secondary_ctrlfile</name>
			<attributes>
				<prompt>Select secondary CTRL file (optional)</prompt>
				<format>
					<language>perl</language>
					<code>defined $value ? "ctrlfile2.ctrl" : ""</code>
				</format>
				<group>3</group>
				<filenames>ctrlfile2.ctrl</filenames>
			</attributes>
		</parameter>
		
<!--		<parameter issimple="1" ismandatory="0" type="InFile">
			<name>add_tracefile</name>
			<attributes>
				<prompt>Add a tracefile file (optional)</prompt>
				<filenames>tracefile.out</filenames>
			</attributes>
		</parameter> -->
		
		<parameter issimple="1" ismandatory="1" type="Integer">
			<name>numthreads</name>
			<attributes>
				<prompt>How many threads?</prompt>
				<ctrls>
					<ctrl>
						<message>Sorry, threads must be no less than 6</message>
						<language>perl</language>
						<code>$numthreads &lt; 6 </code>				
					</ctrl> 
					<ctrl>
						<message>Sorry, threads must be no more than 24</message>
						<language>perl</language>
						<code>$numthreads &gt; 24 </code>				
					</ctrl> 
					<ctrl>
						<message>Please enter a thread value</message>
						<language>perl</language>
						<code>!defined $numthreads</code>				
					</ctrl>
				</ctrls>
			</attributes>
		</parameter>
        		
        		
 </parameters> 
</pise>


