Skip to content

Instantly share code, notes, and snippets.

View DarioS's full-sized avatar

Dario Strbenac DarioS

  • University of Sydney
  • Australia
View GitHub Profile
@DarioS
DarioS / GTF2TranscriptDB.R
Created May 23, 2011 01:40
Convert TopHat GTF to Bioconductor TranscriptDB
GTF2TranscriptDB <- function(gtf.file, out.file = NULL, verbose = TRUE)
{
require(rtracklayer)
require(GenomicRanges)
require(GenomicFeatures)
min.info <- c("gene_id", "transcript_id", "exon_number")
if (verbose) message("Importing ", gtf.file)
gtf <- import.gff(gtf.file, asRangedData = FALSE)
@DarioS
DarioS / rnaCounts.R
Created May 25, 2011 00:41
Count sequencing reads in exons and over junctions.
setGeneric("rnaCounts", function(alns, tx.db, ...) {standardGeneric("rnaCounts")})
setMethod("unique", "GRangesList",
function(x)
{
gr <- unname(unlist(x))
values(gr)$gene <- rep(names(x), elementLengths(x))
gr.df <- as.data.frame(gr)
gr.df <- gr.df[!duplicated(gr.df), ]
split(GRanges(gr.df$seqnames, IRanges(gr.df$start, gr.df$end), gr.df$strand),
@DarioS
DarioS / rnaPlot.R
Created May 26, 2011 08:35
Plot RNA exon and junction counts
.plotValues <- function(data, plot.columns, y.range, y.lab, plot.type, cols, ord, main,
g.symbol, first.plot)
{
if(plot.type == "line")
{
matplot(data[, plot.columns, drop = FALSE], ylim = y.range, type = 'l', lty = 1, lwd = 2,
ylab = y.lab, col = cols, main = main, xaxt = 'n')
axis(1, 1:nrow(data), ord)
} else {
plot.values <- t(data[, plot.columns, drop = FALSE])
@DarioS
DarioS / isoDiff.R
Created June 15, 2011 00:55
Convenience function for calculating X² for gene features.
isoDiff <- function(counts, what = c("exon", "junction", "intronic"), min.count = 0)
{
unknown.what <- setdiff(what, c("exon", "junction", "intronic"))
if(length(unknown.what) > 0)
stop(paste(unknown.what, collapse = ", "), " are invalid values for 'what'.")
counts.df <- as.data.frame(counts)
features.keep <- counts.df[, "type"] %in% what
counts.df <- counts.df[features.keep, ]
counts.cols <- metadata(counts)[["counts.cols"]] + 5 # Transform relative to all data frame columns.
@DarioS
DarioS / calcFPKMs.R
Created August 22, 2011 06:07
Convert feature counts into RPKM counts per gene
setGeneric("calcFPKMs", function(counts, ...) {standardGeneric("calcFPKMs")})
setMethod("calcFPKMs", c("GRanges"),
function(counts, verbose = TRUE)
{
counts.df <- as.data.frame(counts)
counts.cols <- metadata(counts)[["counts.cols"]] + 5
# Only use read counts from the known transcriptome.
counts.df <- counts.df[counts.df[, "type"] %in% c("exon", "junction"), ]
07 Sep 2013 04:17:41 [rdesktop] ERROR Error downloading manifest: Network unreachable; LOGGED FROM: void desktop::UpdateChecker::manifestDownloadError(const QString&) /home/ubuntu/rstudio/src/cpp/desktop/DesktopUpdateChecker.cpp:75
07 Sep 2013 04:29:13 [rdesktop] ERROR Error downloading manifest: Network unreachable; LOGGED FROM: void desktop::UpdateChecker::manifestDownloadError(const QString&) /home/ubuntu/rstudio/src/cpp/desktop/DesktopUpdateChecker.cpp:75
08 Sep 2013 05:04:19 [rdesktop] ERROR Error downloading manifest: Network unreachable; LOGGED FROM: void desktop::UpdateChecker::manifestDownloadError(const QString&) /home/ubuntu/rstudio/src/cpp/desktop/DesktopUpdateChecker.cpp:75
08 Sep 2013 22:05:57 [rdesktop] ERROR Error 5 (org.freedesktop.DBus.Error.NoReply): Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.; LOGGED FROM: void desktop::synct