NGScopy-class {NGScopy} | R Documentation

## Detection of copy number variations in next generation sequencing (NGS)

### Description

NGScopy is a reference class to detect copy number variations by “restriction-imposed windowing” in next generation sequencing (NGS).

### Details

Detection of copy number variations in next generation sequencing (NGS)

### Fields

`inFpathN`

  character, the file path to the control (normal) sample

`inFpathT`

  character, the file path to the case (tumor) sample

`outFpre`

  character, the file path of the directory for output.

`libsizeN`

  numeric, the library size of the control (normal) sample.

`libsizeT`

  numeric, the library size of the case (tumor) sample.

`mindepth`

  numeric, the minimal depth of reads per window.

`minsize`

  numeric, the minimal size of a window.

`regions`

  data.frame of three columns (chr/start/end), the regions to study. It follows the BED format: zero-based, half-open; (start,end].

`segtype`

  character, the type of change to capture during segmentation, mean and/or variance, normal or nonparametric distributions. A character vector with a single or multiple values from c("mean.norm","meanvar.norm","mean.cusum","var.css"). see `changepoint`.

`dsN`

  integer, the downsampling factor of the control (normal) sample.

`dsT`

  integer, the downsampling factor of the case (tumor) sample.

`MoreArgs.cn`

  list, a list of arguments for method ‘calc_cn’. See `set_MoreArgs.cn`.

`MoreArgs.segm`

  list, a list of arguments for method ‘calc_segm’. See `set_MoreArgs.segm`.

`pcThreads`

  integer, the number of processors performing the parallel computing.

`auto.save`

  logical, whether to save (any completed results) automatically.

`auto.load`

  logical, whether to load (any previously completed results) automatically.

`force.rerun`

  character, the names of methods to rerun regardless of any previous runs, default to c().

`out`

  list, the output.

### Methods

`calc_cn()`

  Calculate the relative copy number ratios (CNRs) per window, using the depth in the control (normal) sample as denominator and the case (tumor) sample as numerator.

`calc_segm()`

  Calculate the segment and detect the change points.

`get_cn()`

  Get the copy number object.

`get_cnr()`

  Get the copy number ratios.

`get_data.cn(as.granges = FALSE)`

  Get the data.frame of copy number.

`get_dataN()`

  Get the data of the normal per window.

`get_data.segm(as.granges = FALSE)`

  Get the data.frame of segmentation.

`get_dataT()`

  Get the data of the normal per window.

`get_depthN()`

  Get the depth of the normal per window.

`get_depthT()`

  Get the depth of the tumor per window.

`get_dsN()`

  Get dsN

`get_dsT()`

  Get dsT

`get_inFpathN()`

  Get inFpathN

`get_inFpathT()`

  Get inFpathT

`get_libsizeN()`

  Get libsizeN

`get_libsizeT()`

  Get libsizeT

`get_mindepth()`

  Get mindepth

`get_minsize()`

  Get minsize

`get_MoreArgs.cn()`

  Get MoreArgs.cn

`get_MoreArgs.segm()`

  Get MoreArgs.segm

`get_outFpre()`

  Get outFpre

`get_pcThreads()`

  Get pcThreads

`get_pos()`

  Get the position (midpoint) per window.

`get_reflength()`

  Get reference genome length in the normal sample.

`get_refname()`

  Get reference genome name in the normal sample.

`get_regions()`

  Get regions.

`get_segm()`

  Get the segmentation object.

`get_segmtype()`

  Get segtype, segmentation type(s).

`get_size()`

  Get the size per window.

`get_windows()`

  Get the windows.

`loadme()`

  Load a previously saved output.

`load_normal(normalDpath)`

  Load a previously saved output of the normal. normalDpath: the path to the .RData file for the output of the normal.

`plot_out(pdfFpath, width, height, scales, xlim, ylim, xlab, ylab, ..., MoreArgs.plotcn, MoreArgs.plotseg)`

  Plot the output and save to a pdf file. pdfFpath: a file path (relative to outFpre) for the pdf output; width,height: see ‘grDevices::pdf’; scales: are scales shared across all chromossomes (i.e. x coordinates reflect the range of genomic coordinates per chromosome, y coordinates reflect the range of of CNRs per chromosome), given no specific ‘xlim’ and ‘ylim’ (the default, "fixed"), or do they vary across x coordinates ("free_x"), y coordinates ("free_y"), or both ("free"); xlim,ylim,xlab,ylab,...: see ‘graphics::plot’; MoreArgs.plotcn: additional arguments as in ‘graphics::points’; MoreArgs.plotseg: additional arguments as in ‘graphics::segments’.

`proc_cn()`

  Process the output of coy number object and return as a data.frame.

`proc_normal()`

  Process the normal sample: make the windows and count the reads per window.

