BridgeRNormalizationFactorsHK: Estimate normalization factor using house-keeping genes

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/Z3_estimate_normalization_factor_House_keeping_genes.r

Description

Estimate normalization factor using house-keeping genes

Usage

1
BridgeRNormalizationFactorsHK(InputFile, group, hour, InforColumn = 4, InforHKGenes = 2, HKGenes = c("GAPDH", "PGK1", "PPIA", "ENO1", "ATP5B", "ALDOA"), OutputFile = "BridgeR_3B_Normalizaion_factor_from_House_keeping_genes.txt")

Arguments

InputFile

File path/name

group

Vector(string)

hour

Vector(number)

InforColumn

Integer

InforHKGenes

Integer

HKGenes

Vector(String)

OutputFile

File path/name

Details

Estimate normalization factor using house-keeping genes

Value

text file

Note

2015-11-05

Author(s)

Naoto Imamachi

References

https://github.com/Naoto-Imamachi/BRIC-seq_data_analysis/tree/master/BridgeR

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
60
61
62
63
64
65
66
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
#inputfile <- "BridgeR_1_Relative_expression_dataset.txt"
#outputfile <- "BridgeR_3_Normalizaion_factor_HouseKeepingGenes.txt"
#group <- c("Control","knockdown1","knockdown2")
#hour <- c(0,1,2,4,8,12)

#BridgeRNormalizationFactorsHK(InputFile=inputfile, group=group, hour=hour, OutputFile=outputfile)

## The function is currently defined as
function (InputFile, group, hour, InforColumn = 4, InforHKGenes = 2, 
    HKGenes = c("GAPDH", "PGK1", "PPIA", "ENO1", "ATP5B", "ALDOA"), 
    OutputFile = "BridgeR_3B_Normalizaion_factor_from_House_keeping_genes.txt") 
{
    group_number <- length(group)
    time_points <- length(hour)
    input_file <- fread(InputFile, header = T)
    hour_label <- NULL
    for (x in hour) {
        label <- x
        if (x < 10) {
            label <- paste("0", x, sep = "")
        }
        hour_label <- append(hour_label, paste("T", label, "_", 
            a, sep = ""))
    }
    cat("Sample", hour_label, sep = "\t", file = OutputFile)
    cat("\n", file = OutputFile, append = T)
    for (a in 1:group_number) {
        HKgenes_infor <- input_file[[InforHKGenes]]
        HKgenes_infor_index <- NULL
        for (x in 1:length(HKGenes)) {
            HKgenes_infor_index <- append(HKgenes_infor_index, 
                which(HKgenes_infor == HKGenes[x]))
        }
        infor_st <- 1 + (a - 1) * (time_points + InforColumn)
        infor_ed <- (InforColumn) * a + (a - 1) * time_points
        exp_st <- infor_ed + 1
        exp_ed <- infor_ed + time_points
        HKGenes_raw_data <- NULL
        for (x in 1:length(HKgenes_infor_index)) {
            if (x == 1) {
                HKGenes_raw_data <- input_file[HKgenes_infor_index[x], 
                  exp_st:exp_ed, with = F]
            }
            else {
                HKGenes_raw_data <- rbind(HKGenes_raw_data, input_file[HKgenes_infor_index[x], 
                  exp_st:exp_ed, with = F])
            }
        }
        nf <- NULL
        for (x in 1:length(HKGenes_raw_data)) {
            if (x == 1) {
                nf <- as.vector(as.matrix(HKGenes_raw_data[x, 
                  ]))
            }
            else {
                nf <- HKGenes_raw_data[x, ] * nf
            }
        }
        nf <- nf^(1/length(HKGenes))
        cat(group[a], nf, sep = "\t", file = OutputFile, append = T)
        cat("\n", file = OutputFile, append = T)
    }
  }

Naoto-Imamachi/BridgeR documentation built on May 7, 2019, 6:05 p.m.