R/readSif.R

Defines functions readSif

Documented in readSif

#' Read in a binary SIF file 
#' 
#' @param inputFile an inputFile
#' @return a data.frame with the interactions in the binary SIF format
#' 
#' @examples 
#' results <- readSif(system.file("extdata", "test_sif.txt", package="paxtoolsr"))
#' 
#' @concept paxtoolsr
#' @export
#' 
#' @importFrom data.table fread
readSif <- function(inputFile) {
    if(!file.exists(inputFile)) {
        stop("ERROR: inputFile not file.")
    }
    
    results <- fread(inputFile, sep="\t", header=TRUE, stringsAsFactors=FALSE)
    results <- as.data.frame(results)
    colnames(results) <- c("PARTICIPANT_A",  "INTERACTION_TYPE", "PARTICIPANT_B")
    
    return(results)
}
cannin/paxtoolsr documentation built on Jan. 13, 2018, 4:53 p.m.