File: combine.R

package info (click to toggle)
r-bioc-edger 3.40.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,484 kB
  • sloc: cpp: 1,425; ansic: 1,109; sh: 21; makefile: 5
file content (37 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download | duplicates (3)
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

cbind.DGEList <- function(..., deparse.level=1)
#  Combine samples from DGEList objects with same genelists
#  Gordon Smyth
#  20 June 2017
{
	objects <- list(...)
	nobjects <- length(objects)
	out <- objects[[1]]
	out$design <- NULL
	if(nobjects > 1)
	for (i in 2:nobjects) {
		out$counts <- cbind(out$counts,objects[[i]]$counts)
		out$weights <- cbind(out$weights,objects[[i]]$weights)
		out$offset <- cbind(out$offset,objects[[i]]$offset)
		out$samples <- rbind(out$samples,objects[[i]]$samples)
	}
	out
}

rbind.DGEList <- function(..., deparse.level=1)
#  Combine genes from EList objects with same samples
#  Gordon Smyth
#  20 June 2017
{
	objects <- list(...)
	nobjects <- length(objects)
	out <- objects[[1]]
	if(nobjects > 1)
	for (i in 2:nobjects) {
		out$counts <- rbind(out$counts,objects[[i]]$counts)
		out$weights <- rbind(out$weights,objects[[i]]$weights)
		out$offset <- rbind(out$offset,objects[[i]]$offset)
		out$genes <- rbind(out$genes,objects[[i]]$genes)
	}
	out
}