forked from biofuture/Ublastx_stageone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobile_pipeline_stagetwo_version2
578 lines (499 loc) · 18 KB
/
mobile_pipeline_stagetwo_version2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
#!/usr/bin/perl -w
use strict;
##Authur Xiao-Tao Jiang
##Email [email protected].
use Getopt::Std;
use File::Basename;
use FindBin qw($Bin);
##Generalize dir for this program
our (@dirset,$ublastxdir);
BEGIN {
@dirset = split(/\//,$Bin);
$ublastxdir = join("/", @dirset);
unshift @INC, "$ublastxdir/bin";
}
our ($opt_h, $opt_i, $opt_o, $opt_n, $opt_m, $opt_l, $opt_e, $opt_d, $opt_b) = "";
my $usage = <<USE;
Author: JIANG Xiao-Tao
Modidied : 06-04-2018
Email: biofuture.jiang\@gmail.com
$0 -i <extracted.fa> -m <meta_data_online.txt> -n [number of threads] -l [length] -e [evalue] -d [identity] -o <output_prefix> -b
-i the potential arg reads from stage one
-m meta data online from stage one
-o Output prefix
-n number of threads used for blastx, default 1
-l length filtering default 25 aa
-e evalue filtering default 1e-7
-d identity filtering default 80
-b if set then process the blastx results directly [default off], useful if user want to accelerate the stage two by running blastx paralell
-h print this help information
USE
##Description
##This pipeline is designed to process multisamples ARG identification, this is the part two pipeline
#die " perl $0 <Extracted_fasta> <Meta_data_info> <Catergory> <lenth> <e-value> <identity> <institution name> <email address> <Taskname> <PDF16s> <PDFCELL> <TABLE1> <TABLE2> <TABLE3>\n Authur: Xiao-Tao Jiang\n Email: biofuture.jiang\@gmail.com\n" unless (@ARGV == 14);
#-------------------------------------------------------------------------------------------------
#blastx aginst ARG database for accurately identification of reads for antibiotic resistence gene
getopts('i:o:n:m:e:d:l:b:h');
if($opt_h || (!$opt_i) ){
die "$usage\n";
}
my $efa = $opt_i;
my $blast6out = "$opt_o.blast6out.txt";
my $ARDB_PATH = "$ublastxdir/DB/mobileOG1.6.fasta";
my $ARDB_STRUCTURE = "$ublastxdir/DB/mobileOG_1.6_list";
my $ARDBFA = "$ublastxdir/DB/mobileOG1.6.fasta";
$opt_n ||= 10;
$opt_l ||= 25;
$opt_e ||= 1e-7;
$opt_d ||= 80;
$opt_b ||= "";
my $lenmatch = $opt_l;
my $evaluematch = $opt_e;
my $identitymatch = $opt_d;
#my $rlen = 100; ##the pair-end length
my $envtable16s = "$ublastxdir/DB/update_45_sarg2.0_16s.table_201704.txt";
my $envtablecellnumber = "$ublastxdir/DB/update_45_sarg2.0_cell.table_201704.txt";
##generate ppm
my $subtypeppm = "$opt_o.ppm.subtype.txt";
my $typeppm = "$opt_o.ppm.type.txt";
my $geneppm = "$opt_o.ppm.gene.txt";
#for 16s normalization
my $subtype16s = "$opt_o.normalize_16s.subtype.tab.txt";
my $type16s = "$opt_o.normalize_16s.type.tab.txt";
my $subtypemerge16s = "$opt_o.normalize_16s.mergesubtype.tab.txt";
my $gene16s = "$opt_o.normalize_16s.gene.tab.txt";
#for cell number normalization
my $subtypecellnumber = "$opt_o.normalize_cellnumber.subtype.tab.txt";
my $typecellnumber = "$opt_o.normalize_cellnumber.type.tab.txt";
my $subtypemergecellnumber = "$opt_o.normalize_cellnumber.mergesubtype.tab.txt";
my $genecellnumber = "$opt_o.normalize_cellnumber.gene.txt";
my $begin = localtime;
print "blastx begain";
##if blastx results is already there, the blastx can be skipped. this is important that some users would like to run blastx paralelly in a cluster for
##huge amount of data to accelerate the whole process
if($opt_b){
$blast6out = $opt_b;
}else{
`$ublastxdir/bin/blastx -query $opt_i -out $blast6out -db $ARDB_PATH -evalue $evaluematch -num_threads $opt_n -outfmt 6 -max_target_seqs 1`;
}
##process blastx results and the structure information of arg database
print "process meta data";
##process meta data-------------------------------------------------------------------------------
die "$! HERE META\n" unless open(Meta,"$opt_m");
my %sample2reads;
my %sample216s;
my %sample2cellnumber;
my %sample2cater;
my $headmeta = <Meta>;
my @hmeta = split(/\t/,$headmeta);
my $index = 3;
while(<Meta>){
chomp;
my @tt = split(/\t/,$_);
$sample2reads{$tt[1]} = $tt[-3];
$sample216s{$tt[1]} = $tt[-2];
$sample2cellnumber{$tt[1]} = $tt[-1];
$sample2cater{$tt[1]} = $tt[$index-1];
}
close Meta;
print "process ARDB to get the length information";
#process ARDB to get the length information
my %len;
die "$! HEREFA\n" unless open(LEN, "$ARDBFA");
while(my $name = <LEN>){
chomp($name);
$name =~ s/^>//;
my $seq = <LEN>; chomp($seq);
my $idsarg = (split(/\s+/,$name))[0];
my $le = length($seq);
$len{$idsarg} = $le;
}
close LEN;
print "process ARDB structure files";
##process ARDB structure files-------------------------------------------------------------------
die "$!HERESTRUCTURE\n" unless open(STRU, "$ARDB_STRUCTURE");
my %type;
my %subtype;
my %typelist;
my %subtypelist;
my %gene;
<STRU>;
while(<STRU>){
chomp;
my @tem = split /\t/;
my @stem = split("__", $tem[0]);
#print "$tem[0]\t$stem[0]\n";
$tem[1] =~ s/^\[//;
$tem[1] =~ s/\]$//;
my @ids = split(", ", $tem[1]);
##for each ids identify their type and subtype
for(my $i = 0; $i <=$#ids; $i++){
$ids[$i] =~ s/^\'//;
$ids[$i] =~ s/\'$//;
#print "$ids[$i]\n";
$subtype{$ids[$i]} = $tem[0];
$type{$ids[$i]} = $stem[0];
$gene{$ids[$i]} = 1;
}
#including all type and subtype
$typelist{$stem[0]} = 1;
$subtypelist{$tem[0]} = 1;
}
close STRU;
##parse blast6out results-----------------------------------------------------------------------
die "$!HEREBLAST\n" unless open(BLAST6, "$blast6out");
my %samplehit; #Hash->Hash sample->ARGs type/subtype->number of this ARG
my %samplenum;
my $upper="";
while(<BLAST6>){
chomp;
my @tem = split /\t/;
my $record = $tem[0];
next if ($record eq $upper);
if($tem[3] >= $lenmatch && $tem[2] >= $identitymatch && $tem[-2] <= $evaluematch){
$tem[0] =~ s/\_\d+$//g;
#print "$_\n";
die "$tem[0] $tem[1]\t $!\n" unless($type{$tem[1]} && $subtype{$tem[1]});
die "$tem[1]" unless(exists $len{$tem[1]});
##for type subtype quantification to 16S, calculate the ratio of the fragmented aligned genes
#my $ratio = 1 * 100 / ($len{$tem[1]} * 3);
my $ratio = $tem[3] / $len{$tem[1]};
if(exists $samplehit{$tem[0]}){
$samplehit{$tem[0]}{$type{$tem[1]}} += $ratio;
$samplehit{$tem[0]}{$subtype{$tem[1]}} += $ratio;
$samplehit{$tem[0]}{$tem[1]} += $ratio;
##For counts
$samplenum{$tem[0]}{$type{$tem[1]}} ++;
$samplenum{$tem[0]}{$subtype{$tem[1]}} ++;
$samplenum{$tem[0]}{$tem[1]} ++;
}else{
##type
$samplehit{$tem[0]}{$type{$tem[1]}} = $ratio;
##subtype
$samplehit{$tem[0]}{$subtype{$tem[1]}} = $ratio;
$samplehit{$tem[0]}{$tem[1]} = $ratio;
##fro PPM calculation count the reads as one
$samplenum{$tem[0]}{$type{$tem[1]}} =1;
$samplenum{$tem[0]}{$subtype{$tem[1]}} =1;
$samplenum{$tem[0]}{$tem[1]} = 1;
}
}
$upper = $record;
}
close BLAST6;
#-------------------------------------------------------16S Normalization-------Cell Number Normalization--------
##For each ARG type subtype generate mothor tables------------------------------------------------
##Hash -> Hash
die "$!\n" unless open(SUBP, ">$subtypeppm");
die "$!\n" unless open(TYPEP, ">$typeppm");
#----------------NEW ADD----------------------
die "$!\n" unless open(SUBM, ">$subtype16s");
die "$!\n" unless open(TYPEM, ">$type16s");
#------
die "$!\n" unless open(SUBC, ">$subtypecellnumber");
die "$!\n" unless open(TYPEC, ">$typecellnumber");
#------
die "$!\n" unless open(GENEP, ">$geneppm");
die "$!\n" unless open(GENEM, ">$gene16s");
die "$!\n" unless open(GENEC, ">$genecellnumber");
print SUBP "\nSubtype ppm\n";
print TYPEP "Type ppm\n";
print SUBM "ARGs abundance normalization aganist 16S";
print SUBC "ARGs abundance normalization aganist Cell number";
print TYPEM "Type level results";
print TYPEC "Type level results";
print GENEP "Gene to ppm\tSubtype\tType";
print GENEM "Gene to number of 16s copies\tSubtype\tType";
print GENEC "Gene to cell number level\tSutype\tType";
for my $id (sort keys %sample2reads){
print SUBP "\t$id";
print TYPEP "\t$id";
print SUBM "\t$id";
print TYPEM "\t$id";
#------
print SUBC "\t$id";
print TYPEC "\t$id";
print GENEP "\t$id";
print GENEM "\t$id";
print GENEC "\t$id";
}
print SUBP "\n";
print TYPEP "\n";
#--------------------
print SUBM "\n";
print TYPEM "\n";
#-------
print SUBC "\n";
print TYPEC "\n";
print GENEP "\n";
print GENEM "\n";
print GENEC "\n";
## output gene mothor table
for my $g (sort keys %gene){
print GENEP "$g\t$subtype{$g}\t$type{$g}";
print GENEM "$g\t$subtype{$g}\t$type{$g}";
print GENEC "$g\t$subtype{$g}\t$type{$g}";
for my $sam(sort keys %sample2reads){
#print "$sam\n";
if(exists $samplehit{$sam}{$g}){
##normalize the abundance with sample size and 16s copies
my $value = $samplehit{$sam}{$g} / $sample216s{$sam};
my $valuecls = $samplehit{$sam}{$g} / $sample2cellnumber{$sam};
print GENEM "\t$value";
print GENEC "\t$valuecls";
}else{
print GENEM "\t0";
print GENEC "\t0";
}
if(exists $samplenum{$sam}{$g}){
my $numb = $samplenum{$sam}{$g} * 1000000 / $sample2reads{$sam};
print GENEP "\t$numb";
}else{
print GENEP "\t0";
}
}
print GENEP "\n";
print GENEM "\n";
print GENEC "\n";
}
close GENEP;
close GENEM;
close GENEC;
##output subtype mothor table
for my $sub (sort keys %subtypelist){
print SUBP "$sub";
print SUBM "$sub";
print SUBC "$sub";
for my $sam(sort keys %sample2reads){
#print "$sam\n";
if(exists $samplehit{$sam}{$sub}){
##normalize the abundance with sample size and 16s copies
#my $value = 1000000 * $samplehit{$sam}{$sub} * 1432 / ($sample216s{$sam} * $sample2reads{$sam});
my $value = $samplehit{$sam}{$sub} / $sample216s{$sam};
#print "$sub\n";
my $valuecls = $samplehit{$sam}{$sub} / $sample2cellnumber{$sam};
print SUBM "\t$value";
print SUBC "\t$valuecls";
}else{
print SUBM "\t0";
print SUBC "\t0";
}
if(exists $samplenum{$sam}{$sub}){
my $numb = $samplenum{$sam}{$sub} * 1000000 / $sample2reads{$sam};
print SUBP "\t$numb";
}else{
print SUBP "\t0";
}
}
print SUBP "\n";
print SUBM "\n";
print SUBC "\n";
}
close SUBP;
close SUBM;
close SUBC;
for my $ty (sort keys %typelist){
print TYPEP "$ty";
print TYPEM "$ty";
print TYPEC"$ty";
for my $sam(sort keys %sample2reads){
if(exists $samplehit{$sam}{$ty}){
##normalize the abundance with sample size and 16s copies
#my $value = 1000000*$samplehit{$sam}{$ty} * 1432/ ($sample216s{$sam} * $sample2reads{$sam});
my $value = $samplehit{$sam}{$ty} / $sample216s{$sam};
print TYPEM "\t$value";
my $valuecls = $samplehit{$sam}{$ty} / $sample2cellnumber{$sam};
print TYPEC "\t$valuecls";
}else{
print TYPEM "\t0";
print TYPEC "\t0";
}
if(exists $samplenum{$sam}{$ty}){
my $numb = $samplenum{$sam}{$ty} * 1000000 / $sample2reads{$sam};
print TYPEP "\t$numb";
}else{
print TYPEP "\t0";
}
}
print TYPEP "\n";
print TYPEM "\n";
print TYPEC "\n";
}
#print TYPEM "\nSubtype ARGs abundance merge with other environmental samples\n";
#print TYPEC "\nSubtype ARGs abundance merge with other environmental samples\n";
close TYPEM;
close TYPEC;
close TYPEP;
#Merge users table with other environment samples ARGs table----------------------------------------
die "$!\n" unless open(SUBT, "$subtype16s");
die "$!\n" unless open(ENV, "$envtable16s");
die "$!\n" unless open(Merge, ">$subtypemerge16s");
#----------------------------------------------------------
<SUBT>;
my $h1 = <SUBT>;
my $h2 = <ENV>;
chomp($h1); chomp($h2);
my @h2 = split(/\t/, $h2, 2);
print Merge "$h1\t$h2[1]\n";
my %subt;
my %env;
while(<SUBT>){
chomp;
my @tem = split(/\t/, $_,2);
#print "$tem[0]\n";
$subt{$tem[0]} = $tem[1];
}
close SUBT;
my $envn = 0;
while(<ENV>){
chomp;
my @tem = split(/\t/,$_,2);
$env{$tem[0]} = $tem[1];
my @ts = split("\t", $tem[1]);
$envn = $#ts;
}
close ENV;
my @addzero;
for(my $i = 0; $i <= $envn; $i++){
push @addzero, 0;
}
my $addz = join("\t", @addzero);
for my $subts (sort keys %subt){
if(exists $env{$subts}){
print Merge "$subts\t$subt{$subts}\t$env{$subts}\n";
}else{
print Merge "$subts\t$subt{$subts}\t$addz\n";
#print "$subts\t$subt{$subts}\t$addz\n";
#die "wrong $subts\n";
}
}
close Merge;
#-------------------------------------------------------------------
#-----------------
die "$! 351 Line\n" unless open(SUBTC, "$subtypecellnumber");
die "$! 352 Line \n" unless open(ENVC, "$envtablecellnumber");
die "$! 353 Line\n" unless open(MergeC, ">$subtypemergecellnumber");
<SUBTC>;
my $h1c = <SUBTC>;
my $h2c = <ENVC>;
chomp($h1c); chomp($h2c);
my @h2c = split(/\t/, $h2c, 2);
print MergeC "$h1c\t$h2c[1]\n";
my %subtc;
my %envc;
while(<SUBTC>){
chomp;
my @tem = split(/\t/, $_,2);
#print "$tem[0]\n";
$subtc{$tem[0]} = $tem[1];
}
close SUBTC;
my $envnc = 0;
while(<ENVC>){
chomp;
my @tem = split(/\t/,$_,2);
$envc{$tem[0]} = $tem[1];
my @ts = split("\t", $tem[1]);
$envnc = $#ts;
}
close ENVC;
my @addzeroc;
for(my $i = 0; $i <= $envnc; $i++){
push @addzeroc, 0;
}
my $addzc = join("\t", @addzeroc);
for my $subtsc (sort keys %subtc){
if(exists $envc{$subtsc}){
print MergeC "$subtsc\t$subtc{$subtsc}\t$envc{$subtsc}\n";
}else{
print MergeC "$subtsc\t$subtc{$subtsc}\t$addzc\n";
#die "wrong $subts\n";
}
}
close MergeC;
#-----------------------------------------------------------------------------------------------------------------
##input user information 6 7
##output 6 7 8 9 10
my $pdf16s = "$opt_o.16S.pdf";
my $pdfcell = "$opt_o.cell.pdf";
my $normalize16s = "$opt_o.normalize.16s.txt";
my $normalizecell = "$opt_o.normalize.cell.txt";
my $ppmout = "$opt_o.ppm.txt";
##generate compressed output zip files
`cat $subtype16s $type16s $subtypemerge16s > $normalize16s`;
#$ARGV[8] = $zip16s;
`cat $subtypecellnumber $typecellnumber $subtypemergecellnumber > $normalizecell`;
#$ARGV[9] = $zipcellnumber;
`cat $typeppm $subtypeppm > $ppmout`;
##------------------------------------------------------------------------------------------------------
##PcoA analysis of existing environment samples and users samples-------------------------------------------------
my $rscript = "$opt_o.tmp.R";
die "$! 442 line\n" unless open(R,">$rscript");
my @name = split(/\t/, $h1);
my @caters = ();
for(my $i =1; $i <=$#name; $i++){
if(exists $sample2cater{$name[$i]}){
push @caters, "\"$sample2cater{$name[$i]}\"";
}else{
die "Wrong $name[$i]\n";
}
}
my $ocater = join(", ", @caters);
#print LOG "Start to generate PDF format PcoA figure for user samples and the samples in database\n";
##16S----------------------------------------------------------------------------
my $trs = <<RS;
mothertable <- read.table(file="$subtypemerge16s", sep="\\t",header=T,row.names=1,quote = "", stringsAsFactors = FALSE)
#remove zero line
mothertable <- mothertable[which(rowSums(mothertable)!=0),]
mothertable <- t(mothertable)
samples.orig <- rownames(mothertable) # recording original sample names
mothertable <- mothertable[which(rowSums(mothertable)!=0),]
dim(mothertable)
library(vegan)
library(labdsv)
library(ggplot2)
library(scales)
cols <- c($ocater, \"DrinkingwaterSystem\", \"DrinkingwaterSystem\", \"DrinkingwaterSystem\", \"DrinkingwaterSystem\", \"DrinkingwaterSystem\", \"DrinkingwaterSystem\", \"DrinkingwaterSystem\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"SewageTreatmentPlant\", \"Sediment\", \"Sediment\", \"Sediment\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"LiveStock\", \"Ocean\", \"Ocean\", \"Ocean\")
cols <- cols[match(rownames(mothertable), samples.orig)] #update cols in case certain samples has been filtered out.
pdf("$pdf16s")
vd <- vegdist(mothertable,method="bray")
vd.pco <- pco(vd, k=10)
pcoadata <- data.frame(vd.pco\$points[,1], vd.pco\$points[,2], cols)
EnvironmentType <- pcoadata\$cols
pc1n <- vd.pco\$eig[1]/sum(vd.pco\$eig)
pc2n <- vd.pco\$eig[2]/sum(vd.pco\$eig)
xl <- paste("Pco1(",(pc1n*10000)%/%100,"%)",sep="")
yl <- paste("Pco2(", (pc2n*10000)%/%100,"%)",sep="")
p <- ggplot(pcoadata, aes(x=pcoadata\$vd.pco.points...1., y=pcoadata\$vd.pco.points...2., color=EnvironmentType)) + geom_point(size=5,alpha=.8)
p+theme(legend.position=c(0.2,0.8), panel.border = element_blank(), panel.grid.major = element_blank(), panel.background = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"), legend.background = element_rect(fill=alpha('white', 0.2)) ) + labs(fill="Samples Type") + xlab(xl) + ylab(yl)
dev.off()
RS
print R $trs;
#------------------------------------------------------
##Cell number----------------------------------------------------------------------------
my $rscriptc = "$opt_o.cellnumber.tmp.R";
my $trsc = <<RS;
mothertable <- read.table(file="$subtypemergecellnumber", sep="\\t",header=T,row.names=1,quote = "", stringsAsFactors = FALSE)
#remove zero line
mothertable <- mothertable[which(rowSums(mothertable)!=0),]
mothertable <- t(mothertable)
mothertable <- mothertable[which(rowSums(mothertable)!=0),]
dim(mothertable)
pdf("$pdfcell")
vd <- vegdist(mothertable,method="bray")
vd.pco <- pco(vd, k=10)
pcoadata <- data.frame(vd.pco\$points[,1], vd.pco\$points[,2], cols)
EnvironmentType <- pcoadata\$cols
pc1n <- vd.pco\$eig[1]/sum(vd.pco\$eig)
pc2n <- vd.pco\$eig[2]/sum(vd.pco\$eig)
xl <- paste("Pco1(",(pc1n*10000)%/%100,"%)",sep="")
yl <- paste("Pco2(", (pc2n*10000)%/%100,"%)",sep="")
p <- ggplot(pcoadata, aes(x=pcoadata\$vd.pco.points...1., y=pcoadata\$vd.pco.points...2., color=EnvironmentType)) + geom_point(size=5,alpha=.8)
p+theme(legend.position=c(0.2,0.8), panel.border = element_blank(), panel.grid.major = element_blank(), panel.background = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"), legend.background = element_rect(fill=alpha('white', 0.2)) ) + labs(fill="Samples Type") + xlab(xl) + ylab(yl)
dev.off()
RS
print R $trsc;
close R;
`R CMD BATCH --args $rscript`;
__END__
1;