Skip to content
This repository has been archived by the owner on Sep 8, 2018. It is now read-only.

Commit

Permalink
Removed exclusive references to the RPKM normalisation method from do…
Browse files Browse the repository at this point in the history
…cs + changed the name of the slot 'rpkm' to 'texp'
  • Loading branch information
mgonzalezporta committed Feb 26, 2014
1 parent 935556c commit a107a78
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 41 deletions.
Binary file modified tviz-manual.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion tviz/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ exportClasses( "TranscriptExpressionSet" )
exportMethods(
id,
conditions,
rpkms,
texp,
gexp,
dominance,
biotypes,
Expand Down
2 changes: 1 addition & 1 deletion tviz/R/AllClasses.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setClass("TranscriptExpressionSet",
representation = representation(
id="character",
rpkms="matrix",
texp="matrix",
conditions="list",
gexp="numeric",
dominance="numeric",
Expand Down
4 changes: 2 additions & 2 deletions tviz/R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ setGeneric("id",
setGeneric("conditions",
function(object) standardGeneric("conditions"))

setGeneric("rpkms",
function(object) standardGeneric("rpkms"))
setGeneric("texp",
function(object) standardGeneric("texp"))

setGeneric("gexp",
function(object) standardGeneric("gexp"))
Expand Down
14 changes: 7 additions & 7 deletions tviz/R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ readExpressionData=function(gId=gId, infile=infile, cond1=cond1, cond2=cond2) {
cond1=.format_cond(cond1)
cond2=.format_cond(cond2)

# transcript RPKMs
# transcript expression levels
command=paste("grep", gId, infile, sep=" ")
data=read.table(pipe(command), col.names=header,
colClasses=c("NULL", "character", rep("numeric", length(header)-2)))
rpkms=as.matrix(data[,c(cond1, cond2)])
rownames(rpkms)=data[,1]
texp=as.matrix(data[,c(cond1, cond2)])
rownames(texp)=data[,1]

return(rpkms)
return(texp)
}

readBiotypeData=function(gId=gId, infile=infile) {
Expand All @@ -40,20 +40,20 @@ readSignificantEvents=function(gId=gId, infile=infile) {
return(significant_events)
}

newTranscriptExpressionSet=function(gId=gId, rpkms=rpkms, biotypes=biotypes, significant_events=significant_events, cond1=cond1, cond2=cond2) {
newTranscriptExpressionSet=function(gId=gId, texp=texp, biotypes=biotypes, significant_events=significant_events, cond1=cond1, cond2=cond2) {
# conditions
cond1=.format_cond(cond1)
cond2=.format_cond(cond2)

cond1=cond1-1
cond2=seq(from=length(cond1)+1, to=dim(rpkms)[2], by=1)
cond2=seq(from=length(cond1)+1, to=dim(texp)[2], by=1)
conditions=list(cond1=cond1, cond2=cond2)

# create TranscriptExpressionSet object
tes=new("TranscriptExpressionSet",
id=gId,
conditions=conditions,
rpkms=rpkms,
texp=texp,
biotypes=biotypes,
significant_events=significant_events
)
Expand Down
26 changes: 13 additions & 13 deletions tviz/R/methods-TranscriptExpressionSet.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## initialize
setMethod("initialize", "TranscriptExpressionSet",
function(.Object, id=id, rpkms=rpkms, biotypes=biotypes, conditions=conditions, significant_events=significant_events){
function(.Object, id=id, texp=texp, biotypes=biotypes, conditions=conditions, significant_events=significant_events){
.Object@id=id
.Object@rpkms=rpkms
.Object@texp=texp
.Object@conditions=conditions
.Object@gexp=colSums(.Object@rpkms)
.Object@gexp=colSums(.Object@texp)
.Object@dominance=.calculate_dominance(.Object)
.Object@.relexp=.calculate_relexp(.Object)
.Object@.scaledexp=.calculate_scaledexp(.Object)
Expand All @@ -20,9 +20,9 @@ setMethod("show",
function(object) {
cat("Object of class",class(object),"\n")
cat(" Id:",id(object),"\n")
cat(" RPKMs: data frame with", dim(object@rpkms)[1], "transcripts and", dim(object@rpkms)[2], "samples\n")
cat(" transcripts:", head(rownames(object@rpkms), n=4), "(...)\n")
cat(" samples:", head(colnames(object@rpkms), n=4), "(...)\n")
cat(" Transcript expression: data frame with", dim(object@texp)[1], "transcripts and", dim(object@texp)[2], "samples\n")
cat(" transcripts:", head(rownames(object@texp), n=4), "(...)\n")
cat(" samples:", head(colnames(object@texp), n=4), "(...)\n")
cat(" Conditions:\n")
cat(" condition 1:", head(object@conditions$cond1, n=4), "(...)\n")
cat(" condition 2:", head(object@conditions$cond2, n=4), "(...)\n")
Expand All @@ -44,8 +44,8 @@ setMethod("id", "TranscriptExpressionSet", function(object) object@id)
setMethod("conditions", "TranscriptExpressionSet",
function(object) object@conditions)

setMethod("rpkms", "TranscriptExpressionSet",
function(object) object@rpkms)
setMethod("texp", "TranscriptExpressionSet",
function(object) object@texp)

setMethod("gexp", "TranscriptExpressionSet",
function(object) object@gexp)
Expand Down Expand Up @@ -202,7 +202,7 @@ setMethod(".plot_boxplots",
.subplot_boxplots(
ldata=list(tes@gexp[tes@conditions$cond1], tes@gexp[tes@conditions$cond2]),
xlab=tes@id,
ylab="gene expression (RPKMs)",
ylab="gene expression",
type="gexp",
mar=mar,
col=col,
Expand Down Expand Up @@ -328,7 +328,7 @@ setMethod(".plot_segments",
data1=tes@gexp[tes@conditions$cond1],
data2=tes@gexp[tes@conditions$cond2],
xlab=tes@id,
ylab="gene expression (RPKMs)",
ylab="gene expression",
type="gexp",
mar=mar,
col=col,
Expand Down Expand Up @@ -446,7 +446,7 @@ setMethod(".get_legend_title_starplot", "TranscriptExpressionSet",
function(object) {
legend_title=paste(
object@id, "\n\n",
"gene expression summary (RPKMs):\n",
"gene expression summary:\n",
" condition 1 (left) - ", .distr_summary(object@gexp[object@conditions$cond1]), "\n",
" condition 2 (right) - ", .distr_summary(object@gexp[object@conditions$cond2]), "\n\n",
"dominance summary:\n",
Expand All @@ -459,13 +459,13 @@ setMethod(".get_legend_title_starplot", "TranscriptExpressionSet",

setMethod(".calculate_dominance", "TranscriptExpressionSet",
function(object) {
dominance=apply(object@rpkms, 2, .ratio_second)
dominance=apply(object@texp, 2, .ratio_second)
return(dominance)
})

setMethod(".calculate_relexp", "TranscriptExpressionSet",
function(object) {
relexp=t(t(object@rpkms)/object@gexp)
relexp=t(t(object@texp)/object@gexp)
return(relexp)
})

Expand Down
Binary file modified tviz/inst/tests/output-test/ENSG00000124193-distrplot.pdf
Binary file not shown.
Binary file modified tviz/inst/tests/output-test/ENSG00000124193-starplot.pdf
Binary file not shown.
Binary file modified tviz/inst/tests/output-test/ENSG00000153086-distrplot.pdf
Binary file not shown.
Binary file modified tviz/inst/tests/output-test/ENSG00000153086-starplot.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions tviz/inst/tests/test-tviz.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ outdir='./output-test'
dir.create(outdir, showWarnings = FALSE)

## load data
rpkms=readExpressionData(gId=gId, infile=expdata, cond1=cond1, cond2=cond2)
texp=readExpressionData(gId=gId, infile=expdata, cond1=cond1, cond2=cond2)
biotypes=readBiotypeData(gId=gId, infile=annot)
if (filt != "NA") {
significant_events=readSignificantEvents(gId=gId, infile=filt)
Expand All @@ -30,7 +30,7 @@ if (filt != "NA") {
## create TranscriptExpressionSet object
tes=newTranscriptExpressionSet(
gId=gId,
rpkms=rpkms,
texp=texp,
biotypes=biotypes,
cond1=cond1,
cond2=cond2,
Expand Down Expand Up @@ -61,7 +61,7 @@ outdir='./output-test'
dir.create(outdir, showWarnings = FALSE)

## load data
rpkms=readExpressionData(gId=gId, infile=expdata, cond1=cond1, cond2=cond2)
texp=readExpressionData(gId=gId, infile=expdata, cond1=cond1, cond2=cond2)
biotypes=readBiotypeData(gId=gId, infile=annot)
if (filt != "NA") {
significant_events=readSignificantEvents(gId=gId, infile=filt)
Expand All @@ -72,7 +72,7 @@ if (filt != "NA") {
## create TranscriptExpressionSet object
tes=newTranscriptExpressionSet(
gId=gId,
rpkms=rpkms,
texp=texp,
biotypes=biotypes,
cond1=cond1,
cond2=cond2,
Expand Down
2 changes: 1 addition & 1 deletion tviz/man/TranscriptExpressionSet-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
\section{Slots}{
\describe{
\item{gId}{Id for the gene to be plotted.}
\item{rpkms}{Matrix of transcript RPKM/FPKM values in each sample,
\item{texp}{Matrix of transcript expression values in each sample,
loaded using the 'readExpressionData' function.}
\item{biotypes}{Matrix of biotypes for each of the annotated transcripts within the gene,
loaded using the 'readBiotypeData' function.}
Expand Down
4 changes: 2 additions & 2 deletions tviz/man/newTranscriptExpressionSet.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ embedded expression data.}
\usage{
newTranscriptExpressionSet(
gId=gId,
rpkms=rpkms,
texp=texp,
biotypes=biotypes,
significant_events=significant_events,
cond1=cond1,
cond2=cond2)
}
\arguments{
\item{gId}{Id for the gene to be plotted.}
\item{rpkms}{Matrix of transcript RPKM/FPKM values in each sample,
\item{texp}{Matrix of transcript expression values in each sample,
loaded using the 'readExpressionData' function.}
\item{biotypes}{Matrix of biotypes for each of the annotated transcripts within the gene,
loaded using the 'readBiotypeData' function.}
Expand Down
2 changes: 1 addition & 1 deletion tviz/man/plotDistr.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
\description{
A distribution plot contains information on the distribution of gene expression levels, major transcript dominance and transcript relative abundances in each condition. This plot contains three panels:

left - Distribution of gene expression levels (RPKMs or FPKMs).
left - Distribution of gene expression levels.

middle - Distribution of major transcript dominance. Major transcript dominance is calculated in each condition as the ratio of expression of the second v.s. first most abundant transcripts. Thus, a ratio close to 0 will indicate that the most abundant transcript is dominating the expression for that gene, while a ratio close to 1 indicates that the first and second most abundant transcripts are expressed at the same level.

Expand Down
2 changes: 1 addition & 1 deletion tviz/man/plotStars.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
\title{Create a starplot for the specified TranscriptExpressionSet object.}

\description{
A starplot provides information on the transcript RPKM quantifications in a sample specific manner.
A starplot provides information on the transcript quantifications in a sample specific manner.
In this plot each sample is represented as a pie chart, where each of the slices corresponds to a transcript. The size of each slice is proportional to the transcript expression level, and the overall size of the plot is proportional to the gene expression level, thus allowing comparisons across samples.
}

Expand Down
4 changes: 2 additions & 2 deletions tviz/man/readExpressionData.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
\alias{readExpressionData}

\title{
Create a matrix of RPKM/FPKM transcript expression levels for a given gene from the specified input file.
Create a matrix of transcript expression levels for a given gene from the specified input file.
}
\description{
Loads transcript expression data (RPKM/FPKM values) for a given gene from the specified input file.
Loads transcript expression data for a given gene from the specified input file.
Each sample is represented as a column, and each transcript as a row.
}
\usage{
Expand Down
12 changes: 6 additions & 6 deletions tviz/man/rpkms.Rd → tviz/man/texp.Rd
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
\name{rpkms}
\name{texp}
\encoding{UTF-8}
\Rdversion{1.1}
\docType{methods}
\alias{rpkms,TranscriptExpressionSet-method}
\alias{rpkms}
\alias{texp,TranscriptExpressionSet-method}
\alias{texp}
\title{
Accessor function for the 'rpkms' slot of a TranscriptExpressionSet object.
Accessor function for the 'texp' slot of a TranscriptExpressionSet object.
}

\description{
The rpkms slot displays a matrix with the initial RPKM/FPKM values provided by the user. Each sample is represented as a column, and each transcript as a row.
The texp slot displays a matrix with the initial expression values provided by the user. Each sample is represented as a column, and each transcript as a row.
}

\usage{
\S4method{rpkms}{TranscriptExpressionSet}(object)
\S4method{texp}{TranscriptExpressionSet}(object)
}

\arguments{
Expand Down

0 comments on commit a107a78

Please sign in to comment.