# HG changeset patch # User blankenberglab # Date 1543867448 18000 # Node ID 8def7dda3bee40323522a1c1004b3740fa119d43 # Parent 4865e7f4e9c517aebb09c80df07fca884f1bed1f planemo upload for repository https://github.com/blankenberglab/galaxy-tools-blankenberg/tree/master/tools/r-gpca commit f5a03b0978b3a7473f034b87a87765ff1d65d720 diff -r 4865e7f4e9c5 -r 8def7dda3bee r-gpca.R --- a/r-gpca.R Tue Nov 27 12:29:58 2018 -0500 +++ b/r-gpca.R Mon Dec 03 15:04:08 2018 -0500 @@ -3,7 +3,6 @@ library(gPCA) options(bitmapType='cairo') - # parse options option_list = list( make_option( @@ -38,7 +37,7 @@ action = "store_true", default = FALSE, help = "Is the input batch and data centered [default %default]" - ), + ), make_option( c("-y", "--scaleY"), action = "store_true", @@ -51,7 +50,7 @@ default = NULL, type = 'numeric', help = "Retain features" - ), + ), make_option( c( "--npcs"), action = "store", @@ -79,7 +78,7 @@ default = NA, type = 'character', help = "Numbers output" - ), + ), make_option( c("-o", "--html_outfile"), action = "store", @@ -98,7 +97,6 @@ } # Check parameter values - if ( ! file.exists(opt$batch)){ stop((paste('File for batch', opt$batch, 'does not exist'))) } @@ -111,20 +109,38 @@ batch<-as.matrix(read.delim(opt$batch, header=TRUE, row.names=1, sep="\t")) write('#Batch\tDelta\tP-value\tCumulative Variance',file = opt$numbers_outfile, append=TRUE) +write(' + + + + HTML gPCA

If you are seeing this then CSS is not whitelisted

Table of Contents

', file=opt$html_outfile, append=TRUE) for (row in 1:nrow(batch)) { batch1<-as.numeric(factor(batch[row,])) - out<-gPCA.batchdetect(x=data, batch=batch1, center=opt$center, scaleY=opt$scaleY, nperm=opt$nperm, filt=opt$filt, seed=opt$seed) - out$varPCg1<-((out$varPCg1-out$varPCu1)/out$varPCg1)*100 - write(paste(row.names(batch)[row],out$delta,out$p.val,out$varPCg1,sep="\t"),file = opt$numbers_outfile, append=TRUE) # General Distribution @@ -133,66 +149,55 @@ gDist(out) invisible(dev.off()) - # Guided/Unguided 1v2 par(mai=c(0.8,0.8,0.1,0.1),cex=0.8) png(paste(opt$path,'/guided_1v2_',row,'.png', sep=""), width=1020, height=800, units='px') PCplot(out,ug="unguided",type="1v2") invisible(dev.off()) - par(mai=c(0.8,0.8,0.1,0.1),cex=0.8) png(paste(opt$path,'/unguided_1v2_',row,'.png', sep=""), width=1020, height=800, units='px') PCplot(out,ug="unguided",type="1v2") invisible(dev.off()) - # Guided/Unguided comp,3 par(mai=c(0.65,0.65,0.1,0.1),cex=0.8) png(paste(opt$path,'/guided_npcs_',row,'.png', sep=""), width=1020, height=800, units='px') PCplot(out,ug="guided",type="comp",npcs=opt$npcs) invisible(dev.off()) - par(mai=c(0.65,0.65,0.1,0.1),cex=0.8) png(paste(opt$path,'/unguided_npcs_',row,'.png', sep=""), width=1020, height=800, units='px') PCplot(out,ug="unguided",type="comp",npcs=opt$npcs) invisible(dev.off()) - # Guided/Unguided CumlativeVarPlot par(mai=c(0.8,0.8,0.1,0.1),cex=0.8) png(paste(opt$path,'/guided_var_',row,'.png', sep=""), width=1020, height=800, units='px') CumulativeVarPlot(out,ug="guided",col="blue") invisible(dev.off()) - par(mai=c(0.8,0.8,0.1,0.1),cex=0.8) png(paste(opt$path,'/unguided_var_',row,'.png', sep=""), width=1020, height=800, units='px') CumulativeVarPlot(out,ug="unguided",col="blue") invisible(dev.off()) - write(paste0(' -
',row.names(batch)[row],'
-
- +

',row.names(batch)[row],'

+
+
- + -
DeltaP-valuevarPCg1
',out$delta,'',out$p.val,'',out$varPCg1,'',out$delta,' ',out$p.val,' ',out$varPCg1,'
-

-
Guided 1v2

-
Unguided 1v2

- -
Guided Compare to ',opt$npcs,'

-
Unguided Compare to ',opt$npcs,'

- -
Guided Cumulative Variance

-
Unguided Cumulative Variance

- +
+

gDist


gDist +
+

Guided 1v2


