print_c_results <- function(correlations, annotation, outputName, ontology) {
# Generates a .tsv file with the results of the analysis.
#
# Args:
# correlations: (vector) value of the correlations between ontology's term
# and variable.
# annotation: (list) translation of the ontology's terms.
# outputName: (char) name of the output file.
# ontology: (char) which ontology was used for correlation.
# Returns:
# none.
# output <- Map("c", names(correlations), correlations,
# annotation)
outputName <- gsub("//", "/", outputName, fixed = TRUE)
output <- annotation[names(correlations)]
# colnames(output)
for (term in names(correlations)) {
# term <- names(correlations)[i]
output[[term]] <- c(term, correlations[[term]], annotation[[term]])
}
df.output <- data.frame(matrix(unlist(output), nrow = length(output),
byrow = T, dimnames = list(names(output))))
id <- switch(tolower(ontology),
"go" = "GO",
"gene ontology" = "GO",
"kegg" = "KO",
"other" = "ID")
output.columns <- c(id, "CC", "annotation")
write.table(df.output, file = outputName, quote = FALSE,
row.names = FALSE, col.names = output.columns, sep = "\t")
cat(".")
return(NULL)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.