Mercurial > repos > ucsb-phylogenetics > osiris_phylogenetics
comparison alignment/jmodeltest.pl @ 0:5b9a38ec4a39 draft default tip
First commit of old repositories
| author | osiris_phylogenetics <ucsb_phylogenetics@lifesci.ucsb.edu> |
|---|---|
| date | Tue, 11 Mar 2014 12:19:13 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:5b9a38ec4a39 |
|---|---|
| 1 #!/usr/bin/perl | |
| 2 | |
| 3 use strict; | |
| 4 use warnings; | |
| 5 use Cwd; | |
| 6 | |
| 7 my $jmodeltest_path = '/home/galaxy/pkgs/jmodeltest'; | |
| 8 my $jmodeltest_tool = '/home/galaxy/galaxy-dist/tools/jmodeltest'; | |
| 9 | |
| 10 my $galaxyPath = getcwd(); | |
| 11 | |
| 12 my $input = $ARGV[0]; | |
| 13 my $likelihoodStyle = $ARGV[1]; | |
| 14 my $likelihood = $ARGV[2]; | |
| 15 my $criterion = $ARGV[3]; | |
| 16 my $extension = $ARGV[4]; | |
| 17 | |
| 18 # open increment file | |
| 19 open my $file, '<', $jmodeltest_tool."\/increment.txt"; | |
| 20 my $increment = <$file>; | |
| 21 $increment = int($increment); | |
| 22 close $file; | |
| 23 | |
| 24 # get the current increment | |
| 25 my $temp = $increment; | |
| 26 | |
| 27 # update the increment | |
| 28 open(UPDATE, '>'.$jmodeltest_tool."\/increment.txt"); | |
| 29 $increment = $increment + 1; | |
| 30 print UPDATE $increment; | |
| 31 close(UPDATE); | |
| 32 | |
| 33 chdir("$jmodeltest_path"); | |
| 34 | |
| 35 if($likelihoodStyle eq "-t") { | |
| 36 #only need to copy input file | |
| 37 qx/cp $input input.$temp.$extension/; | |
| 38 | |
| 39 #print qx/ls/; | |
| 40 | |
| 41 qx/java -jar jModelTest.jar -d input.$temp.$extension $likelihoodStyle $likelihood -$criterion > $galaxyPath\/output.txt 2> $galaxyPath\/err_log.txt/; | |
| 42 qx/rm input.$temp.*/; | |
| 43 } | |
| 44 elsif($likelihoodStyle eq "-u") { | |
| 45 #copy input file | |
| 46 qx/cp $input input.$temp.$extension/; | |
| 47 #copy likelihood tree | |
| 48 qx/cp $likelihood likelihood.$temp.tre/; | |
| 49 qx/java -jar jModelTest.jar -d input.$temp.$extension $likelihoodStyle likelihood.$temp.tre -$criterion > $galaxyPath\/output.txt 2> $galaxyPath\/err_log.txt/; | |
| 50 | |
| 51 # clean up | |
| 52 qx/rm input.$temp.*/; | |
| 53 qx/rm likelihood.$temp.tre/; | |
| 54 | |
| 55 } | |
| 56 | |
| 57 chdir("$galaxyPath"); |
