From guy.lionel at gmail.com Wed Mar 25 13:43:53 2015 From: guy.lionel at gmail.com (Lionel Guy) Date: Wed, 25 Mar 2015 13:43:53 +0100 Subject: [genoPlotR-help] genoPlotR custom colour dna_seg In-Reply-To: <55129CAE.6090908@uv.es> References: <55129CAE.6090908@uv.es> Message-ID: <4221390F-AAB8-44B1-9F1B-1B6AF761B748@gmail.com> Hi Alejandro, Although I might not have tested it, I thought giving hex or rgb colors in the dna_seg file should work. Could you please send me the errors that you get, as well as (a subset of) your input file? Best regards, Lionel > On 25 Mar 2015, at 12:31 , Alejandro Manzano Marin wrote: > > hi, i was wondering how could i either define a custom colour name in R to be able to ame it direcly in my dna_seg file or is there a way to give rgb or hex colkours in the dna_seg file instead of colour names. I have tried putting directly the hex colour and rgb() but get errors, i guess because it expects the colours to be string of names for colours. > > thanks > > -- > Alejandro Manzano Mar?n > Genomic Sciences Graduate > Universidad Nacional Aut?noma de M?xico (UNAM) > amanzano at lcg.unam.mx > M.Sc. Molecular, Cell Biology and Genetics > Institut Cavanilles de Biodiversitat i Biologia Evolutiva > Department of Evolutionary Genetics > C/ Catedr?tico Jos? Beltr?n n? 2 > 46980 Paterna, Val?ncia, Espa?a > Phone: (+34)963-543-651 > Fax: (+34)963-543-670 > alejandro.manzano at uv.es > > From guy.lionel at gmail.com Wed Mar 25 15:19:19 2015 From: guy.lionel at gmail.com (Lionel Guy) Date: Wed, 25 Mar 2015 15:19:19 +0100 Subject: [genoPlotR-help] genoPlotR custom colour dna_seg In-Reply-To: <5512B9FE.9060109@uv.es> References: <55129CAE.6090908@uv.es> <4221390F-AAB8-44B1-9F1B-1B6AF761B748@gmail.com> <5512B9FE.9060109@uv.es> Message-ID: <5512C3E7.9090605@gmail.com> Mmh... The crux lies in the read.table function (called by read_dna_seg_from_tab) interpreting the "#" as comments, and there is no simple way to change that with the current code. I will fix that in a future release, but my time is scarce, so who knows when that's going to happen. As a decent workaround, you can code your colors in hex, including the # in front of the color, load your file with read.table, turning the comment recognition off, and then turn it into a dna_seg object: df <- read.table(file="testHexColors.dna_seg", header=TRUE, comment="", stringsAsFactors=FALSE) A_aspergillus_nad5 <- as.dna_seg(df) plot_gene_map(dna_segs= list(A_aspergillus_nad5,A_aspergillus_nad5), dna_seg_labels= c("A_aspergillus", "A_aspergillus")); HTH, Lionel On 03/25/2015 02:37 PM, Alejandro Manzano Marin wrote: > Hey ive tried giving both hex colours directly with and without > quotations marks and with the rgb function but no luck at least not > reading it directly with the read_dna_seg_from_tab function. I attach > you my input file with the colours as names, what i did was just change > the colour anme white for hex or rgb to get the errors > > CODE > A_aspergillus_nad5 <- > read_dna_seg_from_tab(file="A_aspergillus_nad5.dna_seg", header=TRUE); > plot_gene_map(dna_segs= list(A_aspergillus_nad5,A_aspergillus_nad5), > dna_seg_labels= c("A_aspergillus", "A_aspergillus")); > > ERRORS > # rgb colour > Error in grid.Call.graphics(L_polygon, x$x, x$y, > list(as.integer(seq_along(x$x)))) : > invalid color name 'rgb(255, 103, 181, 255, maxColorValue=255)' > Calls: plot_gene_map ... drawDetails -> drawDetails.polygon -> > grid.Call.graphics > Execution halted > > # hex colour > Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, > na.strings, : > line 1 did not have 10 elements > Calls: setColour_dna_seg ... nrow -> read_dna_seg_from_tab -> read.table > -> scan > Execution halted > > > thanks for your help > > > On 25/03/15 13:43, Lionel Guy wrote: >> Hi Alejandro, >> >> Although I might not have tested it, I thought giving hex or rgb >> colors in the dna_seg file should work. Could you please send me the >> errors that you get, as well as (a subset of) your input file? >> >> Best regards, >> >> Lionel >> >>> On 25 Mar 2015, at 12:31 , Alejandro Manzano Marin >>> wrote: >>> >>> hi, i was wondering how could i either define a custom colour name in >>> R to be able to ame it direcly in my dna_seg file or is there a way >>> to give rgb or hex colkours in the dna_seg file instead of colour >>> names. I have tried putting directly the hex colour and rgb() but get >>> errors, i guess because it expects the colours to be string of names >>> for colours. >>> >>> thanks >>> >>> -- >>> Alejandro Manzano Mar?n >>> Genomic Sciences Graduate >>> Universidad Nacional Aut?noma de M?xico (UNAM) >>> amanzano at lcg.unam.mx >>> M.Sc. Molecular, Cell Biology and Genetics >>> Institut Cavanilles de Biodiversitat i Biologia Evolutiva >>> Department of Evolutionary Genetics >>> C/ Catedr?tico Jos? Beltr?n n? 2 >>> 46980 Paterna, Val?ncia, Espa?a >>> Phone: (+34)963-543-651 >>> Fax: (+34)963-543-670 >>> alejandro.manzano at uv.es >>> >>> >> > >