annotate DEGseq_2.pl @ 53:f5a2e8308836 draft default tip

Uploaded
author big-tiandm
date Mon, 08 Dec 2014 01:51:16 -0500
parents 7b5a48b972e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
1 #!/usr/bin/perl -w
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
2 #Filename:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
3 #Author: Tian Dongmei
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
4 #Email: tiandm@big.ac.cn
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
5 #Date: 2009-05-06
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
6 #Modified:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
7 #Description: ɾ³ýmatched reads
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
8 my $version=1.00;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
9
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
10 use strict;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
11 use Getopt::Long;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
12 use File::Basename;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
13
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
14 my %opts;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
15 GetOptions(\%opts,"i=s","outdir=s","column1:i","mark1=s","depth1:i","depth2:i","column2:i","mark2=s","h");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
16 if (!(defined $opts{i} and defined $opts{outdir} and defined $opts{mark1} and defined $opts{mark2}) || defined $opts{h}) { #necessary arguments
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
17 &usage;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
18 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
19
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
20 my $filein=$opts{'i'};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
21 my $outputdir=$opts{'outdir'};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
22 unless ($outputdir=~/\/$/) {$outputdir .="/";}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
23 my $column1=defined $opts{column1} ? $opts{column1} : 3;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
24 my $column2=defined $opts{column2} ? $opts{column2} : 4;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
25 my $mark1=$opts{mark1};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
26 my $mark2=$opts{mark2};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
27 my $fileout=$outputdir."degseq.R";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
28
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
29 open OUT,">$fileout"; #output file
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
30 #my ($name,$dir);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
31 #$name=basename($filein);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
32 print OUT "library(DEGseq)\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
33 print OUT "geneExpFile <- system.file(package=\"DEGseq\")\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
34 print OUT "geneExpFile<-file.path(\"$filein\")\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
35 print OUT "layout(matrix(c(1,2,3,4,5,6), 3, 2, byrow=TRUE))\npar(mar=c(2, 2, 2,2))\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
36 print OUT "outputdir<-file.path(\"$outputdir\")\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
37 print OUT "geneExpMatrix1 <- readGeneExp(file=geneExpFile, geneCol=1, valCol=c($column1))\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
38 print OUT "geneExpMatrix2 <- readGeneExp(file=geneExpFile, geneCol=1, valCol=c($column2))\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
39 if(defined $opts{'depth1'} && defined $opts{'depth2'}){
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
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";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
41 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
42 else{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
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";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
44 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
45 close OUT;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
46
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
47
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
48 system("R CMD BATCH $fileout");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
49
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
50 wait;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
51
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
52
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
53
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
54 sub usage{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
55 print <<"USAGE";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
56 Version $version
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
57 Usage:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
58 $0 -i -outdir -column1 -mark1 -column2 -mark2 -depth1 -depth2
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
59 options:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
60 -i input file
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
61 -outdir output file dir
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
62 -column1 the first column for DEGseq
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
63 -mark1 the name of the column1
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
64 -depth1 depth for the first file,use for normalize
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
65 -column2 the second column for DEGseq
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
66 -mark2 the name of the column2
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
67 -depth2 depth for the second file,use for normalize
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
68
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
69 -h help
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
70 USAGE
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
71 exit(1);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
72 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
73