Last data update: 2014.03.03

R: Clone a ncdfFlowSet
clone.ncdfFlowSetR Documentation

Clone a ncdfFlowSet

Description

Create a new ncdfFlowSet object from an existing one

Usage

clone.ncdfFlowSet(ncfs, ncdfFile = NULL, isEmpty = TRUE, isNew = TRUE,
  dim = 2, compress = 0)

Arguments

ncfs

A ncdfFlowSet.

ncdfFile

A character scalar giving the output file name. By default, It is NULL and the function will generate a random file name, potentially adding the .cdf suffix unless a file extension is already present. It is only valid when isNewNcFile=TRUE

isEmpty

A logical scalar indicating whether the raw data should also be copied.if FALSE, an empty cdf file is created with the same dimensions (sample*events*channels) as the orignial one.

isNew

A logical scalar indicating whether the new cdf file should be created. If FALSE, the original cdf file is associated with the new ncdfFlowSet object.

dim

integer see details in read.ncdfFlowset.

compress

integer see details in read.ncdfFlowset.

Value

A ncdfFlowSet object

See Also

read.ncdfFlowSet

Examples

path<-system.file("extdata","compdata","data",package="flowCore")
files<-list.files(path,full.names=TRUE)[1:3]

#create ncdfFlowSet from fcs
nc1  <- read.ncdfFlowSet(files=files,ncdfFile="ncfsTest.nc",flowSetId="fs1",isWriteSlice= TRUE)

##clone the ncdfFlowSet object,by default the actual raw data is not added
nc2<-clone.ncdfFlowSet(nc1,"clone.nc")
nc2[[1]]

#add the actual raw data
fs1  <- read.flowSet(files=files)
nc2[[sampleNames(fs1)[1]]] <- fs1[[1]]
nc2[[1]]

#delete the cdf file associated with ncdfFlowSet before removing it from memory
unlink(nc2)
rm(nc2)

unlink(nc1)
rm(nc1)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ncdfFlow)
Loading required package: flowCore
Loading required package: flowViz
Loading required package: lattice
Loading required package: RcppArmadillo
Loading required package: BH
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ncdfFlow/clone.ncdfFlowSet.Rd_%03d_medium.png", width=480, height=480)
> ### Name: clone.ncdfFlowSet
> ### Title: Clone a ncdfFlowSet
> ### Aliases: clone.ncdfFlowSet
> 
> ### ** Examples
> 
> path<-system.file("extdata","compdata","data",package="flowCore")
> files<-list.files(path,full.names=TRUE)[1:3]
> 
> #create ncdfFlowSet from fcs
> nc1  <- read.ncdfFlowSet(files=files,ncdfFile="ncfsTest.nc",flowSetId="fs1",isWriteSlice= TRUE)
All FCS files have the same following channels:
FSC-H
SSC-H
FL1-H
FL2-H
FL3-H
FL1-A
FL4-H
write 060909.001 to empty cdf slot...
write 060909.002 to empty cdf slot...
write 060909.003 to empty cdf slot...
done!
> 
> ##clone the ncdfFlowSet object,by default the actual raw data is not added
> nc2<-clone.ncdfFlowSet(nc1,"clone.nc")
> nc2[[1]]
flowFrame object '060909.001'
with 0 cells and 7 observables:
     name       desc range minRange maxRange
$P1 FSC-H FSC-Height  1024        0     1023
$P2 SSC-H SSC-Height  1024        0     1023
$P3 FL1-H       <NA>  1024        1    10000
$P4 FL2-H       <NA>  1024        1    10000
$P5 FL3-H       <NA>  1024        1    10000
$P6 FL1-A       <NA>  1024        0     1023
$P7 FL4-H       <NA>  1024        1    10000
139 keywords are stored in the 'description' slot
> 
> #add the actual raw data
> fs1  <- read.flowSet(files=files)
> nc2[[sampleNames(fs1)[1]]] <- fs1[[1]]
write 060909.001 to empty cdf slot...
> nc2[[1]]
flowFrame object '060909.001'
with 10000 cells and 7 observables:
     name       desc range minRange maxRange
$P1 FSC-H FSC-Height  1024        0     1023
$P2 SSC-H SSC-Height  1024        0     1023
$P3 FL1-H       <NA>  1024        1    10000
$P4 FL2-H       <NA>  1024        1    10000
$P5 FL3-H       <NA>  1024        1    10000
$P6 FL1-A       <NA>  1024        0     1023
$P7 FL4-H       <NA>  1024        1    10000
141 keywords are stored in the 'description' slot
> 
> #delete the cdf file associated with ncdfFlowSet before removing it from memory
> unlink(nc2)
> rm(nc2)
> 
> unlink(nc1)
> rm(nc1)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>