countBinState: countBinState

View source: R/diagnostic-qc-checks.R

countBinStateR Documentation

countBinState

Description

Bins the chromosome into supplied number of bins and find the state of the chromosome bins across all gamete cells

Usage

countBinState(chr, snpAnno, viState, genomeRange, ntile = 5)

Arguments

chr,

character, the chromosome to check

snpAnno,

data.frame, the SNP annotation for the supplied chromosome

viState,

dgTMatrix/Matrix, the viterbi state matrix, output from 'sgcocaller'

genomeRange,

GRanges object with seqlengths information for the genome

ntile,

integer, how many tiles the chromosome is binned into

Details

This function is used for checking whether chromosome segregation pattern obeys the expected ratio.

Value

a data.frame that contains chromosome bin segregation ratio

Author(s)

Ruqian Lyu

Examples

 
library(IRanges)
library(S4Vectors)

chrom_info <- GenomeInfoDb::getChromInfoFromUCSC("mm10")
seq_length <- chrom_info$size
names(seq_length) <- chrom_info$chrom

dna_mm10_gr <- GenomicRanges::GRanges(
  seqnames = Rle(names(seq_length)),
  ranges = IRanges(1, end = seq_length, names = names(seq_length)),
  seqlengths = seq_length)

GenomeInfoDb::genome(dna_mm10_gr) <- "mm10"
demo_path <- system.file("extdata",package = "comapr")
sampleName <- "s1"
chr <- "chr1"
vi_mtx <- Matrix::readMM(file = paste0(demo_path,"/", sampleName, "_",
                                       chr, "_vi.mtx"))

snpAnno <- read.table(file = paste0(demo_path,"/", sampleName,
                                    "_", chr, "_snpAnnot.txt"),
                                    stringsAsFactors = FALSE,
                      header = TRUE)

countBinState(chr = "chr1",snpAnno = snpAnno,
viState = vi_mtx,genomeRange = dna_mm10_gr, ntile = 1)


ruqianl/comapr documentation built on Oct. 27, 2023, 5:12 a.m.