Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing prettynum, digits = 0 to 1 #77

Merged
merged 2 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/DataProcessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ getTableFromPrecursorSet <- function(dataList, precursorSet){
featureMatrix <- data.frame(as.matrix(dataList$featureMatrix[precursorSet, featureIndeces, drop = FALSE]))
rownames(featureMatrix) <- dataList$precursorLabels[precursorSet]
colnames(featureMatrix) <- colnames(dataList$featureMatrix)[featureIndeces]
featureMatrix <- format(x = featureMatrix, digits = 0, nsmall = 4)
featureMatrix <- format(x = featureMatrix, digits = 1, nsmall = 4)
if(length(featureIndeces) > 0){
featureMatrix[featureMatrix=="0.0000"] <- "-"
featureMatrix[featureMatrix=="1.0000"] <- "1"
Expand Down
2 changes: 1 addition & 1 deletion R/FragmentMatrixFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,7 @@ convertToProjectFile2 <- function(filePeakMatrix,
if(isGC){
## round GC mzs to integer
for(spectrumIdx in seq_len(length(spectraList))){
spectraList[[spectrumIdx]]$ms2Peaks_mz <- round(x = spectraList[[spectrumIdx]]$ms2Peaks_mz, digits = 0)
spectraList[[spectrumIdx]]$ms2Peaks_mz <- round(x = spectraList[[spectrumIdx]]$ms2Peaks_mz, digits = 1)
}
}

Expand Down
12 changes: 6 additions & 6 deletions R/Plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@ calcPlotMS2 <- function(dataList, fragmentsX = NULL, fragmentsY = NULL, fragment
if(length(dataX) > 0){
## axis with the individual fragment m/z's (ticks, labels)
axis(side = 1, at = dataX, labels = FALSE, las = 2)
axis(side = 1, at = tickPositions, labels = format(x = dataX, digits = 0, nsmall = 4), las = 2, tick = FALSE)
axis(side = 1, at = tickPositions, labels = format(x = dataX, digits = 1, nsmall = 4), las = 2, tick = FALSE)

## sticks
points(x = dataX, y = dataY, col = nodeColors, type = "h", lwd=4)
Expand Down Expand Up @@ -4961,7 +4961,7 @@ plotFragments <- function(masses, numberOfFragments, colors = NULL, numberOfPrec
#axis(side = 1, at = dataList$ms2_masses, labels = dataList$ms2_masses, las = 2, tick = TRUE, col = colors)
#for(i in 1:length(dataList$ms2_masses))
for(i in dataOrder)
axis(side = 1, at = masses[[i]], labels = format(x = masses[[i]], digits = 0, nsmall = 4), las = 2, tick = TRUE, col.axis = colors[[i]])
axis(side = 1, at = masses[[i]], labels = format(x = masses[[i]], digits = 1, nsmall = 4), las = 2, tick = TRUE, col.axis = colors[[i]])

points(x = masses[dataOrder], y = numberOfFragments[dataOrder], col = colors[dataOrder], type = "h", lwd=4)
#points(x = masses[dataOrder], y = numberOfFragments[dataOrder], col = colors[dataOrder], pch=19, cex=1.)
Expand Down Expand Up @@ -5040,7 +5040,7 @@ plotFragments2 <- function(masses, numberOfFragments, numberOfPrecursors, xInter
#axis(side = 1, at = masses, labels = masses, las = 2, tick = TRUE, col = colors)
#for(i in 1:length(masses))
for(i in dataOrder)
axis(side = 1, at = masses[[i]], labels = format(x = masses[[i]], digits = 0, nsmall = 4), las = 2, tick = TRUE, col.axis = colors[[i]])
axis(side = 1, at = masses[[i]], labels = format(x = masses[[i]], digits = 1, nsmall = 4), las = 2, tick = TRUE, col.axis = colors[[i]])

points(x = masses[dataOrder], y = numberOfFragments[dataOrder], col = colors[dataOrder], type = "h", lwd=4)
#points(x = masses[dataOrder], y = numberOfFragments[dataOrder], col = colors[dataOrder], pch=19, cex=1.)
Expand Down Expand Up @@ -5161,12 +5161,12 @@ calcPlotSpectrumVsClass_big <- function(masses_spec, intensity_spec, colors_spec

## axis with the individual fragment m/z's (ticks, labels)
axis(side = 1, at = masses_spec, labels = FALSE, las = 2)
axis(side = 1, at = masses_spec[-these], labels = format(x = masses_spec[-these], digits = 0, nsmall = 4), las = 2, tick = FALSE, col.axis = "grey")
axis(side = 1, at = masses_spec[-these], labels = format(x = masses_spec[-these], digits = 1, nsmall = 4), las = 2, tick = FALSE, col.axis = "grey")
if(length(these) == 1){
if(these != length(masses_spec)+1)
axis(side = 1, at = masses_spec[ these], labels = format(x = masses_spec[ these], digits = 0, nsmall = 4), las = 2, tick = FALSE, col.axis = "black")
axis(side = 1, at = masses_spec[ these], labels = format(x = masses_spec[ these], digits = 1, nsmall = 4), las = 2, tick = FALSE, col.axis = "black")
} else {
axis(side = 1, at = masses_spec[ these], labels = format(x = masses_spec[ these], digits = 0, nsmall = 4), las = 2, tick = FALSE, col.axis = "black")
axis(side = 1, at = masses_spec[ these], labels = format(x = masses_spec[ these], digits = 1, nsmall = 4), las = 2, tick = FALSE, col.axis = "black")
}

## sticks
Expand Down
6 changes: 3 additions & 3 deletions inst/MetFamily/app_files/server_guiMs2plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ obsMS2hover <- observeEvent(input$plotMS2_hover, {
print(paste("update output$information"))
paste(
"Fragment with m/z = ", ms2PlotValues$fragmentListClicked$fragmentMasses[[minimumIndex]],
" and (average) abundance = ", format(x = ms2PlotValues$fragmentListClicked$fragmentAbundances[[minimumIndex]], digits = 0, nsmall = 4),
" and (average) abundance = ", format(x = ms2PlotValues$fragmentListClicked$fragmentAbundances[[minimumIndex]], digits = 1, nsmall = 4),
" is present in ", numberOfPrecursors, " MS/MS spectra",
"\nand has a cluster-discriminating power of ", format(x = ms2PlotValues$fragmentListClicked$fragmentDiscriminativity[[minimumIndex]]*100, digits = 3, nsmall = 2), "%.",
sep = ""
Expand Down Expand Up @@ -164,7 +164,7 @@ output$plotMS2_hover_info <- renderUI({
# print(paste("update output$information"))
# paste(
# "Fragment with m/z = ", ms2PlotValues$fragmentListClicked$fragmentMasses[[minimumIndex]],
# " and (average) abundance = ", format(x = ms2PlotValues$fragmentListClicked$fragmentAbundances[[minimumIndex]], digits = 0, nsmall = 4),
# " and (average) abundance = ", format(x = ms2PlotValues$fragmentListClicked$fragmentAbundances[[minimumIndex]], digits = 1, nsmall = 4),
# " is present in ", numberOfPrecursors, " MS/MS spectra",
# "\nand has a cluster-discriminating power of ", format(x = ms2PlotValues$fragmentListClicked$fragmentDiscriminativity[[minimumIndex]]*100, digits = 3, nsmall = 2), "%.",
# sep = ""
Expand All @@ -173,7 +173,7 @@ output$plotMS2_hover_info <- renderUI({

fragmentMz <- ms2PlotValues$fragmentListClicked$fragmentMasses[[minimumIndex]]
fragmentMzS <- format(x = fragmentMz, nsmall = 4)
intensityS <- format(x = ms2PlotValues$fragmentListClicked$fragmentAbundances[[minimumIndex]], digits = 0, nsmall = 4)
intensityS <- format(x = ms2PlotValues$fragmentListClicked$fragmentAbundances[[minimumIndex]], digits = 1, nsmall = 4)
cdpS <- format(x = ms2PlotValues$fragmentListClicked$fragmentDiscriminativity[[minimumIndex]]*100, digits = 3, nsmall = 2)

info <- paste(
Expand Down
4 changes: 2 additions & 2 deletions inst/MetFamily/app_files/server_guiTabHca.R
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ obsHeatmaphover <- observeEvent(input$plotHeatmap_hover, {

#################################################
## info
treeLeafIndex2 <- as.numeric(format(x = hoverX, digits = 0))
treeLeafIndex2 <- as.numeric(format(x = hoverX, digits = 1))
treeLeafIndex <- clusterDataList$cluster$order[[treeLeafIndex2]]
precursorIndex <- filterHca$filter[[treeLeafIndex]]

Expand Down Expand Up @@ -698,7 +698,7 @@ output$plotHeatmap_hover_info <- renderUI({
return(NULL)

#################################################
treeLeafIndex2 <- as.numeric(format(x = hoverX, digits = 0))
treeLeafIndex2 <- as.numeric(format(x = hoverX, digits = 1))
treeLeafIndex <- clusterDataList$cluster$order[[treeLeafIndex2]]
precursorIndex <- filterHca$filter[[treeLeafIndex]]

Expand Down
Loading