Skip to content

Commit

Permalink
Bioc revision2 - cont. (#102)
Browse files Browse the repository at this point in the history
* removed commented out codes

* resolved functions in functions for compareTaxaGroups.R

* replaced return() by stop() with error msg

* replaced return() by stop() with error msg for functions in inst/PhyloProfile/R

* version bump
  • Loading branch information
trvinh authored Aug 6, 2019
1 parent 286baee commit f2c3b22
Show file tree
Hide file tree
Showing 35 changed files with 403 additions and 273 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: PhyloProfile
Version: 0.99.19
Version: 0.99.20
Date: 2019-08-06
Title: PhyloProfile
Authors@R: c(
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export(featureDistTaxPlot)
export(filterProfileData)
export(fromInputToProfile)
export(geneAgePlotDf)
export(generateSinglePlot)
export(getAllDomainsOma)
export(getAllFastaOma)
export(getCommonAncestor)
Expand All @@ -49,6 +50,7 @@ export(getSelectedFastaOma)
export(getSelectedTaxonNames)
export(getTaxonomyMatrix)
export(getTaxonomyRanks)
export(gridArrangeSharedLegend)
export(heatmapPlotting)
export(highlightProfilePlot)
export(parseDomainInput)
Expand All @@ -68,6 +70,8 @@ import(ExperimentHub)
import(data.table)
import(energy)
import(ggplot2)
import(grid)
import(gridExtra)
import(shinyBS)
import(shinycssloaders)
import(shinyjs, except = colourInput)
Expand Down
10 changes: 6 additions & 4 deletions R/analyzeDistribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#' createPercentageDistributionData(mainLongRaw, "class")

createPercentageDistributionData <- function(inputData, rankName = NULL) {
if (is.null(inputData) | is.null(rankName)) return()
if (is.null(inputData) | is.null(rankName))
stop("Input data or rank name cannot be NULL!")
allMainRanks <- getTaxonomyRanks()
if (!(rankName[1] %in% allMainRanks)) return("Invalid taxonomy rank given!")
if (!(rankName[1] %in% allMainRanks)) stop("Invalid taxonomy rank given!")

if (ncol(inputData) < 4) {
colnames(inputData) <- c("geneID", "ncbiID", "orthoID")
Expand Down Expand Up @@ -151,7 +152,8 @@ createVariableDistributionDataSubset <- function(
supertaxonMod <- NULL

# check parameters
if (is.null(fullProfileData) | is.null(distributionData)) return()
if (is.null(fullProfileData) | is.null(distributionData))
stop("Full processed profiles or distribution data cannot be NULL!")

# get geneID and supertaxon name for distributionData
distributionDataName <- merge(
Expand Down Expand Up @@ -235,7 +237,7 @@ createVarDistPlot <- function(
data, varName = "var", varType = "var1", percent = c(0, 1),
distTextSize = 12
) {
if (is.null(data)) return()
if (is.null(data)) stop("Input data cannot be NULL!")
if (varType == "presSpec") {
# remove presSpec < cutoffMin or > cutoffMax
if (percent[1] > 0) {
Expand Down
8 changes: 4 additions & 4 deletions R/clusterProfile.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ getDataClustering <- function(
data = NULL, profileType = "binary",
var1AggregateBy = "max", var2AggregateBy = "max"
) {
if (is.null(data)) return()
if (is.null(data)) stop("Input data cannot be NULL!")
supertaxon <- NULL
presSpec <- NULL

Expand Down Expand Up @@ -97,7 +97,7 @@ getDataClustering <- function(
#' getDistanceMatrix(profiles, method)

getDistanceMatrix <- function(profiles = NULL, method = "mutualInformation") {
if (is.null(profiles)) return()
if (is.null(profiles)) stop("Profile data cannot be NULL!")
profiles <- profiles[, colSums(profiles != 0) > 0]
profiles <- profiles[rowSums(profiles != 0) > 0, ]

Expand Down Expand Up @@ -157,7 +157,7 @@ getDistanceMatrix <- function(profiles = NULL, method = "mutualInformation") {
#' clusterDataDend(distanceMatrix, clusterMethod)

clusterDataDend <- function(distanceMatrix = NULL, clusterMethod = "complete") {
if (is.null(distanceMatrix)) return()
if (is.null(distanceMatrix)) stop("Distance matrix cannot be NULL!")
dd.col <- hclust(distanceMatrix, method = clusterMethod)
return(dd.col)
}
Expand All @@ -181,7 +181,7 @@ clusterDataDend <- function(distanceMatrix = NULL, clusterMethod = "complete") {
#' getDendrogram(dd)

getDendrogram <- function(dd = NULL) {
if (is.null(dd)) return()
if (is.null(dd)) stop("Input dendrogram cannot be NULL!")
p <- ape::plot.phylo(as.phylo(dd))
return(p)
}
Loading

0 comments on commit f2c3b22

Please sign in to comment.