Can't get function plotExonJunc to work?
1
0
Entering edit mode
dleng • 0
@dleng-22037
Last seen 5.2 years ago

Hello, as per the title I'm struggling with generating a plot using plotExonJunc.

The error i'm getting is

Error in order(genes$Start, genes$End) : argument 1 is not a vector

I think the issue is with line 17 of the plotExonJunc function, it tries to order the genes by order(genes$Start, genes$End), however genes$Start/End do not exist, instead the columns are "ExonID" and "GeneID".

Here my code;

  library(limma)
  library(edgeR)

  # generate fake counts matrix
  set.seed(25)
  y <- matrix(rnbinom(4000,mu=5,size=2),ncol=4)
  dge <- DGEList(counts=y, group=rep(1:2,each=2))

  # list of Gene IDs
  GeneID <- c(rep(74355, 250), rep(18028, 250), rep(75605, 250), rep(75033, 250))

  # make fit using voom, voom 'design' defaults to unit vector
  v <- voom(dge)
  fit <- lmFit(v)

  # make diffSplice to plot
  ex <- diffSplice(fit, geneid = GeneID, verbose = FALSE)

  # plot diffSplice for gene 74355
  plotExonJunc(fit = ex, geneid = 74355)

Thanks for any help!

limma • 645 views
ADD COMMENT
3
Entering edit mode
Yunshun Chen ▴ 890
@yunshun-chen-5451
Last seen 2 days ago
Australia

The plotExonJunc function requires the coordinates of the exons/junctions to produce the plot. In particular, it requires the start and end positions, as well as the length and strand information, of each feature to be stored in genes$Start, genes$End, genes$Length and genes$Strand of the fit object.

For example, the following code would produce an exon-junction plot as required:

library(limma)
library(edgeR)
# generate fake counts matrix
set.seed(25)
y <- matrix(rnbinom(200,mu=20,size=10),ncol=4)
dge <- DGEList(counts=y, group=rep(1:2,each=2))
dge$samples$lib.size <- rep(1e7,4)

# list of Gene IDs
GeneID <- c(rep(74355, 10), rep(18028, 10), rep(75605, 10), rep(75033, 10), rep(18029, 10))

# Generate start/end positions and calculate the length
Loci <- sort(sample(10000, 100))
Start <- Loci[2*(1:50)-1]
End <- Loci[2*(1:50)]
Length <- End - Start

# Make the second entry to be a junction (with a length of 1)
Start[2] <- End[1]
End[2] <- Start[3]
Length[2] <- 1

# Store information in the 'genes' component
genes <- data.frame(GeneID=GeneID, Start=Start, End=End, Length=Length, Strand="+")
dge$genes <- genes

# make fit using voom, voom 'design' defaults to unit vector
v <- voom(dge)
fit <- lmFit(v)

# make diffSplice to plot
ex <- diffSplice(fit, geneid = GeneID, verbose = FALSE)

# plot diffSplice for gene 74355
plotExonJunc(fit = ex, geneid = 74355)

We will revise the current documentation of the plotExonJunc function to give a better description of the usage.

ADD COMMENT
0
Entering edit mode

Thanks, this is really appreciated!! Got it working 😊

ADD REPLY

Login before adding your answer.

Traffic: 517 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