Skip to content

Is it possible to highlight specific genes in geom_gene? #54

@bvaldebenitom

Description

@bvaldebenitom

Hi!

Thanks again for developing and maintaining this excellent tool.

I'm trying to do new plots where I want to color a specific gene in one color, and all the others in the region with another color. I tried adding
geom_gene(gtf.gr=gtf,fill.color.by="gene_name",plot.height=0.15)
but then I get

Error in geom_gene(gtf.gr = gtf, fill.color.by = "gene_name", plot.height = 0.15) : 
  unused argument (fill.color.by = "gene_name")

Would this be possible, or the color.by option is only meant for coloring genes according to their strands?

EDIT: I was incorrectly typing the parameter as fill.color.by. I solved the issue by first creating a named vector with the gene names, specifying their color, like this:
color_dict <- c("gene1" = "color1", ..., "geneN"="colorN")
and properly setting the parameters in geom_gene:
geom_gene(gtf.gr=gtf,color.by="gene_name",fill.color=color_dict,plot.height=0.15)

Using black and red, I got this:

Image

Leaving this open in case there is a more elegant way to achieve this. If this is the intended way, I would suggest to expand the documentation to further clarify this, as I realized the possible options by checking the source code. In particular, the column names in line 192 of geom_gene:
used.gtf.columns <- c("seqnames", "start", "end", "strand", "type", "gene_name")

Thanks again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions