Giter VIP home page Giter VIP logo

gtrellis's Introduction

Make Genome Level Trellis Graph

R-CMD-check codecov bioc bioc

Genome level Trellis graph visualizes genomic data conditioned by genomic categories (e.g. chromosomes). For each genomic category, multiple dimensional data which are represented as tracks describe different features from different aspects. This package provides high flexibility to arrange genomic categories and to add self-defined graphics in the plot.

Citation

Zuguang Gu, et al., gtrellis: an R/Bioconductor package for making genome-level Trellis graphics, 2016. BMC Bioinformatics.

Install

gtrellis is available on Bioconductor, you can install it by:

if (!requireNamespace("BiocManager", quietly=TRUE))
    install.packages("BiocManager")
BiocManager::install("gtrellis") 

If you want the latest version, install it directly from GitHub:

library(devtools)
install_github("jokergoo/gtrellis")

Usage

Basic usage is:

library(gtrellis)

bed = circlize::generateRandomBed()
gtrellis_layout(track_ylim = range(bed[[4]]))
add_track(bed, panel.fun = function(bed) {
    x = (bed[[2]] + bed[[3]]) / 2
    y = bed[[4]]
    grid.points(x, y, pch = 16, size = unit(1, "mm"))
})

There are several tracks with pre-defined graphics:

  • add_points_track()
  • add_lines_track()
  • add_rect_track()
  • add_segments_track()
  • add_heatmap_track()

Layout

gtrellis supports several types of layouts:

One row layout:

Multiple row layout that chromosomes with similar length are arranged in a same column:

Chromosomes in a same row are arranged compactly to the left:

For each chromosome, multiple tracks are supported:

Example

Example figures are:

License

MIT @ Zuguang Gu

gtrellis's People

Contributors

cola-recount2 avatar dtenenba avatar hpages avatar jokergoo avatar jwokaty avatar link-ny avatar nturaga avatar sonali-bioc avatar vobencha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gtrellis's Issues

gap parameter in gtrellis_layout() overriden when legend present

Hi,

I would like to create a trellis without gap between chromosomes (gap=0) and a legend at the bottom. However, it seems that the gap=0 is changed to gap = unit(2, "mm"), inside the gtrellis_layout function, when a legend is present (length(legend) > 0).

I wonder if this behavior could be modified. If not, it would be helpful to have this specified in the documentation.

That being said, this package is terrific.

Best,
Astrid

Make y-axis labels horizontal

I was wondering if it is possible to have horizontal y labels (track_ylab). I have around 50 samples in their own track, and since each track height is small, the sample labels currently overlap each other a great bit.

Thanks for making this great package.

Add row annotation and dendrogram to heatmap track

I was trying to make a single cell CNV heatmap similar to this inferCNV figure attached below (the bottom panel in particular), which is a trellis plot with row annotation and row dendrogram.

I was wondering if it's possible to plot it using gtrellis. Would it possible to create a grid space for a ComplexHeatmap object aligned to the gtrellis plotting space (so to add the row annotation and dendrogram)?

Sorry for this broadly open question. Any suggestion or advice is highly appreciated. Thank you!

image

Custom genome

Hi,
I would like to use a custom genome for the layout which means I don't want to pass a name for the argument 'species'. Also I use ensembl chr names rather than UCSC.

So I created a file like this with chr names and length.

   01 58871917
   02 59543403
   03 62385949
   04 76625712
   05 71715914
   06 60272633
   07 74082188
   08 54191831
   09 56892771
   10 45574255
   11 45107271
   12 49229541
   13 51780250
   14 51944548
   15 47771147
   16 55381981
   17 53345113
   18 51008593
   19 48790377
   20 55370968
   21 45895719
   22 39226288
   23 46272358
   24 42251103
   25 36898761
   MT    16596
   UN 31272196

I save it as a file and pass that to read.chromInfo()

path <- "custom_genome.txt"
read.chromInfo(path)

This works and gives the output:

> read.chromInfo(path)
$df
   chr start      end
1   01     0 58871917
2   02     0 59543403
3   03     0 62385949
4   04     0 76625712
5   05     0 71715914
6   06     0 60272633
7   07     0 74082188
8   08     0 54191831
9   09     0 56892771
10  10     0 45574255
11  11     0 45107271
12  12     0 49229541
13  13     0 51780250
14  14     0 51944548
15  15     0 47771147
16  16     0 55381981
17  17     0 53345113
18  18     0 51008593
19  19     0 48790377
20  20     0 55370968
21  21     0 45895719
22  22     0 39226288
23  23     0 46272358
24  24     0 42251103
25  25     0 36898761
26  MT     0    16596
27  UN     0 31272196

$chromosome
 [1] "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17"
[18] "18" "19" "20" "21" "22" "23" "24" "25" "MT" "UN"

$chr.len
      01       02       03       04       05       06       07       08       09       10 
58871917 59543403 62385949 76625712 71715914 60272633 74082188 54191831 56892771 45574255 
      11       12       13       14       15       16       17       18       19       20 
45107271 49229541 51780250 51944548 47771147 55381981 53345113 51008593 48790377 55370968 
      21       22       23       24       25       MT       UN 
45895719 39226288 46272358 42251103 36898761    16596 31272196

but, it does not work with gtrellis_layout.

gtrellis_layout(species=read.chromInfo(path),ncol=5)

Error in read.chromInfo(species = species) : 
  It seems your species name is wrong or UCSC does not provide chromInfo data
for your species or internet connection was interrupted.
If possible, download chromInfo file from
...

I am probably doing it wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.