Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/unmaskedRegions.R
Create a GRangesList
of unmasked regions from
a MaskedBSgenome
object
1 2 | unmaskedRegions(x, chrs=character(), pseudoautosomal=NULL,
ignoreGaps=250, activeMasks=active(masks(x[[1]])))
|
x |
a |
chrs |
a character vector of chromosome names to restrict to; if
empty (default), all chromosomes in |
pseudoautosomal |
if |
ignoreGaps |
skip assembly gaps only if larger than this
threshold; in turn, if two unmasked regions are separated by an
assembly gap not larger than |
activeMasks |
masks to apply for determining unmasked region;
defaults to the masks that are
active by default in the |
This function takes a
MaskedBSgenome
object x
and
extracts the genomic regions that are unmasked in this genome, where
the set of masks to apply can be specified using the
activeMasks
argument. The result is returned as a
GRangesList
object each component of which
corresponds to one chromosome of the genome x
- or a subset
thereof if the chrs
argument has been specified.
The pseudoautosomal
argument allows for a special treatment of
pseudoautosomal regions. If not NULL
, this argument must be
a data frame that contains columns with names “chrom”,
“start.base”, and “end.base”. The “chrom”
column must contain chromosome names as they appear in the
MaskedBSgenome
object x
.
The columns “start.base” and “end.base” must
contain numeric values that specify the starts and ends of
pseudoautosomal regions, respectively. The function is implemented
such that the data frames pseudoautosomal.hg18
,
pseudoautosomal.hg19
, and
pseudoautosomal.hg38
provided by the
GWASTools
package can be used (except for the chromosome names that need to be
adapted to hg18/hg19/hg38). If the pseudoautosomal
argument is
specified correctly, the unmaskedRegions
function produces
separate components in the resulting GRangesList
object - one for each pseudoautosomal region. These components are
named as the corresponding row names in the data frame
pseudoautosomal
. Moreover, these regions are omitted from the
list of unmasked regions of the chromosomes they are on.
a GRangesList
object (see details above)
Ulrich Bodenhofer bodenhofer@bioinf.jku.at
http://www.bioinf.jku.at/software/podkat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## load packages to obtain masked hg38genome and
## pseudoautosomal.hg19 from GWASTools package
if (require(BSgenome.Hsapiens.UCSC.hg38.masked) && require(GWASTools))
{
## extract unmasked regions of all autosomal chromosomes
regions <- unmaskedRegions(BSgenome.Hsapiens.UCSC.hg38.masked,
chrs=paste0("chr", 1:22))
names(regions)
regions$chr1
## adjust chromosome names
pseudoautosomal.hg38
psaut <- pseudoautosomal.hg38
psaut$chrom <- paste0("chr", psaut$chrom)
psaut
## extract unmasked regions of sex chromosomes taking pseudoautosomal
## regions into account
regions <- unmaskedRegions(BSgenome.Hsapiens.UCSC.hg38.masked,
chrs=c("chrX", "chrY"), pseudoautosomal=psaut)
names(regions)
regions$chrX
regions$X.PAR1
## check overlap between X chromosome and a pseudoautosomal region
intersect(regions$chrX, regions$X.PAR1)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.