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

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/downsample.R

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

1
2
3
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

Note

Underlying implementations have been parallelized with OpenMP. Set OMP_NUM_THREADS in environment to control the number of threads used.

Author(s)

Michael Linderman

See Also

SPADE.addDensityToFCS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
	# 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)

nolanlab/spade documentation built on May 23, 2019, 9:32 p.m.