comparison Dotplot_Release/SaintConvert.pl @ 5:7c9a48bc4f61 draft

Uploaded
author bornea
date Tue, 15 Mar 2016 15:25:43 -0400
parents bc752a05f16d
children
comparison
equal deleted inserted replaced
4:4fd82c854535 5:7c9a48bc4f61
1 #!/usr/bin/perl
2
3 # 17/12/2013
4
5 if($#ARGV==0){
6 print "This program takes non-SaintExpress formatted data and converts it to look like it.\n";
7 print "\nusage:\n $0\n-i [csv saint output file]\n\n";
8 die;
9 }
10 else{
11 $i=0;
12 while($i<=$#ARGV){
13 if($ARGV[$i] eq '-i'){
14 $i++;
15 $ifile=$ARGV[$i];
16 }
17 else{
18 die "\Incorrect program usage\n\n";
19 }
20 $i++;
21 }
22 }
23
24 $i=0;
25 $file='';
26 open(IFILE,"<$ifile") || die "$ifile can't be opened: $!";
27 { local $/=undef; $file=<IFILE>; }
28 @lines=split /[\r\n]+/, $file;
29 foreach $line (@lines) {
30 if($line =~ /^Bait/){
31 }
32 elsif($line =~ /^([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)/){
33 $bait[$i]=$1;
34 $prey[$i]=$2;
35 $spec[$i]=$3;
36 $fdr[$i]=$4;
37 $i++;
38 }
39 else{
40 }
41 }
42 close(IFILE);
43 $line_count=$i;
44
45 open(OFILE, ">mockSaintExpress.txt");
46 print OFILE "Bait\tPrey\tPreyGene\tSpec\tSpecSum\tAvgSpec\tNumReplicates\tctrlCounts\tAvgP\tMaxP\tTopoAvgP\tTopoMaxP\tSaintScore\tFoldChange\tBFDR\tboosted_by\n";
47
48 for($i=0; $i<$line_count; $i++){
49 print OFILE "$bait[$i]\t111\t$prey[$i]\t111\t111\t$spec[$i]\t111\t111\t111\t111\t111\t111\t111\t111\t$fdr[$i]\t111\n";
50 }
51 close(OFILE);
52