`proc_segm()`

  Process the output of segmentation object and return as a data.frame.

`proc_tumor()`

  Process the tumor sample: count the reads per window.

`save_normal()`

  Get the output of the normal for later usage.

`set_ds(dsN, dsT)`

  Set downsampling factors. See ‘set_dsN’, ‘set_dsT’.

`set_dsN(dsN)`

  Set downsampling factor of the control (normal). dsN: numeric, the library size of the control (normal) sample.

`set_dsT(dsT)`

  Set downsampling factor of the case (tumor). dsT: numeric, the library size of the case (tumor) sample.

`set_force.rerun(force.rerun)`

  Set force.rerun. Reset it with missing input.

`set_inFpathN(inFpathN)`

  Set a control (normal) sample. inFpathN: The file path to the control (normal) sample.

`set_inFpathT(inFpathT)`

  Set a case (tumor) sample. inFpathT: The file path to the case (tumor) sample.

`set_libsize(libsizeN, libsizeT)`

  Set library sizes. See ‘set_libsizeN’, ‘set_libsizeT’.

`set_libsizeN(libsizeN)`

  Set library size of the control (normal). libsizeN: numeric, the library size of the control (normal) sample.

`set_libsizeT(libsizeT)`

  Set library size of the case (tumor). libsizeT: numeric, the library size of the case (tumor) sample.

`set_mindepth(mindepth)`

  Set the minimal depth per window. mindepth: the minimal depth of reads per window in the control (normal) sample.

`set_minsize(minsize)`

  Set the minimal size per window. minsize: the minimal size of a window in the control (normal) sample.

`set_MoreArgs.cn(...)`

  Set MoreArgs.cn. ..., (pseudocount: the pseudocounts added to the observed depth per window, default to 1; logr: logical, whether to make log2 transformation of the ratios, default to TRUE.)

`set_MoreArgs.segm(...)`

  Set MoreArgs.segm. ..., a list of other arguments to the funciton of segmentation given by segtype. See ‘help_segmtype’.

`set_normal(inFpathN, mindepth, minsize)`

  Set a control (normal) sample and minimal depth/size per window. See ‘set_inFpathN’, ‘set_mindepth’, ‘set_minsize’.

`set_outFpre(outFpre)`

  Set a directory for output. outFpre: the file path of the directory for output.

`set_pcThreads(pcThreads)`

  Set the number of processors. pcThreads: numeric, the number of processors performing the parallel computing. It should not exceed the system's capacity.

`set_regions(regions)`

  Set regions. regions: the regions in study, matrix, data.frame, character, file or connection with three columns (chr/start/end).

`set_segmtype(segtype)`

  Set the type of segmentation. segtype: a character vector with a single or multiple values from c("mean.norm","meanvar.norm","mean.cusum","var.css"). See ‘changepoint’.

`set_tumor(inFpathT)`

  Set a case (tumor) sample. See ‘set_inFpathT’.

`write_cn(cnFpath, ...)`

  Write the output of copy numbers as a data.frame to a tab separated file. cnFpath: a file path (relative to outFpre) for ‘cn’ output; ...: see ‘Xmisc::write.data.table’.

`write_segm(segFpath, ...)`

  Write the output of segments as a data.frame to a tab separated file. segFpath: a file path (relative to outFpre) for ‘seg’ output; ...: see ‘Xmisc::write.data.table’.

### Author(s)

Xiaobei Zhao

### See Also

`NGScopyData` ##

### Examples

    require(NGScopy)
    require(NGScopyData)

    ## Create an instance of `NGScopy' class
    obj <- NGScopy$new(
      outFpre="ngscopy-case1",         # specified directory for output
      inFpathN=tps_N8.chr6()$bamFpath, # normal sample: tps_90.chr6.sort.bam
      inFpathT=tps_90.chr6()$bamFpath, # tumor sample:  tps_N8.chr6.sort.bam
      libsizeN=5777087,                # the library size of the normal sample
      libsizeT=4624267,                # the library size of the tumor sample
      mindepth=20,                     # the minimal depth of reads per window
      minsize=20000,                   # the minimal size of a window
      pcThreads=1                      # the number of processors for computing
      )

    obj$show()                         # print the instance

    ## Not run:

    ## Compute the copy number and save it
    ## A data.frame will be saved to file `ngscopy_cn.txt' in the output directory
    obj$write_cn()

    ## Compute the segmentation and save it
    ## A data.frame will be saved to file `ngscopy_segm.txt' in the output directory
    obj$write_segm()

    ## Visualization
    ## A figure will be saved to file `ngscopy_out.pdf' in the output directory
    obj$plot_out()

    ## End(Not run)

[Package NGScopy version 1.14.0 Index]