comparison DEGseq_2.pl @ 0:0e63c50295bc draft

Uploaded
author big-tiandm
date Thu, 30 Oct 2014 03:07:44 -0400
parents
children 736f53de6964
comparison
equal deleted inserted replaced
-1:000000000000 0:0e63c50295bc
1 #!/usr/bin/perl -w
2 #Filename:
3 #Author: Tian Dongmei
4 #Email: tiandm@big.ac.cn
5 #Date: 2009-05-06
6 #Modified:
7 #Description: ɾ³ýmatched reads
8 my $version=1.00;
9
10 use strict;
11 use Getopt::Long;
12 use File::Basename;
13
14 my %opts;
15 GetOptions(\%opts,"i=s","outdir:s","column1:i","mark1=s","depth1:i","depth2:i","column2:i","mark2=s","h");
16 if (!(defined $opts{i} and defined $opts{mark1} and defined $opts{mark2}) || defined $opts{h}) { #necessary arguments
17 &usage;
18 }
19
20 my $filein=$opts{'i'};
21 my $outputdir=defined $opts{'outdir'} ? $opts{'outdir'} : "./";
22 unless ($outputdir=~/\/$/) {$outputdir .="/";}
23 my $column1=defined $opts{column1} ? $opts{column1} : 3;
24 my $column2=defined $opts{column2} ? $opts{column2} : 4;
25 my $mark1=$opts{mark1};
26 my $mark2=$opts{mark2};
27 my $fileout=$outputdir."degseq.R";
28
29 open OUT,">$fileout"; #output file
30 #my ($name,$dir);
31 #$name=basename($filein);
32 print OUT "library(DEGseq)\n";
33 print OUT "geneExpFile <- system.file(package=\"DEGseq\")\n";
34 print OUT "geneExpFile<-file.path(\"$filein\")\n";
35 print OUT "layout(matrix(c(1,2,3,4,5,6), 3, 2, byrow=TRUE))\npar(mar=c(2, 2, 2,2))\n";
36 print OUT "outputdir<-file.path(\"$outputdir\")\n";
37 print OUT "geneExpMatrix1 <- readGeneExp(file=geneExpFile, geneCol=1, valCol=c($column1))\n";
38 print OUT "geneExpMatrix2 <- readGeneExp(file=geneExpFile, geneCol=1, valCol=c($column2))\n";
39 if(defined $opts{'depth1'} && defined $opts{'depth2'}){
40 print OUT "DEGexp(geneExpMatrix1=geneExpMatrix1, geneCol1=1, expCol1=c(2), groupLabel1=\"$mark1\",geneExpMatrix2=geneExpMatrix2, geneCol2=1, expCol2=c(2), groupLabel2=\"$mark2\",depth1=$opts{depth1},depth2=$opts{depth2},outputDir=outputdir,method=\"MARS\")\n";
41 }
42 else{
43 print OUT "DEGexp(geneExpMatrix1=geneExpMatrix1, geneCol1=1, expCol1=c(2), groupLabel1=\"$mark1\",geneExpMatrix2=geneExpMatrix2, geneCol2=1, expCol2=c(2), groupLabel2=\"$mark2\",outputDir=outputdir,method=\"MARS\")\n";
44 }
45 close OUT;
46
47 print LOG "Prepare for DEGseq!\t";
48 print LOG `date`;
49 print LOG "\n";
50
51 system("R CMD BATCH $fileout");
52
53 wait;
54
55 sub usage{
56 print <<"USAGE";
57 Version $version
58 Usage:
59 $0 -i -outdir -column1 -mark1 -column2 -mark2 -depth1 -depth2
60 options:
61 -i input file
62 -outdir output file dir
63 -column1 the first column for DEGseq
64 -mark1 the name of the column1
65 -depth1 depth for the first file,use for normalize
66 -column2 the second column for DEGseq
67 -mark2 the name of the column2
68 -depth2 depth for the second file,use for normalize
69
70 -h help
71 USAGE
72 exit(1);
73 }
74