Entering edit mode
Suraj Menon
▴
20
@suraj-menon-4244
Last seen 10.5 years ago
Hi all
I've been trying to use the GenomicRanges countOverlaps function. When
I was using the release version of GenomicRanges, countOverlaps worked
fine for coordinates from chromosomes 1-9, but gave me an error for
the others.
I switched to using the development version of GenomicRanges. The
function now works for all chromosomes other than X and Y.
Does anyone know a way around this?
(see code below)
> aligns <- readBamGappedAlignments(testFile)
> rname(aligns)
'factor' Rle of length 29420299 with 75 runs
Lengths: 520361 542488 405709 384155 391181 ... 143664 2162 587871
40505
Values : chr1 chr2 chr3 chr4 chr5 ... chr22 chrM chrX
chrY
Levels(49): chr1 chr10 chr10_random chr11 ... chrM chrX chrX_random
chrY
> yst <- seq(1, 1000, by=100)
> ywd <- rep(100, length(yst))
> ## chr1
> gr <- GRanges(seqnames = Rle("chr1", length(yst)),
+ ranges = IRanges(yst, width = ywd))
> counts <- countOverlaps(gr, aligns)
> counts
[1] 0 14 11 1 8 12 2 0 0 0
>
> ## chr18
> gr <- GRanges(seqnames = Rle("chr18", length(yst)),
+ ranges = IRanges(yst, width = ywd))
> counts <- countOverlaps(gr, aligns)
> counts
[1] 2 31 1 4 4 4 8 5 6 3
>
> ## chrX
> gr <- GRanges(seqnames = Rle("chrX", length(yst)),
+ ranges = IRanges(yst, width = ywd))
> counts <- countOverlaps(gr, aligns)
Warning message:
In .local(query, subject, maxgap, minoverlap, type, select, ...) :
'query' and 'subject' do not use a similiar naming convention for
seqnames
>
> ## chrY
> gr <- GRanges(seqnames = Rle("chrY", length(yst)),
+ ranges = IRanges(yst, width = ywd))
> counts <- countOverlaps(gr, aligns)
Warning message:
In .local(query, subject, maxgap, minoverlap, type, select, ...) :
'query' and 'subject' do not use a similiar naming convention for
seqnames
>
> sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-unknown-linux-gnu
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Rsamtools_1.0.8 Biostrings_2.17.26 GenomicRanges_1.1.25
[4] IRanges_1.7.32
loaded via a namespace (and not attached):
[1] Biobase_2.8.0 tools_2.11.1
Cheers
-Suraj
This communication is from Cancer Research UK. Our website is at
www.cancerresearchuk.org. We are a registered charity in England and
Wales (1089464) and in Scotland (SC041666) and a company limited by
guarantee registered in England and Wales under number 4325234. Our
registered address is 61 Lincoln's Inn Fields, London WC2A 3PX. Our
central telephone number is 020 7242 0200.
>From 1 October 2010 our registered address will be Angel Building,
407 St John Street, London, EC1V 4AD.
This communication and any attachments contain information which is
confidential and may also be privileged. It is for the exclusive use
of the intended recipient(s). If you are not the intended
recipient(s) please note that any form of disclosure, distribution,
copying or use of this communication or the information in it or in
any attachments is strictly prohibited and may be unlawful. If you
have received this communication in error, please notify the sender
and delete the email and destroy any copies of it.
E-mail communications cannot be guaranteed to be secure or error free,
as information could be intercepted, corrupted, amended, lost,
destroyed, arrive late or incomplete, or contain viruses. We do not
accept liability for any such matters or their consequences. Anyone
who communicates with us by e-mail is taken to accept the risks in
doing so.