Question: GenomeGraphs question
0
7.8 years ago by
United Kingdom
Iain Gallagher930 wrote:
Dear List I am plotting some snps using GenomeGraphs to show genomic context. I have a simple question: how do I change the size of the plotting character? # SCRIPT BEGINS require(biomaRt) # get and load the library require(GenomeGraphs) # get the snps we need info on snps <- c('rs136617760', 'rs42494357', 'rs110465273', 'rs42494342',? 'rs109809949', 'rs134449285', 'rs137562332', 'rs132841890') # set up the database we need to query snpmart <- useMart('snp', dataset = 'btaurus_snp') # we want to get the snp id, allele, chromosome position and chromosome # in biomaRt attributes are what you want, filters are what you're using to query the db # there's load of info available; use listAttributes(snpmart) to see what you can get back # and listFilters(snpmart) to see what you can put in as a query snpInfo <- getBM(attributes = c('refsnp_id', 'allele', 'chrom_start', 'chr_name'), filters = 'snp_filter', values = snps, mart = snpmart) # plot these using GenomeGraphs # subset out the chromosome 13 snps thirteenSnps <- subset(snpInfo, snpInfo$chr_name == 13) # make pretend 'intensity values' for later ints <- seq(1,6) # could replace with 1/log10p perhaps! names(ints) <- thirteenSnps$refsnp_id ints <- as.matrix(ints) # set up mart cowmart <- useMart('ensembl', dataset = 'btaurus_gene_ensembl') # make a plot of the genes on bovine chromosome 13 around the SNPs Mairead found on chromosome 13 ideogram <- makeIdeogram(chromosome = 13) plusStrand <- makeGeneRegion(chromosome = 13, start = min(thirteenSnps$chrom_start)-5e5, end = min(thirteenSnps$chrom_start)+5e5, strand = "+", biomart = cowmart) minStrand <- makeGeneRegion( chromosome = 13, start = min(thirteenSnps$chrom_start)-5e5, end = min(thirteenSnps$chrom_start)+5e5, strand = "-", biomart = cowmart) genomeAxis <- makeGenomeAxis(add53 = TRUE, add35 = TRUE) snpPlot <- makeGenericArray(intensity = ints, probeStart = thirteenSnps$chrom_start,? dp = DisplayPars(color="darkred", type="point", cex = 2)) gdPlot(list(makeTitle('Chromosome 13'), a = ideogram, b = plusStrand, c = genomeAxis, d = minStrand, e = snpPlot), labelCex = 2, labelRot = 0) # SCRIPT ENDS I would like to make the dots representing the snps larger. I tried e.g. dp = DisplayPars(cex = 2) and dp = DisplayPars(size = 2) in the snpPlot definition without success and I can't work out the answer from the documentation. Incidentally I'm aware that the above script is perhaps abusing makeGenericArray - it works for me. If anyone has a more 'proper' way of doing this then that would be educational as well. Best Iain > sessionInfo() R version 2.14.1 (2011-12-22) Platform: x86_64-pc-linux-gnu (64-bit) locale: ?[1] LC_CTYPE=en_GB.utf8?????? LC_NUMERIC=C???????????? ?[3] LC_TIME=en_GB.utf8??????? LC_COLLATE=en_GB.utf8??? ?[5] LC_MONETARY=en_GB.utf8??? LC_MESSAGES=en_GB.utf8?? ?[7] LC_PAPER=C??????????????? LC_NAME=C??????????????? ?[9] LC_ADDRESS=C????????????? LC_TELEPHONE=C?????????? [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C????? attached base packages: [1] grid????? stats???? graphics? grDevices utils???? datasets? methods? [8] base???? other attached packages: [1] GenomeGraphs_1.14.0 biomaRt_2.10.0????? ggplot2_0.9.0????? loaded via a namespace (and not attached): ?[1] colorspace_1.1-1?? dichromat_1.2-4??? digest_0.5.1?????? MASS_7.3-16?????? ?[5] memoise_0.1??????? munsell_0.3??????? plyr_1.7.1???????? proto_0.3-9.2???? ?[9] RColorBrewer_1.0-5 RCurl_1.9-5??????? reshape2_1.2.1???? scales_0.1.0????? [13] stringr_0.6??????? tools_2.14.1?????? XML_3.9-2???????? > ADD COMMENTlink modified 7.8 years ago by Joern Toedling50 • written 7.8 years ago by Iain Gallagher930 Answer: GenomeGraphs question 0 7.8 years ago by Joern Toedling50 wrote: Hello, the function "setPar" might be what you are looking for. You can check the parameters associated with each object easily by just typing the object's name, such as > snpPlot and set them this way: > setPar(snpPlot, "pointSize", 2) # or something else than 2 and then calling "gdPlot" will probably do the trick. Regards, Joern On 02/08/2012 04:53 PM, Iain Gallagher wrote: > > Dear List > > I am plotting some snps using GenomeGraphs to show genomic context. I have a simple question: how do I change the size of the plotting character? > > # SCRIPT BEGINS > > require(biomaRt) # get and load the library > require(GenomeGraphs) > > # get the snps we need info on > snps<- c('rs136617760', 'rs42494357', 'rs110465273', 'rs42494342', 'rs109809949', 'rs134449285', 'rs137562332', 'rs132841890') > > # set up the database we need to query > snpmart<- useMart('snp', dataset = 'btaurus_snp') > > # we want to get the snp id, allele, chromosome position and chromosome > # in biomaRt attributes are what you want, filters are what you're using to query the db > # there's load of info available; use listAttributes(snpmart) to see what you can get back > # and listFilters(snpmart) to see what you can put in as a query > > snpInfo<- getBM(attributes = c('refsnp_id', 'allele', 'chrom_start', 'chr_name'), filters = 'snp_filter', values = snps, mart = snpmart) > > # plot these using GenomeGraphs > # subset out the chromosome 13 snps > thirteenSnps<- subset(snpInfo, snpInfo$chr_name == 13) > > # make pretend 'intensity values' for later > ints<- seq(1,6) # could replace with 1/log10p perhaps! > names(ints)<- thirteenSnps$refsnp_id > ints<- as.matrix(ints) > > # set up mart > cowmart<- useMart('ensembl', dataset = 'btaurus_gene_ensembl') > > # make a plot of the genes on bovine chromosome 13 around the SNPs Mairead found on chromosome 13 > ideogram<- makeIdeogram(chromosome = 13) > > plusStrand<- makeGeneRegion(chromosome = 13, start = min(thirteenSnps$chrom_start)-5e5, end = min(thirteenSnps$chrom_start)+5e5, strand = "+", biomart = cowmart) > > minStrand<- makeGeneRegion( chromosome = 13, start = min(thirteenSnps$chrom_start)-5e5, end = min(thirteenSnps$chrom_start)+5e5, strand = "-", biomart = cowmart) > > genomeAxis<- makeGenomeAxis(add53 = TRUE, add35 = TRUE) > > snpPlot<- makeGenericArray(intensity = ints, probeStart = thirteenSnps$chrom_start, dp = DisplayPars(color="darkred", type="point", cex = 2)) > > gdPlot(list(makeTitle('Chromosome 13'), a = ideogram, b = plusStrand, c = genomeAxis, d = minStrand, e = snpPlot), labelCex = 2, labelRot = 0) > > # SCRIPT ENDS > > I would like to make the dots representing the snps larger. I tried e.g. > > dp = DisplayPars(cex = 2) and dp = DisplayPars(size = 2) in the snpPlot definition without success and I can't work out the answer from the documentation. > > Incidentally I'm aware that the above script is perhaps abusing makeGenericArray - it works for me. If anyone has a more 'proper' way of doing this then that would be educational as well. > > Best > > Iain > -- Joern Toedling, PhD Core Facility Bioinformatics Institute of Molecular Biology gGmbH (IMB) http://www.imb-mainz.de Tel.: +49 6131 39 21511