view flexbar.pl @ 1:a8399cb4972b

Uploaded Flexbar perl tool wrapper file flexbar.pl
author jtilman
date Sun, 30 Dec 2012 14:01:39 -0500
parents
children f0bdf862ba39
line wrap: on
line source

#!/usr/bin/env perl

# Author: Johannes T. Roehr

use warnings;
use strict;

my $flexbarDir = "";

my $pwd = $ENV{PWD};

my $lastIdx = $#ARGV;
my $format  = $ARGV[$lastIdx];
my $folder  = $ARGV[$lastIdx - 1];
my $id      = $ARGV[$lastIdx - 2];
my $outFile = $ARGV[$lastIdx - 3];

my $call = join " ", @ARGV[0..($lastIdx - 4)];

system $flexbarDir . $call .' --target reads > '. $outFile;

foreach(<$pwd ."/reads"*>){
	
	if(/^\.\//){
		my $file = $pwd ."/". $_;
		
		s/^\.\///;
		my $fileType;
		
		$fileType = $1         if /\.(\w+)$/;
		$fileType = $format    if /\.\w+fast\w$/;
		$fileType = 'tabular'  if $fileType eq 'lengthdist';
		
		s/_//g;
		
		my $name = "primary_". $id ."_". $_ ."_visible_". $fileType;
		
		rename $file, $name;
		rename $name, $folder;
	}
}