view Contra/baseline_wrapper.pl @ 4:9a76d500b049

Uploaded
author fcaramia
date Thu, 13 Sep 2012 02:44:08 -0400
parents 7564f3b1e675
children
line wrap: on
line source

#sshpass -p pmac1512 ssh -o StrictHostkeyChecking=no galaxy@pmc-bioinf03 "gmt music play $*"
#echo "gmt music play $*"


use strict;
use warnings;
use File::Basename; 
use Cwd;
die qq(
Bad numbr of inputs

) if(!@ARGV);


my $player_options = "";
my $baseline_output;

my $dir = getcwd;
my $variable = "";
my $files = "";
foreach my $input (@ARGV) 
{
	my @tmp = split "::", $input;
	
	if($tmp[0] eq "PLAYEROPTION") 
	{
		$variable = $tmp[1];
		$variable =~ s/=/ /g;
		$player_options = "$player_options $variable";
	}
	elsif($tmp[0] eq "BASELINEOUTPUT") 
	{
		$baseline_output = $tmp[1];
	}  
	elsif($tmp[0] eq "BAMLISTENTRY") 
	{
		$files = "$files ${tmp[1]}";
	}
	else 
	{
		die("Unknown Input: $input\n");
	}
}


my $working_dir = "BASELINE_OUTPUT";
#remove extension

#Create Contra Output dir 
system ("mkdir $working_dir");

#run baseline

system ("baseline.py --file $files --output $working_dir $player_options > /dev/null");

#Search control file in output dir
opendir(DIR, $working_dir);
my @FILES= readdir(DIR); 
foreach my $file (@FILES) 
{
	my ($filename,$directory,$extension) = fileparse($file, qr/\.[^.]*/);
	if ($extension eq ".txt")
	{
		system ("mv $working_dir/$file $baseline_output");
	}
}
closedir(DIR);