Mock up a fragment file for examples and testing.

mockFragmentFile(
  output.file,
  seq.lengths,
  num.fragments,
  cell.names,
  width.range = c(10, 1000),
  read.range = c(1, 10),
  comments = NULL,
  compressed = TRUE
)

Arguments

output.file

String containing a path to an output file.

seq.lengths

Named integer vector containing the lengths of the reference sequences used for alignment. Vector names should correspond to the names of the sequences.

num.fragments

Integer scalar, the average number of fragments per cell.

cell.names

Character vector containing the cell names. The length of this vector is used as the total number of cells.

width.range

Integer vector of length 2, containing the range of possible fragment widths in base pairs.

read.range

Integer vector of length 2, containing the range of the read count supporting each fragment.

comments

Character vector of comments to be added to the start of the file.

compressed

Logical scalar indicating whether the output file should be compressed.

Value

A fragment file is created at output.file. NULL is invisibly returned.

Author

Aaron Lun

Examples

temp <- tempfile(fileext=".fragments.gz")
mockFragmentFile(temp, c(chrA=1000, chrB=200000, chrC=200),
    num.fragments=100, cell.names=LETTERS)

X <- read.table(temp)
head(X)
#>     V1 V2  V3 V4 V5
#> 1 chrA  0 730  D  2
#> 2 chrA  0 579  S  9
#> 3 chrA  4 958  O  3
#> 4 chrA  5 149  C  1
#> 5 chrA  8 766  V  2
#> 6 chrA  8 680  S  5