# HG changeset patch # User lecorguille # Date 1435660689 14400 # Node ID 79c7fdc90ed63cdffb658339528771c68123832e Uploaded diff -r 000000000000 -r 79c7fdc90ed6 abims_acp.r --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/abims_acp.r Tue Jun 30 06:38:09 2015 -0400 @@ -0,0 +1,46 @@ +#!/usr/local/public/bin/Rscript +# abims_acp.r version="1.1" + +# date: 04-06-2013 +# **Authors** Gildas Le Corguille ABiMS - UPMC/CNRS - Station Biologique de Roscoff - gildas.lecorguille|at|sb-roscoff.fr + + + +#function PCA from package FactoMineR + +library(batch) +library(FactoMineR) + +acp_metabolomics=function(file ,graph=FALSE, scale.unit=TRUE, sep=";", dec="."){ + + if (sep=="tabulation") sep="\t" + if (sep=="semicolon") sep=";" + if (sep=="comma") sep="," + + # -- loading -- + data=read.table(file, header = TRUE, row.names=1, sep = sep, quote="\"", dec = dec, + fill = TRUE, comment.char="",na.strings = "NA") + + # -- acp / output pdf -- + resPCA =PCA(t(data),graph=graph, scale.unit=scale.unit) + # scale.unit=F : on réalise l'ACP sans la réduction des variables + # graph=F : pas de sortie graphique + dev.off() #close plot + dev.off() + + # -- output png -- + # Percentage of variance + png("percentage_of_variance.png", width =800, height = 400); + barplot(resPCA$eig$per,xlab="Components",ylab="percentage of variance"); + dev.off() + + png("eigenvalue.png", width =800, height = 400); + barplot(resPCA$eig$eig,xlab="Components",ylab="eigenvalue"); + dev.off() + + # -- output / return -- + system("zip -r acp.zip percentage_of_variance.png eigenvalue.png Rplots*.pdf", ignore.stdout = TRUE) +} + +listArguments = parseCommandArgs(evaluate=FALSE) +do.call(acp_metabolomics, listArguments) diff -r 000000000000 -r 79c7fdc90ed6 abims_acp.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/abims_acp.xml Tue Jun 30 06:38:09 2015 -0400 @@ -0,0 +1,171 @@ + + + Principal Component Analysis using FactoMineR + + + abims_acp.r file "$input" graph TRUE scale.unit "$scale_unit" sep "$sep" dec "$dec" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +.. class:: infomark + +**Authors** Gildas Le Corguille ABiMS - UPMC/CNRS - Station Biologique de Roscoff - gildas.lecorguille|at|sb-roscoff.fr + +--------------------------------------------------- + +=== +PCA +=== + +----------- +Description +----------- + + +Performs **Principal Component Analysis (PCA)** with supplementary individuals, supplementary quantitative variables and supplementary categorical variables. +Missing values are replaced by the column mean. This scripts uses the FactoMineR package. + + +----------- +Input files +----------- + ++---------------------------+------------+ +| Parameter : num + label | Format | ++===========================+============+ +| 1 : Data Matrix file | Tabular | ++---------------------------+------------+ + + + +---------- +Parameters +---------- + +**Data Matrix file** + +Matrix of numeric data with headers (tabular format) issued from diffreport or annotateDiffreport to make post xcms analyse . + +**scale.unit** + +If FALSE: no reduction of the variables + +**Separator of columns:** + +Type of separator for the columns + +**Decimal separator:** + +Type of decimal separator of the numbers in your tabular files. + + + +------------ +Output files +------------ + + + +**input_name.pca.zip** + + | A zip file containing fours files (eigenvalue.png, percentage_of_variance.png, Rplots.pdf and Rplots1.pdf). + + +--------------------------------------------------- + + + +--------------- +Working example +--------------- + + +Input files +----------- + +**>A part of an example of Data Matrix file input :** + + ++--------+------------------+----------------+ +| Name | AN7 | AN8 | ++========+==================+================+ +|M102T645| 10880.0637170802 |17207.2222120537| ++--------+------------------+----------------+ +|M105T604| 41911.160863452 |38105.7953589089| ++--------+------------------+----------------+ + + + +Parameters +---------- + +| scale.unit -> **TRUE* +| Separator of columns: -> **tabulation** +| Decimal separator -> **.** + + + +Output files +------------ + + +**eigenvalue.png:** + +.. image:: pca_abims_eigenvalue.png + +**percentage_of_variance.png:** + +.. image:: pca_abims_percentage_of_variance.png + +**Rplots.pdf:** + +.. image:: pca_abims_Rplots.png + +**Rplots1.pdf:** + +.. image:: pca_abims_Rplots1.png + + + + + + + diff -r 000000000000 -r 79c7fdc90ed6 static/images/anova_filtered.png Binary file static/images/anova_filtered.png has changed diff -r 000000000000 -r 79c7fdc90ed6 static/images/anova_pvalue.png Binary file static/images/anova_pvalue.png has changed diff -r 000000000000 -r 79c7fdc90ed6 static/images/hclust.png Binary file static/images/hclust.png has changed diff -r 000000000000 -r 79c7fdc90ed6 static/images/pca_abims_Rplots.png Binary file static/images/pca_abims_Rplots.png has changed diff -r 000000000000 -r 79c7fdc90ed6 static/images/pca_abims_Rplots1.png Binary file static/images/pca_abims_Rplots1.png has changed diff -r 000000000000 -r 79c7fdc90ed6 static/images/pca_abims_eigenvalue.png Binary file static/images/pca_abims_eigenvalue.png has changed diff -r 000000000000 -r 79c7fdc90ed6 static/images/pca_abims_percentage_of_variance.png Binary file static/images/pca_abims_percentage_of_variance.png has changed