RC_filter: RC_filter

Description Usage Arguments Details Author(s) References Examples

View source: R/RC_filter.R

Description

Take a Dataframe and return a transposed and filtered dataframe.

Usage

1

Arguments

Data

Your initial dataframe containing the gene expression or microarray value for examples

Filter

The value you want ot filter on. In our case this value is based on the graph from the RC_Kernel function. It is a background noise filter.

Details

Filter a dataframe on threshold value (Filter) that is present in a specific number of samples (Nsample). The function is based on the code from Damien valour your humble servier musician: apply(Data_t>Filter,1,FUN=function(x)sum(x=="TRUE")) > NSample But be careful if you choose a threshold from a graph with transformed data, just do the back transfo to get the real value you to filter on raw data.

Author(s)

Benjamin Vittrant

References

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4728800/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
RC_filter = function(Data, Filter, NSample){
  # Filter the row in Data which have at least Nsample with more
  # than (2^Filter-1) counts
  # Because we usually choose a filter from a log2 transfo density graph
  # We used this value as filter and then we re-transformed it to be
  # coherent with raw counts
  # Data_t = as.data.frame(t(Data))
  tmp = apply(Data>Filter, 2, FUN = function(x)sum(x == "TRUE")) > NSample
  tmp = colnames(Data)[tmp]
  Data_filtered = Data[, colnames(Data) 
  # Some printing
  print(paste("Start : ", ncol(Data), sep=""))
  print(paste("End : ", ncol(Data_filtered), sep=""))
  print(paste("Diff : ", (ncol(Data)-ncol(Data_filtered)), sep=""))
  return(Data_filtered)
}

bvittrant/RCommon documentation built on May 4, 2020, 3:04 p.m.