keepBSgenomeSequences: Subset a BSgenome object

View source: R/keepBSgenomeSequences.R

keepBSgenomeSequencesR Documentation

Subset a BSgenome object

Description

Create a BSgenome object with some sequences (chromosomes) removed. This is useful when wanting to work without mitochondria or unplaced chromosomes. This function was posted by Hervé Pagès on the [bioconductor support pages around 2016](https://support.bioconductor.org/p/83588/) but I cannot find a version within his BSgenome package.

Usage

keepBSgenomeSequences(genome, seqnames)

Arguments

genome

a BSgenome object

seqnames

names of chromosomes to keep

Value

"genome"

Examples


library(BSgenome.Scerevisiae.UCSC.sacCer3)
genome <- BSgenome.Scerevisiae.UCSC.sacCer3
seqinfo(genome)
seqnames(genome)
sequences_to_keep <- setdiff(seqnames(genome), "chrM")   # nuclear chroms only
genomeNuc <- keepBSgenomeSequences(genome, sequences_to_keep)
seqinfo(genomeNuc)


davetgerrard/GenomicLayers documentation built on Nov. 21, 2024, 6:21 a.m.