Open efeaybuke opened 6 years ago
this can be done in single pipe actually. top_n
or rank
functions operate within groups defined by prior group_by
function.
human_genes %>%
mutate(length=end-start) %>%
group_by(strand) %>%
top_n(10,length) %>%
ggplot(aes(x=reorder(gene_name, length), y=length, fill=as.factor(strand))) +
geom_col(show.legend = FALSE) +
facet_wrap(~strand , scales = "free")+
coord_flip()
Question
There are a lot of chromosomes and chromosomes are occurred negative and positive strands. These strands contain genes. So , how long are these genes? Which genes are longer than others? Please find gene sizes and show the longest 10 genes at the graphic for each strand.
Here is the result:
Originality
Is this question
Difficulty Level