comparison 2.4/src/run_blat.pl @ 13:e3609c8714fb draft

Uploaded
author plus91-technologies-pvt-ltd
date Fri, 30 May 2014 03:37:55 -0400
parents
children
comparison
equal deleted inserted replaced
12:980fce54e60a 13:e3609c8714fb
1 #####################################################################################################################################################
2 #Purpose: To perform blat and organize blat
3 #Date: 07-19-2013
4 #####################################################################################################################################################
5 use Getopt::Long;
6 #reading input arguments
7 &Getopt::Long::GetOptions(
8 'BLAT_PATH=s'=> \$blatpath,
9 'REF_FILE=s'=> \$reffile,
10 'INPUT_FILE=s' => \$inputfile,
11 'OUTPUT_FILE=s' => \$outputfile,
12 'MIN_SCORE=s'=> \$minScore,
13 'MIN_IDENTITY=s'=> \$minidentity,
14 'BLAT_PORT=s'=>\$blatport
15 );
16 $blatpath =~ s/\s|\t|\r|\n//g;
17 $reffile=~ s/\s|\t|\r|\n//g;
18 $inputfile=~ s/\s|\t|\r|\n//g;
19 $outputfile=~ s/\s|\t|\r|\n//g;
20 $minScore=~ s/\s|\t|\r|\n//g;
21 $minidentity=~ s/\s|\t|\r|\n//g;
22 $blatport=~ s/\s|\t|\r|\n//g;
23 #input arguments
24
25 #checking for missing arguments
26 if($blatport eq "" || $blatpath eq "" || $reffile eq "" || $inputfile eq "" || $outputfile eq "" || $minScore eq "" || $minidentity eq "")
27 {
28 die "missing arguments\n USAGE : perl perl_blat.pl -BLAT_PORT <BLAT_PORT> -MIN_SCORE <MIN_SCORE> -MIN_IDENTITY <MIN_IDENTITY> -BLAT_PATH <PATH TO BLAT FOLDER> -REF_FILE <PATH TO 2bit file> -INPUT_FILE <INPUT CONFIG FILE> -OUTPUT_FILE <OUTPUT FILE>\n";
29 }
30
31 #parsing the arguments
32
33 #unless(-d $outdir)
34 #{
35 # system("mkdir -p $outdir");
36 #}
37 $status=`$blatpath/gfServer status localhost $blatport |wc -l`;
38 chomp($status);
39 $count = 0;
40 while($status < 2 )
41 {
42 if($count > 0)
43 {
44 $blatport = $blatport+int(rand(1000))+1;
45 }
46 print "Starting the server\n";
47 $sys ="$blatpath/gfServer start -canStop localhost $blatport $reffile &";
48 print "$sys\n";
49 system($sys);
50 sleep(300);
51 $status=`$blatpath/gfServer status localhost $blatport |wc -l`;
52 chomp($status);
53 $count++;
54 if($count > 5)
55 {
56 die "something wrong with gfServer or command . Failed 5 times\n";
57 }
58 }
59 print "querying \n";
60 $sys = "$blatpath/gfClient localhost $blatport / $inputfile $outputfile -minScore=$minScore -minIdentity=$minidentity";
61 print "$sys\n";
62 system($sys);
63 print "stoping the server\n";
64 #$sys = "$blatpath/gfServer stop localhost $blatport";
65 $pid = `ps|grep gfServer|head -1|cut -f1 -d ' '`;
66 $sys ="kill -9 $pid";
67 print "$sys\n";
68 system($sys);