I ran into some errors and had to specify the package namespaces and load the GenomicFeatures library:
> source("https://bioconductor.org/biocLite.R")
...
> biocLite('TxDb.Mmusculus.UCSC.mm10.ensGene')
...
> library("GenomicFeatures")
...
> mygenes = c("ENSMUSG00000029847",
"ENSMUSG00000085236", "ENSMUSG00000063364","ENSMUSG00000085247",
"ENSMUSG00000072893","ENSMUSG00000018800","ENSMUSG00000020865",
"ENSMUSG00000023832","ENSMUSG00000045730","ENSMUSG00000007827",
"ENSMUSG00000021950","ENSMUSG00000071847","ENSMUSG00000025154",
"ENSMUSG00000047446","ENSMUSG00000026628","ENSMUSG00000029673")
> mygenes.transcripts = subset(GenomicFeatures::transcripts(TxDb.Mmusculus.UCSC.mm10.ensGene::TxDb.Mmusculus.UCSC.mm10.ensGene, columns=c("tx_id", "tx_name","gene_id")), gene_id %in% mygenes)
GRanges object with 62 ranges and 3 metadata columns:
seqnames ranges strand | tx_id tx_name
<Rle> <IRanges> <Rle> | <integer> <character>
[1] chr1 [191170296, 191183340] - | 4925 ENSMUST00000027941
[2] chr1 [191171425, 191183108] - | 4926 ENSMUST00000131854
[3] chr2 [135169573, 135215616] - | 13731 ENSMUST00000138303
[4] chr2 [150310935, 150362765] - | 13893 ENSMUST00000051153
[5] chr2 [150310937, 150362733] - | 13894 ENSMUST00000124945
... ... ... ... ... ... ...
[58] chr18 [62177817, 62179959] - | 86501 ENSMUST00000053640
[59] chr19 [41766588, 41802047] - | 88750 ENSMUST00000026150
[60] chr19 [41766591, 41802084] - | 88751 ENSMUST00000163265
[61] chr19 [41769800, 41781336] - | 88752 ENSMUST00000176266
[62] chr19 [41769994, 41802047] - | 88753 ENSMUST00000177495
gene_id
<CharacterList>
[1] ENSMUSG00000026628
[2] ENSMUSG00000026628
[3] ENSMUSG00000085247
[4] ENSMUSG00000063364
[5] ENSMUSG00000063364
... ...
[58] ENSMUSG00000045730
[59] ENSMUSG00000025154
[60] ENSMUSG00000025154
[61] ENSMUSG00000025154
[62] ENSMUSG00000025154
-------
seqinfo: 66 sequences (1 circular) from mm10 genome
It looks like the fix setting in resize uses the correct start position for the interval's strand. Note that these resized coordinates are 1-based, if the OP plans to ultimately export BED data.
could you provide the format, please
I am using this site: https://genome.ucsc.edu/cgi-bin/hgTables
Hi Giovanni,
Thank you for the help!
A few questions: (I am relevatively new to R).
for
mygenes.transcripts, I had copy and pasted