## Not run:
# ## Start with miRNA data from this package
# data(mirnaobj);
#
# ## Write a file as example of required input
# write.table(mirnaobj@mirnaTable, file = "mirnaTable.txt",
# quote = FALSE, row.names = FALSE, col.names = TRUE, na = "",
# sep = "\t");
#
# ## Now essentially load it back, but assign column headers
# mirnaobj <- loadmirnapath( mirnafile = "mirnaTable.txt",
# pvaluecol = "P-value", groupcol = "GROUP",
# mirnacol = "miRNA Name", assayidcol = "ASSAYID" );
#
# ## Start with miRNA data from this package
# data(mirnaobj);
#
# ## Write a file as example of required input
# write.table(mirnaobj@mirnaGene, file = "mirnaGene.txt",
# quote = FALSE, row.names = FALSE, col.names = TRUE, na = "",
# sep = "\t");
#
# ## Load the miRNA to gene associations
# mirnaobj <- loadmirnatogene( mirnafile = "mirnaGene.txt",
# mirnaobj = mirnaobj, mirnacol = "miRNA Name",
# genecol = "Entrez Gene ID",
# columns = c(assayidcol = "ASSAYID") );
#
# ## Write a file as example of required input
# write.table(mirnaobj@mirnaPathways, file = "mirnaPathways.txt",
# quote = FALSE, row.names = FALSE, col.names = TRUE, na = "",
# sep = "\t");
#
# ## Load the gene to pathway associations
# mirnaobj <- loadmirnapathways( mirnaobj = mirnaobj,
# pathwayfile = "mirnaPathways.txt",
# pathwaycol = "Pathway Name", genecol = "Entrez Gene ID");
#
# ## Annotate hits by filtering by P-value 0.05
# mirnaobj <- filtermirnapath( mirnaobj, pvalue = 0.05,
# expression = NA, foldchange = NA );
#
# ## Now run enrichment test
# mirnaobj <- runEnrichment( mirnaobj=mirnaobj, Composite=TRUE,
# groups=NULL, permutations=0 );
#
# ## Print out a summary table of significant results
# finaltable <- mirnaTable( mirnaobj, groups=NULL, format="Tall",
# Significance=0.1, pvalueTypes=c("pvalues") );
# finaltable[1:4,];
#
# ## Example which calls heatmap function on the resulting data
# widetable <- mirnaTable( mirnaobj, groups=NULL, format="Wide",
# Significance=0.1, na.char=NA, pvalueTypes=c("pvalues") );
# ## Assign 1 to NA values, assuming they're all equally
# ## non-significant
# widetable[is.na(widetable)] <- 1;
#
# ## Display a heatmap of the result across sample groups
# pathwaycol <- mirnaobj@columns["pathwaycol"];
# pathwayidcol <- mirnaobj@columns["pathwayidcol"];
# rownames(widetable) <- apply(widetable[,c(pathwaycol,
# pathwayidcol)], 1, function(i)paste(i, collapse="-"));
# wt <- as.matrix(widetable[3:dim(widetable)[2]], mode="numeric")
# heatmap(wt, scale="col");
#
# ## Show results where pathways are shared in four or more
# ## sample groups
# pathwaySubset <- apply(wt, 1, function(i)
# {
# length(i[i < 1]) >= 4;
# } )
# heatmap(wt[pathwaySubset,], scale="row");
# ## End(Not run)
Run the code above in your browser using DataLab