8.7 Exercise 2
- Import file DataViz_source_files-main/files/gencode.v44.annotation.csv in an object called gtf.
correction
This is a small subset of the gencode v44 human gene annotation, created the following way:
- Selection of protein coding genes, long non-coding genes, miRNAs, snRNAs and snoRNAs.
- Selection of chromosomes 1 to 10 only.
- Creation of a random subset of 1000 genes.
- Convertion to a friendly csv format.
2. Create a simple barplot representing the count of genes per chromosome:
3. Keep the chromosome represented on the x axis, and split the barplot per gene type.
TIP: remember how we set color= in mapping=aes() function in the scatter plot section? Give it a try here!
4. Change color= with fill= in aes(). What changes?
5. Add a title to the graph:
correction
6. Change the default theme:
correction
7. Save the graph in PNG format in the workshop’s directory.