Learn R Programming

spade (version 1.20.0)

SPADE.downsampleFCS: Downsample observcations in a FCS file according to density parameter

Description

Downsample the observations in a FCS file according to a previously computed density parameter. The goal is to produce a smaller set of observations with similar density. Downsampling is independent of how the density is modeled.

Usage

SPADE.downsampleFCS(infilename, outfilename, exclude_pctile = 0.01, target_pctile = 0.05, desired_samples = NULL)

Arguments

infilename
Name of the input FCS file. Must have a parameter named "density".
outfilename
Name of the output FCS file
exclude_pctile
Numeric value in [0,1]. Densities below this percentile will be excluded.
target_pctile
Numeric value in [0,1]. Densities below this percentile, but above exclude_pctile will be retained. Only meaningful if desired_samples is NULL.
desired_samples
Desired number of samples. If set to integer value, the target percentile will be set internally to downsample to approximately the desired number of samples.

Value

The name of the written file is returned

See Also

SPADE.addDensityToFCS

Examples

Run this code
	# Not run
	## Load two-parameters sample data included in package
	#data_file_path = paste(installed.packages()["spade","LibPath"],"spade","extdata","SimulatedRawData.fcs",sep=.Platform$file.sep)

	#output_dir <- tempdir()
	#
	## Compute and annotate FCS file with density
	#density_file_path <- paste(output_dir,.Platform$file.sep,basename(data_file_path),".density.fcs",sep="")
	#SPADE.addDensityToFCS(data_file_path, density_file_path, cols=c("marker1","marker2"))

	## Downsample FCS file based on density
	#downsample_file_path <- paste(output_dir,.Platform$file.sep,basename(data_file_path),".density.fcs",sep="")
	#SPADE.downsampleFCS(density_file_path, downsample_file_path)

Run the code above in your browser using DataLab