Skip to content

Commit

Permalink
Drop unused function calcPlotPCAscores2
Browse files Browse the repository at this point in the history
  • Loading branch information
sneumann committed Nov 13, 2024
1 parent 210ba20 commit 3dd64a4
Showing 1 changed file with 0 additions and 97 deletions.
97 changes: 0 additions & 97 deletions R/Plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -2408,103 +2408,6 @@ calcPlotPCAscores1 <- function(pcaObj, dataList, filterObj, pcaDimensionOne, pca
}
}

#######################
calcPlotPCAscores2 <- function(pcaObj, dataList, filterObj, pcaDimensionOne, pcaDimensionTwo, showScoresLabels, xInterval = NULL, yInterval = NULL){
#### changing this to 1
palette <- colorPaletteScores()
#dev.new(width=15,height=15)
if(filterObj$filterBySamples){
colorsForReplicates <- palette[unlist(lapply(X = filterObj$grouXXXps, FUN = function(x){
groupIdx <- dataList$groupIdxFromGroupName(x)
samples <- dataList$dataColumnsNameFunctionFromGroupName(x, sampleNamesToExclude = dataList$excludedSamples(dataList$groupSampleDataFrame))
samples <- intersect(samples, filterObj$sampleSet)
rep(x = groupIdx, times = length(samples))
}))]
} else {
colorsForReplicates <- palette[unlist(lapply(X = filterObj$grouXXXps, FUN = function(x){
groupIdx <- dataList$groupIdxFromGroupName(x)
rep(x = groupIdx, times = length(dataList$dataColumnsNameFunctionFromGroupName(x, sampleNamesToExclude = dataList$excludedSamples(dataList$groupSampleDataFrame))))
}))]
}

## data
dataDimOne <- pcaObj$scores[, pcaDimensionOne]
dataDimTwo <- pcaObj$scores[, pcaDimensionTwo]

## performance
resultObj <- getPcaPerformanceIndicator(pcaObj = pcaObj, isScores = TRUE)
xAxisLabel <- resultObj$xAxisLabel
yAxisLabel <- resultObj$yAxisLabel

## xlim / ylim
xMin <- min(dataDimOne)
xMax <- max(dataDimOne)
yMin <- min(dataDimTwo)
yMax <- max(dataDimTwo)

if(any(is.na(c(xMin, xMax, yMin, yMax)))){
xMin <- -1
xMax <- 1
yMin <- -1
yMax <- 1
#### I am changing this
# xMin <- -0.05
# xMax <- -0.05
# yMin <- -0.5
# yMax <- -0.5
##############

}

if(is.null(xInterval))
xInterval <- c(xMin, xMax)
if(is.null(yInterval))
yInterval <- c(yMin, yMax)
#### this is the original one
#par(mar=c(3 + 0.35, 3, 2, 1), mgp = c(2, 1, 0)) ## c(bottom, left, top, right)
par(mar=c(3+0.0125, 3+0.125, 2, 1), mgp = c(2, 1, 0),par(xpd=FALSE)) ## c(bottom, left, top, right)
#par(mar=c(3,0,2,1), mgp = c(2, 1, 0))
plot(
x = dataDimOne, y = dataDimTwo,
xlim = xInterval, ylim = yInterval,
xlab = xAxisLabel, ylab = yAxisLabel, main = "Scores",
#### this is my blind test changing from 19 to 19:22
#ntemp<-length(filterObj$grouXXXps),
#ntemp1<-sum(ntemp,1),
### I am testing the filterObj$grouXXXps... This is fine .. will test the
col = colorsForReplicates, pch=1:length(filterObj$grouXXXps),lty=1,lwd=2,cex=1.
### checking the colorsForReplicates

)

## axis
xInt <- xMax - xMin
yInt <- yMax - yMin
xl <- xMin - xInt
xr <- xMax + xInt
yl <- yMin - yInt
yr <- yMax + yInt
###checking what happens if i comment this...this is original
#segments(x0 = xl, x1 = xr, y0 = 0, y1 = 0, col = "black", lwd = 1)
#segments(x0 = 0, x1 = 0, y0 = yl, y1 = yr, col = "black", lwd = 1)
##############

#############

if(showScoresLabels){

if(filterObj$filterBySamples){
labels <- dataList$dataColumnsNameFunctionFromGroupNames(filterObj$grouXXXps, sampleNamesToExclude = dataList$excludedSamples(dataList$groupSampleDataFrame))
labels <- intersect(labels, filterObj$sampleSet)
} else {
labels <- dataList$dataColumnsNameFunctionFromGroupNames(filterObj$grouXXXps, sampleNamesToExclude = dataList$excludedSamples(dataList$groupSampleDataFrame))
}
graphics::text(x = dataDimOne, y = dataDimTwo, labels = labels, pos = 4)
}
}

########################################### adding this new line

calcPlotPCAloadings <- function(
pcaObj, dataList, filter,
pcaDimensionOne, pcaDimensionTwo,
Expand Down

0 comments on commit 3dd64a4

Please # to comment.