Plotting gene region using Sushi
1
0
Entering edit mode
@javiermendoza-9582
Last seen 8.7 years ago

I am trying to plot a genomic region of interest using sushi.

I am able to run the example, however I just can't get running my bed file by myself.

This is my gene list in bed format, from ensembl:

head(gl)

     start     stop strand       gene       chrom score
1 66119285 66465398      1   SLC25A26 HG991_PATCH     .
2 23551994 23552136     -1 AL157931.1          13     .
3 23708313 23708703      1    HMGA1P6          13     .
4 23726725 23726825     -1     RNY3P4          13     .
5 23743974 23744736     -1  LINC00362          13     .
6 23791571 23791673     -1   RNU6-58P          13     .

str(gl)

'data.frame':    64101 obs. of  6 variables:
 $ start : int  66119285 23551994 23708313 23726725 23743974 23791571 23817659 93708910 23841645 23947562 ...
 $ stop  : int  66465398 23552136 23708703 23726825 23744736 23791673 23821323 93710179 23843289 23948200 ...
 $ strand: int  1 -1 1 -1 -1 -1 1 1 1 1 ...
 $ gene  : chr  "SLC25A26" "AL157931.1" "HMGA1P6" "RNY3P4" ...
 $ chrom : chr  "HG991_PATCH" "13" "13" "13" ...
 $ score : chr  "." "." "." "." ...

 

But when I run the plotGenes function I just get a "yes" print.

plotGenes(gl, chrom = "6",6, chromstart = 132647962, chromend = 132947962)

What's the problem?

 

R sushi • 2.2k views
ADD COMMENT
0
Entering edit mode

It's hard to debug without access to your bed file, but just a few thoughts:

  • Do you have entries from chromosome 6 in the bed file?
  • The 3rd argument '6' will probably resolve to the plotting colour, is that what you're intending?
  • Taking a quick look at the plotGenes() source code, it doesn't look like it every actuall uses the chrom argument if you pass a bed file.  It will try to plot everything in the file, which just hangs my R session if the bed file is large.  Perhaps try subsetting the bed file before passing it to the function e.g.
gl.sub <- gl[ which(gl[,"chrom"] == 6 & gl[,"start"] >= 132647962 & gl[,"end"] <= 132947962),]
plotGenes(gl.sub)
ADD REPLY
0
Entering edit mode

 

I used the followed script:

glsub <-Sushi_transcripts.bed[which(Sushi_transcripts.bed[,"chrom"]=='chr15'&Sushi_transcripts.bed[,"start"] > 73062668 & Sushi_transcripts.bed[,"stop"]< 73091240),]

get an error message:

Error in FUN(X[[i]], ...) : 
  only defined on a data frame with all numeric variables

I can not figure out, it is similar that when I used my gene bed files.

when I used the example:

pg = plotGenes(Sushi_transcripts.bed,chrom,chromstart,chromend,types = Sushi_transcripts.bed$type,colorby=log10(Sushi_transcripts.bed$score+0.001),colorbycol= SushiColors(5),colorbyrange=c(0,1.0),labeltext=TRUE,maxrows=50,height=0.4,plotgenetype="box")

it work. 

Annother question: can I used "read.table" to load my bed files or bedgraph files?

ADD REPLY
0
Entering edit mode
dphansti ▴ 10
@dphansti-8015
Last seen 8.7 years ago
United States

A few things:

1) Your data frame needs to be in BED format.

  • col1 = chrom
  • col2 = start
  • col3 = stop
  • col4 = gene
  • col5 = score
  • col6 = strand

To see an example try the following

library("Sushi")
data(Sushi_genes.bed)
Sushi_genes.bed

2) As Mike pointed out there was indeed a bug in version 1.6.1 and earlier that did not filter genes from different chromosomes.  That has been resolved in version 1.6.2 which is now available on gitub.  To install the newest version you can use the install_github function from the devtools packages.  See below.

install.packages("devtools")
library("devtools")
install_github("dphansti/Sushi")
library("Sushi")

3) In addition, as Mike points out, prefiltering for regions of interest is often a good idea with Sushi.

Please, tell me if this resolves your problem or if you are still having issues.

 

 

 

ADD COMMENT

Login before adding your answer.

Traffic: 660 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6