Skip to content

Commit

Permalink
Added loadGEM function
Browse files Browse the repository at this point in the history
  • Loading branch information
spficklin committed May 8, 2020
1 parent 07da462 commit c6d1f0e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export(getSampleStringArray)
export(graphEdgeList)
export(graphNet)
export(highlightEdgeList)
export(loadGEM)
export(loadKINCNetwork)
export(loadSampleAnnotations)
export(performBiasTests)
Expand Down
5 changes: 1 addition & 4 deletions R/SSC.R
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,6 @@ filterInsignficantEdges <- function(net, p_th = NA, q_th = 1e-3, r_th = NA) {
#' @param net
#' A network data frame in Tidy format, containing the KINC-produced network.
#' The loadNetwork function imports a dataframe in the correct format for this function.
#' @param osa
#' The sample annotation matrix as created by the loadSampleAnnotations()
#' function.
#'
#' @return
#' A list containing the following keys and values.
Expand All @@ -581,7 +578,7 @@ filterInsignficantEdges <- function(net, p_th = NA, q_th = 1e-3, r_th = NA) {
#' of the association with the test names
#'
#' @export
getSSLinkModules = function(net, osa, k=25, min_cluster_size = 10, show_plots = TRUE) {
getSSLinkModules = function(net, k=25, min_cluster_size = 10, show_plots = TRUE) {

# Set p-values at 0 to a very low value so our
# scoring works.
Expand Down
25 changes: 21 additions & 4 deletions R/base.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ loadKINCNetwork = function(network_file, nrows=-1, skip=0) {
colnames(net) = colnames(headers)
return (net)
}

#' Imports a network file produced by KINC into a data frame.
#'
#' @param GEM_file
#' The path to the GEM file on the file system. This file should
#' contain gene expression (or abundance data) where the rows
#' are genes (or compounds) and the columns are samples. The first
#' column should countain the gene name. The first row contain a
#' a header with only the sample names. Thus the header row has
#' one less values then every other row.
#'
#' @return
#' A dataframe containing the GEM.
#'
#' @export
loadGEM = function(GEM_file) {
emx = read.table(GEM_file, header=TRUE, sep="\t")
return(emx)
}
#' Exports a network data frame as a KINC compatible file.
#'
#' @param net
Expand Down Expand Up @@ -684,10 +703,8 @@ getRanks = function(net) {
#'
#' @param annotation_file
#' The path to the file containing the annotations.
#' @param smaple_order
#' A file containing the order of samples in the sample strings of
#' the network. The file should contain the list of samples each on
#' a separate line.
#' @param sample_header
#' The name of the column containing the sample names.
#'
#' @return
#' A data frame containing the annotations in the order of the samples.
Expand Down
4 changes: 1 addition & 3 deletions man/loadSampleAnnotations.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c6d1f0e

Please sign in to comment.