Attach results from DEMIDiff object to DEMIExperiment object

Share:

Description

The function attachResult attaches results stored in a DEMIDiff object to the underlying DEMIExperiment object. This function is useful because DEMIDiff can store results only for one differential expression analysis run whereas DEMIExperiment object can store all the results done on the same metadata stored in the DEMIExperiment object. So the user is allowed to keep several DEMI differential expression analysis results in one DEMIExperiment object for ease of use.

Usage

1
2
3
4
attachResult(object, diffObject)

## S4 method for signature 'DEMIExperiment,DEMIDiff'
attachResult(object, diffObject)

Arguments

object

A DEMIExperiment object. The user needs to make sure that the DEMIExperiment object where the results will be added is identical to the DEMIExperiment object whose metadata was used to calculate differential expression.

diffObject

A DEMIDiff object. The results from the diffObject parameter will be added to the results of the DEMIExperiment object in the object parameter.

Details

When adding results to DEMIExperiment object from a DEMIDiff object the user needs to make sure that the DEMIExperiment object that is stored under DEMIDiff object is identical to the DEMIExperiment object where the results will be added to. You can access the DEMIExperiment object from the DEMIDiff object with the function getExperiment(x) where x is a DEMIDiff object. With the function identical you can check if the DEMIExperiment objects are indeed identical.

Value

Returns a DEMIExperiment updated with the results from DEMIDiff object.

Author(s)

Sten Ilmjarv

See Also

DEMIExperiment,DEMIDiff,getExperiment,identical

Examples

 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
## Not run: 

# To use the example we need to download a subset of CEL files from
# http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE9819 published
# by Pradervand et al. 2008.

# Set the destination folder where the downloaded files fill be located.
# It can be any folder of your choosing.
destfolder <- "demitest/testdata/"

# Download packed CEL files and change the names according to the feature
# they represent (for example to include UHR or BRAIN in them to denote the
# features).
# It is good practice to name the files according to their features which
# allows easier identification of the files later.

ftpaddress <- "ftp://ftp.ncbi.nlm.nih.gov/geo/samples/GSM247nnn"
download.file( paste( ftpaddress, "GSM247694/suppl/GSM247694.CEL.gz", sep = "/" ),
		destfile = paste( destfolder, "UHR01_GSM247694.CEL.gz", sep = "" ) )
download.file( paste( ftpaddress, "GSM247695/suppl/GSM247695.CEL.gz", sep = "/" ),
		destfile = paste( destfolder, "UHR02_GSM247695.CEL.gz", sep = "" ) )
download.file( paste( ftpaddress, "GSM247698/suppl/GSM247698.CEL.gz", sep = "/" ),
		destfile = paste( destfolder, "UHR03_GSM247698.CEL.gz", sep = "" ) )
download.file( paste( ftpaddress, "GSM247699/suppl/GSM247699.CEL.gz", sep = "/" ),
		destfile = paste( destfolder, "UHR04_GSM247699.CEL.gz", sep = "" ) )
download.file( paste( ftpaddress, "GSM247696/suppl/GSM247696.CEL.gz", sep = "/" ),
		destfile = paste( destfolder, "BRAIN01_GSM247696.CEL.gz", sep = "" ) )
download.file( paste( ftpaddress, "GSM247697/suppl/GSM247697.CEL.gz", sep = "/" ),
		destfile = paste( destfolder, "BRAIN02_GSM247697.CEL.gz", sep = "" ) )
download.file( paste( ftpaddress, "GSM247700/suppl/GSM247700.CEL.gz", sep = "/" ),
		destfile = paste( destfolder, "BRAIN03_GSM247700.CEL.gz", sep = "" ) )
download.file( paste( ftpaddress, "GSM247701/suppl/GSM247701.CEL.gz", sep = "/" ),
		destfile = paste( destfolder, "BRAIN04_GSM247701.CEL.gz", sep = "" ) )

# We need the gunzip function (located in the R.utils package) to unpack the gz files.
# Also we will remove the original unpacked files for we won't need them.
library( R.utils )
for( i in list.files( destfolder ) ) {
	gunzip( paste( destfolder, i, sep = "" ), remove = TRUE )
}

# Now we can continue the example of the function attachResult.

# Set up an experiment
demiexp <- DEMIExperiment( analysis = 'gene', celpath = destfolder,
			experiment = 'myexperiment', organism = 'homo_sapiens' )

# Create clusters with an optimized wilcoxon's rank sum test incorporated within demi that
# precalculates the probabilities
demiclust <- DEMIClust( demiexp, group = c( "BRAIN", "UHR" ), clust.method = demi.wilcox.test.fast )

# Calcuate differential expression
demidiff <- DEMIDiff( demiclust )

# Attach the differential expression analysis results to the original 'DEMIExperiment' object
demiexp <- attachResult( demiexp, demidiff )


## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.