2

Dataset1 -> Exons:

Start Length adjust_start end
1   1511150 724 723 1447
2   1518357 142 7930    8072
3   1520047 167 9620    9787
4   1520343 213 9916    10129
5   1520808 207 10381   10588
6   1523700 183 13273   13456
7   1523956 129 13529   13658
8   1524695 144 14268   14412
9   1524916 133 14489   14622
10  1525326 96  14899   14995
11  1526077 191 15650   15841
12  1526796 178 16369   16547
13  1558134 200 47707   47907
14  1562116 132 51689   51821
15  1564162 166 53735   53901
16  1566291 131 55864   55995
17  1568334 118 57907   58025
18  1571534 128 61107   61235
19  1580850 92  70423   70515
20  1583386 73  72959   73032
21  1584420 204 73993   74197
22  1586275 146 75848   75994
23  1587304 107 76877   76984
24  1588024 92  77597   77689
25  1589780 176 79353   79529
26  1592318 143 81891   82034
27  1592588 122 82161   82283
28  1602591 222 92164   92386
29  1607297 178 96870   97048
30  1610853 190 100426  100616
31  1612072 105 101645  101750

Dataset2 -> SNP:

V1
1   1586138
2   1602439
3   1523884
4   1592548
5   1602545
6   1571480
7   1526696
8   1571461
9   1583369
10  1592228
11  1584330
12  1526022
13  1526647
14  1523844
15  1562094
16  1557986
17  1586246
18  1583369
19  1564105
20  1583369
21  1584216
22  1584330
23  1580790
24  1523948
25  1519960
26  1525954
27  1520336

I am trying to plot this using the lollipop package of trackViewer (https://bioconductor.org/packages/release/bioc/vignettes/trackViewer/inst/doc/lollipopPlot.html)

At present I am using the the actual exons start and length:

features <- GRanges("chr1", IRanges(c(exons$Start), width=c(exons$Length), names=paste0("exons",1:31)))

And then plotting mutations against this:

sample.gr <- GRanges("chr1", IRanges(SNP, width=1,
                                      ## the name of GRanges object will be used as label
                                      names=paste0("snp", SNP)),
                     ## set the color for lollipop node.
                     color = sample.int(10, length(SNP), replace = TRUE),
                     ## set the lollipop stem color
                     border = sample(c("black", "gray80", "gray30"),
                                     length(SNP), replace=TRUE)
)

features$fill <- c("lightblue")
## define the feature heights
features$height <- c(.1)

## lollipop plot
lolliplot(sample.gr,
          features)

Giving me:

enter image description here

This is really compressed. I really just want to plot the exons and the mutations ignoring the white space between them.

However, as you can see from the Exons dataset I have tried to create an "adjusted_start" and end where I have subtracted the total length of the gene (1510427). I then want to plot them end to end but also adjust the SNP dataset by the amount of adjustment made to the first table so that it all fits together. Below is an example diagram done very crudely:

enter image description here

Any help would be much appreciated.

tacrolimus
  • 500
  • 2
  • 12
  • 1
    obviously, the plot is "preconfigured" with the `{trackViewer}` package. From the documentation page you linked there seems to be an option to plot in "multiple layers". But I guess this is not what you are after. It feels like the plot is build on top of the base plotting system. I am not sure that you can break the x-axis in base plots. Work arounds could be to create multiple plots and "glue" them together. You could emulate this behaviour in ggplot as well by using facets/groups (or revert to {patchwork} multiple plots. – Ray Aug 03 '21 at 18:03

0 Answers0