#! /usr/bin/perl -w
# *************************************************************
# This Programme does the following in sequence
# -> Runs Genome threader and outputs to a file in XML format
# Author: Rajkumar (itc@rajkumar.in)
# *************************************************************
# Libraries
use strict;
use Bio::Perl;
use Bio::SeqIO;
# At the top: Time Start
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
# Variables
my $path = "/home/raj/bio";
my $datadir = "$path/tobacco/data/singlet";
my $folder = "1"; # To be changed for each RUN
my $resdir = "$path/tobacco/mapping/gt/result/singlet";
my $gth = "$path/gt/bin/gth";
my $dnadir = "$datadir/$folder";
my $est = "$path/tobacco/data/est.fa";
my $bssm = "$path/gt/bin/bssm/arabidopsis";
my ($i, $total) = $_;
my @files = @_;
# Parsing the folder
opendir (DIR, "$datadir/$folder") or die $!;
@files = readdir(DIR);
close(DIR);
$total = @files;
if (! -e "$resdir/$folder") {`mkdir $resdir/$folder`;}
$i = 0;
foreach my $file(@files) {
next if ($file eq "." or $file eq "..");
++$i;
`$gth -genomic $dnadir/$file -cdna $est -bssm $bssm -force -xmlout -o $resdir/$folder/$file.xml`;
my $math = $total-$i;
print "\r\tYa. Threaded $file. Still $math to go..";
}
print "\t\nYES MAN.. All Done.\n\n";
# Running Genome Threader
print "\t\nYES MAN.. All Done.\n\n";
# At the End: Time Calculation
my ($sec_,$min_,$hour_,$mday_,$mon_,$year_,$wday_,$yday_,$isdst_) = localtime(time);
my $days = $mday_-$mday;
my $hours = $hour_-$hour;
my $mins = $min_-$min;
my $secs = $sec_-$sec;
print "\n------------------------\nDuration: ";
if ($days>0) { print "$days days";}
if ($hours>0) { print ": $hours hours";}
if ($mins>0) { print ": $mins mins";}
if ($secs>0) { print ": $secs secs";}
print "\n------------------------\n";
# END