guided_1v2
+

Unguided 1v2


unguided_1v2
+

Guided Compare to ',opt$npcs,'


guided_npcs
+

Unguided Compare to ',opt$npcs,'


unguided_npcs
+

Guided Cumulative Variance


guided_var
+

Unguided Cumulative Variance


unguided_var
'), file = opt$html_outfile, append=TRUE) } -write(paste('

Back to Top

'),file = opt$html_outfile, append=TRUE) - -sessionInfo() +write(paste('Back to Top'),file = opt$html_outfile, append=TRUE) diff -r 4865e7f4e9c5 -r 8def7dda3bee r-gpca.xml --- a/r-gpca.xml Tue Nov 27 12:29:58 2018 -0500 +++ b/r-gpca.xml Mon Dec 03 15:04:08 2018 -0500 @@ -56,13 +56,16 @@ - + - + - + - + @@ -78,18 +81,22 @@ - - + + - - + + - + @@ -118,13 +125,11 @@ npcs: number of principal components to calculate **Literature** - https://cran.r-project.org/web/packages/gPCA/gPCA.pdf https://cran.r-project.org/web/packages/gPCA/vignettes/gPCA.pdf **Input File Help** - Batch: The batch file must be a tab delimited file. It will be read as a numeric vector, consisting of as many different batches as you like. The test data file batch_in_multiple_1.tabular shows the correct format. The length of batch must conform to the data matrix or an error will occur. Data: The data file must be a tab delimited file. It will be read in as a matrix. The test data file data_in_1.tabular shows the correct format. If you are receving errors about nonconformed matrices in your matrix you might need to transpose your matrix before using it in the tool. diff -r 4865e7f4e9c5 -r 8def7dda3bee test-data/html_outfile_1/html_outfile_1.html --- a/test-data/html_outfile_1/html_outfile_1.html Tue Nov 27 12:29:58 2018 -0500 +++ b/test-data/html_outfile_1/html_outfile_1.html Mon Dec 03 15:04:08 2018 -0500 @@ -1,26 +1,46 @@ - -

Table of Contents

+ + + + + HTML gPCA

If you are seeing this then CSS is not whitelisted

Table of Contents

-
time_period
-
- +

time_period

+
+
- + -
DeltaP-valuevarPCg1
0.8244470050305770.51220.62956990728170.824447005030577 0.512 20.6295699072817
-

-
Guided 1v2

-
Unguided 1v2

+
+

gDist


gDist +
+

Guided 1v2


guided_1v2
+

Unguided 1v2


unguided_1v2
+

Guided Compare to 3


guided_npcs
+

Unguided Compare to 3


unguided_npcs
+

Guided Cumulative Variance


guided_var
+

Unguided Cumulative Variance


unguided_var
-
Guided Compare to 3

-
Unguided Compare to 3

- -
Guided Cumulative Variance

-
Unguided Cumulative Variance

- - -

Back to Top

+Back to Top diff -r 4865e7f4e9c5 -r 8def7dda3bee test-data/html_outfile_2/html_outfile_2.html --- a/test-data/html_outfile_2/html_outfile_2.html Tue Nov 27 12:29:58 2018 -0500 +++ b/test-data/html_outfile_2/html_outfile_2.html Mon Dec 03 15:04:08 2018 -0500 @@ -1,49 +1,67 @@ - -

Table of Contents

+ + + + + HTML gPCA

If you are seeing this then CSS is not whitelisted

Table of Contents

-
time_period
-
- +

time_period

+
+
- + -
DeltaP-valuevarPCg1
0.8244470050305770.51220.62956990728170.824447005030577 0.512 20.6295699072817
-

-
Guided 1v2

-
Unguided 1v2

- -
Guided Compare to 3

-
Unguided Compare to 3

- -
Guided Cumulative Variance

-
Unguided Cumulative Variance

+
+

gDist


gDist +
+

Guided 1v2


guided_1v2
+

Unguided 1v2


unguided_1v2
+

Guided Compare to 3


guided_npcs
+

Unguided Compare to 3


unguided_npcs
+

Guided Cumulative Variance


guided_var
+

Unguided Cumulative Variance


unguided_var
- -
random_batch
-
- +

random_batch

+
+
- + -
DeltaP-valuevarPCg1
0.977890001737870.08619.2605647916290.97789000173787 0.086 19.260564791629
-

-
Guided 1v2

-
Unguided 1v2

+
+

gDist


gDist +
+

Guided 1v2


guided_1v2
+

Unguided 1v2


unguided_1v2
+

Guided Compare to 3


guided_npcs
+

Unguided Compare to 3


unguided_npcs
+

Guided Cumulative Variance


guided_var
+

Unguided Cumulative Variance


unguided_var
-
Guided Compare to 3

-
Unguided Compare to 3

- -
Guided Cumulative Variance

-
Unguided Cumulative Variance

- - -

Back to Top

+Back to Top