Oops, critical step omitted.  See below.

## see ?select for more on the following
##
library(Homo.sapiens)
symbolMappings <- select(Homo.sapiens,

 cols=c('UCSCKG','ENTREZID','SYMBOL'),
                                               keys=symbol(txtr),
                                               keytype='UCSCKG')

## "pork out" the mappings table so that duplicates expand
##
symbolMappings <- symbolMappings[match(symbol(txtr),

 symbolMappings$UCSCKG),]

## if NAs could be accepted as keys, this next step might be unnecessary
##
hasHugoSymbol <- !is.na(symbolMappings$SYMBOL)

## however, it seems that not all UCSC known genes have a Hugo symbol?
##
txtr <- txtr[ hasHugoSymbol ]
symbol(txtr) <- symbolMappings$SYMBOL[ hasHugoSymbol ]
plotTracks(txtr)


The above (minus comments) is what I used to generate a test result.




On Mon, Feb 11, 2013 at 11:34 AM, Tim Triche, Jr. <tim.triche@gmail.com>wrote:

> Well, here's one approach.  I'll start from the constructed 'txtr' track.
>
> ## see ?select for more on the following
> ##
> library(Homo.sapiens)
> symbolMappings <- select(Homo.sapiens,
>
>  cols=c('UCSCKG','ENTREZID','SYMBOL'),
>                                                keys=symbol(txtr),
>                                                keytype='UCSCKG')
>
> ## "pork out" the mappings table so that duplicates expand
> ##
> symbolMappings <- symbolMappings[match(symbol(txtr),
>
>  symbolMappings$UCSCKG),]
>
> ## if NAs can be accepted as keys, this next step might be unnecessary
> ## however, it seems that not all UCSC known genes have a Hugo symbol?
> ##
> txtr <- txtr[ hasHugoSymbol ]
> symbol(txtr) <- symbolMappings$SYMBOL[ hasHugoSymbol ]
> plotTracks(txtr)
>
> That works.
>
>
>
>
> On Mon, Feb 11, 2013 at 6:03 AM, Hahne, Florian <
> florian.hahne@novartis.com> wrote:
>
>> Well, the main culprit here is really the TranscriptDB package. It does
>> not seem to deal at all with gene symbols, so there is no way for Gviz to
>> automatically fetch those. If you come up with a way to match the UCSC
>> gene identifiers back to gene symbols you could stick those into the
>> GeneRegionTrack using the 'symbol' replacement method. E.g.,
>> symbol(foo) <- mappingTable[match(transcript(foo), mappingTable$UCSCId),])
>> I am not sure how this mapping is supposed to be done in the Bioconductor
>> world these days. You may be able to find a way using one of the org.db
>> packages. Or maybe you will have to download a mapping table directly from
>> the UCSC table browser.
>> With the next release of Bioconductor (or already now if you are working
>> with the devel branch), Gviz supports building tracks from a whole range
>> of standard annotation files. You could then export the whole known.gene
>> table from UCSC as a GTF file and import in again as a GeneRegionTrack
>> object. Alternatively you may want to look into the BiomartGeneRegionTrack
>> class which will fetch the gene models from Ensembl, but this includes the
>> HUGO gene symbols.
>> Florian
>>
>>
>> --
>>
>>
>>
>>
>>
>>
>> On 2/7/13 10:51 AM, "Bogdan Tanasa" <tanasa@gmail.com> wrote:
>>
>> >Dear all,
>> >
>> >I am using the following code below in order to retrieve the gene
>> >annotations in Gviz package :
>> >please could advise on what shall I modify in order to display the HUGO
>> >gene symbol on each gene ? thanks !
>> >
>> >library("GenomicFeatures")
>> >hg18db <- makeTranscriptDbFromUCSC(genome = "hg18",tablename =
>> >"knownGene")
>> >saveDb(hg18db, file="hg18db_knownGene.sqlite")
>> >txdb <-loadDb("hg18db_knownGene.sqlite")
>> >txTr <-
>>
>> >GeneRegionTrack(txdb,genome="hg18",chromosome="chr9",showId=TRUE,geneSymbo
>> >l=TRUE,name="UCSC")
>> >plotTracks(txTr,from=start,to=end)
>> >
>> >-- bogdan
>> >------------------
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> >_______________________________________________
>> >Bioconductor mailing list
>> >Bioconductor@r-project.org
>> >https://stat.ethz.ch/mailman/listinfo/bioconductor
>> >Search the archives:
>> >http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>
>
>
> --
> *A model is a lie that helps you see the truth.*
> *
> *
> Howard Skipper<http://cancerres.aacrjournals.org/content/31/9/1173.full.pdf>
>



-- 
*A model is a lie that helps you see the truth.*
*
*
Howard Skipper<http://cancerres.aacrjournals.org/content/31/9/1173.full.pdf>

	[[alternative HTML version deleted]]

