├── R ├── MzQC_classes.R ├── pkg_internal.R ├── modsToTable.R ├── modsToTableByRaw.R ├── PTXQC-package.R ├── qcMetric_EVD_modTable.R ├── plot_peptideMods.R ├── fcn_mqpar.R └── qcMetric_PAR.R ├── .gitignore ├── .travis.yml ├── inst ├── dragNdrop │ └── QC-dragdrop │ │ ├── _internal │ │ ├── copy_complete_R_installation_folder_here.txt │ │ └── compute_QC_report.R │ │ └── createQC_dragNdrop_withYAML.bat ├── examples │ ├── example_IDoverRT.png │ ├── example_heatmap.png │ ├── example_MBRalignment.png │ ├── report_v1.1.0__txt_5files_withMatch-100min.pdf │ ├── README.md │ └── report_ecoli_small.mzQC ├── reportTemplate │ └── modes_UpSet.png └── CITATION ├── docs ├── reference │ ├── Rplot001.png │ ├── Rplot002.png │ ├── Rplot003.png │ ├── Rplot004.png │ ├── Rplot005.png │ ├── Rplot006.png │ ├── getPCA-1.png │ ├── getECDF-1.png │ ├── plot_TIC-1.png │ ├── plotTable-1.png │ ├── plot_Charge-1.png │ ├── plot_IDRate-1.png │ ├── plot_TopN-1.png │ ├── plot_ContEVD-1.png │ ├── plot_ContEVD-2.png │ ├── plot_ContUser-1.png │ ├── plot_ContsPG-1.png │ ├── plot_MBRAlign-1.png │ ├── plot_MBRgain-1.png │ ├── plot_MS2Decal-1.png │ ├── plot_RatiosPG-1.png │ ├── plot_CountData-1.png │ ├── plot_DataOverRT-1.png │ ├── plot_IDsOverRT-1.png │ ├── plot_RTPeakWidth-1.png │ ├── plot_ScanIDRate-1.png │ ├── plot_TopNoverRT-1.png │ ├── plot_peptideMods-1.png │ ├── qcMetric-class-1.png │ ├── qcMetric-class-2.png │ ├── qcMetric-class-3.png │ ├── qcMetric-class-4.png │ ├── qcMetric-class-5.png │ ├── qcMetric-class-6.png │ ├── peakWidthOverTime-1.png │ ├── plot_ContUserScore-1.png │ ├── plot_MBRIDtransfer-1.png │ ├── plot_CalibratedMSErr-1.png │ ├── plot_MS2Oversampling-1.png │ ├── plot_MissedCleavages-1.png │ ├── plot_UncalibratedMSErr-1.png │ └── plot_IonInjectionTimeOverRT-1.png ├── articles │ ├── DragNDrop_Action.png │ └── DragNDrop_BatWindow.png ├── pkgdown.yml ├── link.svg ├── bootstrap-toc.css ├── docsearch.js └── pkgdown.js ├── vignettes ├── DragNDrop_Action.png ├── DragNDrop_BatWindow.png ├── readme.txt ├── PTXQC-Input_And_Output_Data.Rmd ├── PTXQC-ListOfMetrics.Rmd ├── PTXQC-DragNDrop.Rmd └── PTXQC-Basic_Guide_for_R_users.Rmd ├── .Rbuildignore ├── tests ├── testthat.R └── testthat │ ├── test_modsToTable.R │ ├── test_qcMetric.R │ ├── test_modsToTableByRaw.R │ ├── test_createYaml.R │ └── test_qualities.R ├── LICENSE ├── man ├── PTXQC.Rd ├── CV.Rd ├── RSD.Rd ├── del0.Rd ├── theme_blank.Rd ├── qcMetric_MSMSScans_TopNoverRT-class.Rd ├── lcpCount.Rd ├── lcsCount.Rd ├── pastet.Rd ├── grapes-plus-grapes.Rd ├── pasten.Rd ├── LCS.Rd ├── getMetricsObjects.Rd ├── ggText.Rd ├── scale01linear.Rd ├── print.PTXQC_table.Rd ├── repEach.Rd ├── darken.Rd ├── getFileEncoding.Rd ├── getMetaData.Rd ├── printWithFooter.Rd ├── plot_ContsPG.Rd ├── renameFile.Rd ├── brewer.pal.Safe.Rd ├── flattenList.Rd ├── getECDF.Rd ├── plotTableRaw.Rd ├── qualMedianDist.Rd ├── scale_x_discrete_reverse.Rd ├── scale_y_discrete_reverse.Rd ├── grepv.Rd ├── qualGaussDev.Rd ├── plot_TopN.Rd ├── delLCS.Rd ├── getRunQualityTemplate.Rd ├── qualLinThresh.Rd ├── pointsPutX.Rd ├── getHTMLTable.Rd ├── longestCommonSuffix.Rd ├── checkEnglishLocale.Rd ├── longestCommonPrefix.Rd ├── thinOut.Rd ├── modsToTable.Rd ├── plot_MS2Oversampling.Rd ├── getPeptideCounts.Rd ├── plot_ScanIDRate.Rd ├── thinOutBatch.Rd ├── getProteinCounts.Rd ├── ScoreInAlignWindow.Rd ├── computeMatchRTFractions.Rd ├── plot_TIC.Rd ├── plot_MS2Decal.Rd ├── appendEnv.Rd ├── plot_TopNoverRT.Rd ├── plot_IDsOverRT.Rd ├── plot_RTPeakWidth.Rd ├── assignBlocks.Rd ├── getMaxima.Rd ├── qualCenteredRef.Rd ├── getAbundanceClass.Rd ├── qualCentered.Rd ├── qualHighest.Rd ├── qualBestKS.Rd ├── read.MQ.Rd ├── assembleMZQC.Rd ├── inMatchWindow.Rd ├── plot_Charge.Rd ├── plot_ContEVD.Rd ├── plot_MBRgain.Rd ├── peakWidthOverTime.Rd ├── supCount.Rd ├── plot_MissedCleavages.Rd ├── plot_CountData.Rd ├── ggAxisLabels.Rd ├── getMetaFilenames.Rd ├── fixCalibration.Rd ├── plot_RatiosPG.Rd ├── wait_for_writable.Rd ├── byX.Rd ├── plotTable.Rd ├── byXflex.Rd ├── LCSn.Rd ├── plot_IonInjectionTimeOverRT.Rd ├── RTalignmentTree.Rd ├── mosaicize.Rd ├── plot_DataOverRT.Rd ├── getQCHeatMap.Rd ├── getPCA.Rd ├── plot_peptideMods.Rd ├── plot_ContUser.Rd ├── getMQPARValue.Rd ├── findAlignReference.Rd ├── modsToTableByRaw.Rd ├── shortenStrings.Rd ├── plot_ContUserScore.Rd ├── plot_IDRate.Rd ├── boxplotCompare.Rd ├── YAMLClass-class.Rd ├── getFragmentErrors.Rd ├── createYaml.Rd ├── plot_MBRIDtransfer.Rd ├── idTransferCheck.Rd ├── plot_CalibratedMSErr.Rd ├── plot_UncalibratedMSErr.Rd ├── FilenameMapper-class.Rd ├── delLCP.Rd ├── QCMetaFilenames.Rd ├── alignmentCheck.Rd ├── simplifyNames.Rd ├── getReportFilenames.Rd ├── plot_MBRAlign.Rd ├── MzTabReader-class.Rd ├── peakSegmentation.Rd ├── correctSetSize.Rd ├── qualUniform.Rd ├── createReport.Rd ├── PTXQC-package.Rd └── qcMetric-class.Rd ├── PTXQC.Rproj ├── CONTRIBUTING.md ├── DESCRIPTION └── NAMESPACE /R/MzQC_classes.R: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | inst/doc 2 | .Rhistory 3 | .Rproj.user/ 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: r 2 | 3 | warnings_are_errors: true 4 | -------------------------------------------------------------------------------- /inst/dragNdrop/QC-dragdrop/_internal/copy_complete_R_installation_folder_here.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/Rplot002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/Rplot002.png -------------------------------------------------------------------------------- /docs/reference/Rplot003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/Rplot003.png -------------------------------------------------------------------------------- /docs/reference/Rplot004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/Rplot004.png -------------------------------------------------------------------------------- /docs/reference/Rplot005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/Rplot005.png -------------------------------------------------------------------------------- /docs/reference/Rplot006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/Rplot006.png -------------------------------------------------------------------------------- /docs/reference/getPCA-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/getPCA-1.png -------------------------------------------------------------------------------- /docs/reference/getECDF-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/getECDF-1.png -------------------------------------------------------------------------------- /docs/reference/plot_TIC-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_TIC-1.png -------------------------------------------------------------------------------- /docs/reference/plotTable-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plotTable-1.png -------------------------------------------------------------------------------- /docs/reference/plot_Charge-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_Charge-1.png -------------------------------------------------------------------------------- /docs/reference/plot_IDRate-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_IDRate-1.png -------------------------------------------------------------------------------- /docs/reference/plot_TopN-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_TopN-1.png -------------------------------------------------------------------------------- /vignettes/DragNDrop_Action.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/vignettes/DragNDrop_Action.png -------------------------------------------------------------------------------- /docs/articles/DragNDrop_Action.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/articles/DragNDrop_Action.png -------------------------------------------------------------------------------- /docs/reference/plot_ContEVD-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_ContEVD-1.png -------------------------------------------------------------------------------- /docs/reference/plot_ContEVD-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_ContEVD-2.png -------------------------------------------------------------------------------- /docs/reference/plot_ContUser-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_ContUser-1.png -------------------------------------------------------------------------------- /docs/reference/plot_ContsPG-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_ContsPG-1.png -------------------------------------------------------------------------------- /docs/reference/plot_MBRAlign-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_MBRAlign-1.png -------------------------------------------------------------------------------- /docs/reference/plot_MBRgain-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_MBRgain-1.png -------------------------------------------------------------------------------- /docs/reference/plot_MS2Decal-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_MS2Decal-1.png -------------------------------------------------------------------------------- /docs/reference/plot_RatiosPG-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_RatiosPG-1.png -------------------------------------------------------------------------------- /inst/examples/example_IDoverRT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/inst/examples/example_IDoverRT.png -------------------------------------------------------------------------------- /inst/examples/example_heatmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/inst/examples/example_heatmap.png -------------------------------------------------------------------------------- /vignettes/DragNDrop_BatWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/vignettes/DragNDrop_BatWindow.png -------------------------------------------------------------------------------- /docs/articles/DragNDrop_BatWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/articles/DragNDrop_BatWindow.png -------------------------------------------------------------------------------- /docs/reference/plot_CountData-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_CountData-1.png -------------------------------------------------------------------------------- /docs/reference/plot_DataOverRT-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_DataOverRT-1.png -------------------------------------------------------------------------------- /docs/reference/plot_IDsOverRT-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_IDsOverRT-1.png -------------------------------------------------------------------------------- /docs/reference/plot_RTPeakWidth-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_RTPeakWidth-1.png -------------------------------------------------------------------------------- /docs/reference/plot_ScanIDRate-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_ScanIDRate-1.png -------------------------------------------------------------------------------- /docs/reference/plot_TopNoverRT-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_TopNoverRT-1.png -------------------------------------------------------------------------------- /docs/reference/plot_peptideMods-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_peptideMods-1.png -------------------------------------------------------------------------------- /docs/reference/qcMetric-class-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/qcMetric-class-1.png -------------------------------------------------------------------------------- /docs/reference/qcMetric-class-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/qcMetric-class-2.png -------------------------------------------------------------------------------- /docs/reference/qcMetric-class-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/qcMetric-class-3.png -------------------------------------------------------------------------------- /docs/reference/qcMetric-class-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/qcMetric-class-4.png -------------------------------------------------------------------------------- /docs/reference/qcMetric-class-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/qcMetric-class-5.png -------------------------------------------------------------------------------- /docs/reference/qcMetric-class-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/qcMetric-class-6.png -------------------------------------------------------------------------------- /inst/reportTemplate/modes_UpSet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/inst/reportTemplate/modes_UpSet.png -------------------------------------------------------------------------------- /docs/reference/peakWidthOverTime-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/peakWidthOverTime-1.png -------------------------------------------------------------------------------- /docs/reference/plot_ContUserScore-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_ContUserScore-1.png -------------------------------------------------------------------------------- /docs/reference/plot_MBRIDtransfer-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_MBRIDtransfer-1.png -------------------------------------------------------------------------------- /inst/examples/example_MBRalignment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/inst/examples/example_MBRalignment.png -------------------------------------------------------------------------------- /docs/reference/plot_CalibratedMSErr-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_CalibratedMSErr-1.png -------------------------------------------------------------------------------- /docs/reference/plot_MS2Oversampling-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_MS2Oversampling-1.png -------------------------------------------------------------------------------- /docs/reference/plot_MissedCleavages-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_MissedCleavages-1.png -------------------------------------------------------------------------------- /docs/reference/plot_UncalibratedMSErr-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_UncalibratedMSErr-1.png -------------------------------------------------------------------------------- /docs/reference/plot_IonInjectionTimeOverRT-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/docs/reference/plot_IonInjectionTimeOverRT-1.png -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | .travis.yml 3 | PTXQC.Rproj 4 | CODE_OF_CONDUCT.md 5 | CONTRIBUTING.md 6 | ^docs/ 7 | ^.*\.Rproj$ 8 | ^\.Rproj\.user$ 9 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(PTXQC) 3 | 4 | ## 5 | ## calls all code in PTXQC/tests/testthat/test*.R 6 | ## 7 | test_check("PTXQC") 8 | -------------------------------------------------------------------------------- /inst/examples/report_v1.1.0__txt_5files_withMatch-100min.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbielow/PTXQC/HEAD/inst/examples/report_v1.1.0__txt_5files_withMatch-100min.pdf -------------------------------------------------------------------------------- /R/pkg_internal.R: -------------------------------------------------------------------------------- 1 | .onAttach = function(libname, pkgname) { 2 | packageStartupMessage(paste0("Loading package PTXQC (version ", utils::packageVersion("PTXQC"), ")")) 3 | } 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2015-2020 2 | COPYRIGHT HOLDER: The PTXQC Team -- Max Delbrueck Centrum Berlin-Buch and Freie Universitaet Berlin 3 | ORGANIZATION: Max Delbrueck Centrum Berlin-Buch and Freie Universitaet Berlin -------------------------------------------------------------------------------- /man/PTXQC.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/PTXQC-package.R 3 | \name{PTXQC} 4 | \alias{PTXQC} 5 | \title{Quality control for proteomics data} 6 | \description{ 7 | Quality control for proteomics data 8 | } 9 | -------------------------------------------------------------------------------- /man/CV.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{CV} 4 | \alias{CV} 5 | \title{Coefficient of variation (CV)} 6 | \usage{ 7 | CV(x) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of numeric values} 11 | } 12 | \value{ 13 | CV 14 | } 15 | \description{ 16 | Computes sd(x) / mean(x) 17 | } 18 | -------------------------------------------------------------------------------- /man/RSD.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{RSD} 4 | \alias{RSD} 5 | \title{Relative standard deviation (RSD)} 6 | \usage{ 7 | RSD(x) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of numeric values} 11 | } 12 | \value{ 13 | RSD 14 | } 15 | \description{ 16 | Simply \code{\link{CV}}*100 17 | } 18 | -------------------------------------------------------------------------------- /tests/testthat/test_modsToTable.R: -------------------------------------------------------------------------------- 1 | context("modstoTable.R") 2 | 3 | test_that("modstoTable", { 4 | r = modsToTable(c("A", "Unmodified", "A,B", "C", "Unmodified", "Unmodified")) 5 | 6 | 7 | exp = data.frame(modification_names = factor(c("A", "B", "C", "Unmodified")), 8 | Freq = c(200/6, 100/6, 100/6, 300/6)) 9 | testthat::expect_equal(r, exp) 10 | }) -------------------------------------------------------------------------------- /man/del0.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{del0} 4 | \alias{del0} 5 | \title{Replace 0 with NA in a vector} 6 | \usage{ 7 | del0(x) 8 | } 9 | \arguments{ 10 | \item{x}{A numeric vector} 11 | } 12 | \value{ 13 | Vector of same size as 'x', with 0's replaced by NA 14 | } 15 | \description{ 16 | Replace 0 with NA in a vector 17 | } 18 | -------------------------------------------------------------------------------- /man/theme_blank.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_miscGGplot.R 3 | \name{theme_blank} 4 | \alias{theme_blank} 5 | \title{A blank theme (similar to the deprecated theme_blank())} 6 | \usage{ 7 | theme_blank() 8 | } 9 | \value{ 10 | A ggplot2 object, representing an empty theme 11 | } 12 | \description{ 13 | A blank theme (similar to the deprecated theme_blank()) 14 | } 15 | -------------------------------------------------------------------------------- /man/qcMetric_MSMSScans_TopNoverRT-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/qcMetric_MSMSScans.R 3 | \docType{class} 4 | \name{qcMetric_MSMSScans_TopNoverRT-class} 5 | \alias{qcMetric_MSMSScans_TopNoverRT-class} 6 | \alias{qcMetric_MSMSScans_TopNoverRT} 7 | \title{Metric for msmsscans.txt, showing TopN over RT.} 8 | \description{ 9 | Metric for msmsscans.txt, showing TopN over RT. 10 | } 11 | 12 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: '3.4' 2 | pkgdown: 2.1.2 3 | pkgdown_sha: ~ 4 | articles: 5 | PTXQC-Basic_Guide_for_R_users: PTXQC-Basic_Guide_for_R_users.html 6 | PTXQC-CustomizeReport: PTXQC-CustomizeReport.html 7 | PTXQC-DragNDrop: PTXQC-DragNDrop.html 8 | PTXQC-FAQ: PTXQC-FAQ.html 9 | PTXQC-Input_And_Output_Data: PTXQC-Input_And_Output_Data.html 10 | PTXQC-ListOfMetrics: PTXQC-ListOfMetrics.html 11 | last_built: 2025-07-15T08:43Z 12 | -------------------------------------------------------------------------------- /man/lcpCount.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{lcpCount} 4 | \alias{lcpCount} 5 | \title{Count the number of chars of the longest common prefix} 6 | \usage{ 7 | lcpCount(x) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of strings with common prefix} 11 | } 12 | \value{ 13 | Length of LCP 14 | } 15 | \description{ 16 | Count the number of chars of the longest common prefix 17 | } 18 | -------------------------------------------------------------------------------- /man/lcsCount.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{lcsCount} 4 | \alias{lcsCount} 5 | \title{Count the number of chars of the longest common suffix} 6 | \usage{ 7 | lcsCount(x) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of strings with common suffix} 11 | } 12 | \value{ 13 | Length of LCS 14 | } 15 | \description{ 16 | Count the number of chars of the longest common suffix 17 | } 18 | -------------------------------------------------------------------------------- /man/pastet.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{pastet} 4 | \alias{pastet} 5 | \title{paste with tab as separator} 6 | \usage{ 7 | pastet(...) 8 | } 9 | \arguments{ 10 | \item{...}{Arguments forwarded to paste()} 11 | } 12 | \value{ 13 | return value of paste() 14 | } 15 | \description{ 16 | paste with tab as separator 17 | } 18 | \examples{ 19 | pastet("tab","separated") 20 | ## --> "tab\tseparated" 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/grapes-plus-grapes.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{\%+\%} 4 | \alias{\%+\%} 5 | \title{A string concatenation function, more readable than 'paste()'.} 6 | \usage{ 7 | a \%+\% b 8 | } 9 | \arguments{ 10 | \item{a}{Char vector} 11 | 12 | \item{b}{Char vector} 13 | } 14 | \value{ 15 | Concatenated string (no separator) 16 | } 17 | \description{ 18 | A string concatenation function, more readable than 'paste()'. 19 | } 20 | -------------------------------------------------------------------------------- /man/pasten.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{pasten} 4 | \alias{pasten} 5 | \title{paste with newline as separator} 6 | \usage{ 7 | pasten(...) 8 | } 9 | \arguments{ 10 | \item{...}{Arguments forwarded to paste()} 11 | } 12 | \value{ 13 | return value of paste() 14 | } 15 | \description{ 16 | paste with newline as separator 17 | } 18 | \examples{ 19 | pasten("newline","separated") 20 | ## --> "newline\nseparated" 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/LCS.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{LCS} 4 | \alias{LCS} 5 | \title{Compute longest common substring of two strings.} 6 | \usage{ 7 | LCS(s1, s2) 8 | } 9 | \arguments{ 10 | \item{s1}{String one} 11 | 12 | \item{s2}{String two} 13 | } 14 | \value{ 15 | String containing the longest common substring 16 | } 17 | \description{ 18 | Implementation is very inefficient (dynamic programming in R) 19 | --> use only on small instances 20 | } 21 | -------------------------------------------------------------------------------- /man/getMetricsObjects.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{getMetricsObjects} 4 | \alias{getMetricsObjects} 5 | \title{Get all currently available metrics} 6 | \usage{ 7 | getMetricsObjects(DEBUG_PTXQC = FALSE) 8 | } 9 | \arguments{ 10 | \item{DEBUG_PTXQC}{Use qc objects from the package (FALSE) or from environment (TRUE/DEBUG)} 11 | } 12 | \value{ 13 | List of matric objects 14 | } 15 | \description{ 16 | Get all currently available metrics 17 | } 18 | -------------------------------------------------------------------------------- /man/ggText.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_miscGGplot.R 3 | \name{ggText} 4 | \alias{ggText} 5 | \title{Plot a text as graphic using ggplot2.} 6 | \usage{ 7 | ggText(title, text, col = "black") 8 | } 9 | \arguments{ 10 | \item{title}{The title of the plot} 11 | 12 | \item{text}{Centered text, can contain linebreaks} 13 | 14 | \item{col}{Colour of text (excluding the title)} 15 | } 16 | \value{ 17 | ggplot object 18 | } 19 | \description{ 20 | Plot a text as graphic using ggplot2. 21 | } 22 | -------------------------------------------------------------------------------- /man/scale01linear.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_qualities.R 3 | \name{scale01linear} 4 | \alias{scale01linear} 5 | \title{Scales a vector of values linearly to [0, 1] 6 | If all input values are equal, returned values are all 0} 7 | \usage{ 8 | scale01linear(X) 9 | } 10 | \arguments{ 11 | \item{X}{Vector of values} 12 | } 13 | \value{ 14 | Scaled vector 15 | } 16 | \description{ 17 | Scales a vector of values linearly to [0, 1] 18 | If all input values are equal, returned values are all 0 19 | } 20 | -------------------------------------------------------------------------------- /man/print.PTXQC_table.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{print.PTXQC_table} 4 | \alias{print.PTXQC_table} 5 | \title{helper S3 class, enabling print(some-plot_Table-object)} 6 | \usage{ 7 | \method{print}{PTXQC_table}(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{Some Grid object to plot} 11 | 12 | \item{...}{Further arguments (not used, but required for consistency with other print methods)} 13 | } 14 | \description{ 15 | helper S3 class, enabling print(some-plot_Table-object) 16 | } 17 | -------------------------------------------------------------------------------- /man/repEach.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{repEach} 4 | \alias{repEach} 5 | \title{Repeat each element x_i in X, n_i times.} 6 | \usage{ 7 | repEach(x, n) 8 | } 9 | \arguments{ 10 | \item{x}{Values to be repeated} 11 | 12 | \item{n}{Number of repeat for each x_i (same length as x)} 13 | } 14 | \value{ 15 | Vector with values from x, n times 16 | } 17 | \description{ 18 | Repeat each element x_i in X, n_i times. 19 | } 20 | \examples{ 21 | 22 | repEach(1:3, 1:3) ## 1, 2, 2, 3, 3, 3 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/darken.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{darken} 4 | \alias{darken} 5 | \title{Make a color (given as name or in RGB) darker by factor x = [0 = black, 1=unchanged]} 6 | \usage{ 7 | darken(color, factor = 0.8) 8 | } 9 | \arguments{ 10 | \item{color}{A color as understood by col2rgb} 11 | 12 | \item{factor}{Between 0 (make black) and 1 (leave color as is)} 13 | } 14 | \value{ 15 | darkened color 16 | } 17 | \description{ 18 | Make a color (given as name or in RGB) darker by factor x = [0 = black, 1=unchanged] 19 | } 20 | -------------------------------------------------------------------------------- /man/getFileEncoding.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/MQDataReader.R 3 | \name{getFileEncoding} 4 | \alias{getFileEncoding} 5 | \title{Determine if a file is 'UTF-8' or 'UTF-8-BOM' (as of MQ2.4) or 'UTF-16BE' or 'UTF-16LE'} 6 | \usage{ 7 | getFileEncoding(filename) 8 | } 9 | \arguments{ 10 | \item{filename}{Relative or absolute path to a file} 11 | } 12 | \value{ 13 | '' if the file does not exist or is not readable 14 | } 15 | \description{ 16 | Determine if a file is 'UTF-8' or 'UTF-8-BOM' (as of MQ2.4) or 'UTF-16BE' or 'UTF-16LE' 17 | } 18 | -------------------------------------------------------------------------------- /man/getMetaData.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_QCHeat.R 3 | \name{getMetaData} 4 | \alias{getMetaData} 5 | \title{Extract meta information (orderNr, metric name, category) 6 | from a list of Qc metric objects} 7 | \usage{ 8 | getMetaData(lst_qcMetrics) 9 | } 10 | \arguments{ 11 | \item{lst_qcMetrics}{List of qcMetrics} 12 | } 13 | \value{ 14 | data.frame with columns 'name', 'order' and 'cat' (category) 15 | } 16 | \description{ 17 | Extract meta information (orderNr, metric name, category) 18 | from a list of Qc metric objects 19 | } 20 | -------------------------------------------------------------------------------- /man/printWithFooter.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_miscGGplot.R 3 | \name{printWithFooter} 4 | \alias{printWithFooter} 5 | \title{Augment a ggplot with footer text} 6 | \usage{ 7 | printWithFooter(gg_obj, bottom_left = NULL, bottom_right = NULL) 8 | } 9 | \arguments{ 10 | \item{gg_obj}{ggplot2 object to be printed} 11 | 12 | \item{bottom_left}{Footer text for bottom left side} 13 | 14 | \item{bottom_right}{Footer text for bottom right side} 15 | } 16 | \value{ 17 | - 18 | } 19 | \description{ 20 | Augment a ggplot with footer text 21 | } 22 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite package 'PTXQC' in publications use:") 2 | 3 | bibentry(bibtype = "Article", 4 | journal = "Journal of Proteome Research", 5 | title = "Proteomics Quality Control: Quality Control Software for MaxQuant Results", 6 | author = c(person("Chris", "Bielow"), 7 | person("Guido", "Mastrobuoni"), 8 | person("Stefan", "Kempa")), 9 | volume = "15 (3)", 10 | pages = "77-787", 11 | year = "2016", 12 | doi = "10.1021/acs.jproteome.5b00780", 13 | url = "https://github.com/cbielow/PTXQC") 14 | 15 | -------------------------------------------------------------------------------- /PTXQC.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | StripTrailingWhitespace: Yes 16 | LineEndingConversion: Posix 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageCheckArgs: manual = TRUE, cran = TRUE, remote = TRUE, incoming = TRUE, 22 | PackageRoxygenize: rd,collate,namespace 23 | -------------------------------------------------------------------------------- /man/plot_ContsPG.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_ContsPG} 4 | \alias{plot_ContsPG} 5 | \title{Plot contaminants from proteinGroups.txt} 6 | \usage{ 7 | plot_ContsPG(data) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'group', 'cont_pc', 'logAbdClass'} 11 | } 12 | \value{ 13 | GGplot object 14 | } 15 | \description{ 16 | Plot contaminants from proteinGroups.txt 17 | } 18 | \examples{ 19 | 20 | data = data.frame( 'group' = letters[1:10], 'cont_pc' = 2:11, 'logAbdClass' = c("low","high")) 21 | plot_ContsPG(data) 22 | 23 | } 24 | -------------------------------------------------------------------------------- /man/renameFile.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{renameFile} 4 | \alias{renameFile} 5 | \title{Given a vector of (short/long) filenames, translate to the (long/short) version} 6 | \usage{ 7 | renameFile(f_names, mapping) 8 | } 9 | \arguments{ 10 | \item{f_names}{Vector of filenames} 11 | 12 | \item{mapping}{A data.frame with from,to columns} 13 | } 14 | \value{ 15 | A vector of translated file names as factor (ordered by mapping!) 16 | } 17 | \description{ 18 | Given a vector of (short/long) filenames, translate to the (long/short) version 19 | } 20 | -------------------------------------------------------------------------------- /man/brewer.pal.Safe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_miscGGplot.R 3 | \name{brewer.pal.Safe} 4 | \alias{brewer.pal.Safe} 5 | \title{Return color brew palettes, but fail hard if number of requested colors 6 | is larger than the palette is holding.} 7 | \usage{ 8 | brewer.pal.Safe(n = 3, palette = "Set1") 9 | } 10 | \arguments{ 11 | \item{n}{Number of colours} 12 | 13 | \item{palette}{Name of palette (e.g. "set1")} 14 | } 15 | \value{ 16 | character vector of colors 17 | } 18 | \description{ 19 | Internally calls 'brewer.pal(n, palette)', checking 'n' beforehand. 20 | } 21 | -------------------------------------------------------------------------------- /man/flattenList.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/qcMetric.R 3 | \name{flattenList} 4 | \alias{flattenList} 5 | \title{Flatten lists of lists with irregular depths to just a list of items, 6 | i.e. a list of the leaves (if you consider the input as a tree).} 7 | \usage{ 8 | flattenList(x) 9 | } 10 | \arguments{ 11 | \item{x}{List of 'stuff' (could be lists or items or a mix)} 12 | } 13 | \value{ 14 | A flat list 15 | } 16 | \description{ 17 | Flatten lists of lists with irregular depths to just a list of items, 18 | i.e. a list of the leaves (if you consider the input as a tree). 19 | } 20 | -------------------------------------------------------------------------------- /man/getECDF.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{getECDF} 4 | \alias{getECDF} 5 | \title{Estimate the empirical density and return it} 6 | \usage{ 7 | getECDF(samples, y_eval = (1:100)/100) 8 | } 9 | \arguments{ 10 | \item{samples}{Vector of input values (samples from the distribution)} 11 | 12 | \item{y_eval}{Vector of points where CDF is evaluated (each percentile by default)} 13 | } 14 | \value{ 15 | Data.frame with columns 'x', 'y' 16 | } 17 | \description{ 18 | Estimate the empirical density and return it 19 | } 20 | \examples{ 21 | plot(getECDF(rnorm(1e4))) 22 | 23 | } 24 | -------------------------------------------------------------------------------- /man/plotTableRaw.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plotTableRaw} 4 | \alias{plotTableRaw} 5 | \title{Colored table plot.} 6 | \usage{ 7 | plotTableRaw(data, colours = "black", fill = NA, just = "centre") 8 | } 9 | \arguments{ 10 | \item{data}{Table as Data.frame} 11 | 12 | \item{colours}{Single or set of colours (col-wise)} 13 | 14 | \item{fill}{Cell fill (row-wise)} 15 | 16 | \item{just}{(ignored)} 17 | } 18 | \value{ 19 | gTable 20 | } 21 | \description{ 22 | Code taken from http://stackoverflow.com/questions/23819209/change-text-color-for-cells-using-tablegrob-in-r 23 | } 24 | -------------------------------------------------------------------------------- /man/qualMedianDist.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_qualities.R 3 | \name{qualMedianDist} 4 | \alias{qualMedianDist} 5 | \title{Quality metric which measures the absolute distance from median.} 6 | \usage{ 7 | qualMedianDist(x) 8 | } 9 | \arguments{ 10 | \item{x}{A vector numeric values between [0,1]} 11 | } 12 | \value{ 13 | A vector of the same size as x, with quality values between [0, 1] 14 | } 15 | \description{ 16 | Ranges between 0 (worst score) and 1 (best score). 17 | Input must be between [0,1]. 18 | Deviations from the median of the sample represent the score for each sample point. 19 | } 20 | -------------------------------------------------------------------------------- /man/scale_x_discrete_reverse.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_miscGGplot.R 3 | \name{scale_x_discrete_reverse} 4 | \alias{scale_x_discrete_reverse} 5 | \title{Inverse the order of items on the x-axis (for discrete scales)} 6 | \usage{ 7 | scale_x_discrete_reverse(values, ...) 8 | } 9 | \arguments{ 10 | \item{values}{The vector of values as given to the x aestetic} 11 | 12 | \item{...}{Other arguments forwarded to 'scale_y_discrete()'} 13 | } 14 | \value{ 15 | ggplot object, concatenatable with '+' 16 | } 17 | \description{ 18 | Inverse the order of items on the x-axis (for discrete scales) 19 | } 20 | -------------------------------------------------------------------------------- /man/scale_y_discrete_reverse.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_miscGGplot.R 3 | \name{scale_y_discrete_reverse} 4 | \alias{scale_y_discrete_reverse} 5 | \title{Inverse the order of items on the y-axis (for discrete scales)} 6 | \usage{ 7 | scale_y_discrete_reverse(values, ...) 8 | } 9 | \arguments{ 10 | \item{values}{The vector of values as given to the y aestetic} 11 | 12 | \item{...}{Other arguments forwarded to 'scale_y_discrete()'} 13 | } 14 | \value{ 15 | ggplot object, concatenatable with '+' 16 | } 17 | \description{ 18 | Inverse the order of items on the y-axis (for discrete scales) 19 | } 20 | -------------------------------------------------------------------------------- /man/grepv.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{grepv} 4 | \alias{grepv} 5 | \title{Grep with values returned instead of indices.} 6 | \usage{ 7 | grepv(reg, data, ...) 8 | } 9 | \arguments{ 10 | \item{reg}{regex param} 11 | 12 | \item{data}{container} 13 | 14 | \item{...}{other params forwarded to grep()} 15 | } 16 | \value{ 17 | values of data which matched the regex 18 | } 19 | \description{ 20 | The parameter 'value' should not be passed to this function since it is 21 | passed internally already. 22 | } 23 | \examples{ 24 | grepv("x", c("abc", "xyz")) 25 | ## --> "xyz" 26 | 27 | } 28 | -------------------------------------------------------------------------------- /man/qualGaussDev.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_qualities.R 3 | \name{qualGaussDev} 4 | \alias{qualGaussDev} 5 | \title{Compute probability of Gaussian (mu=m, sd=s) at a position 0, with reference 6 | to the max obtainable probability of that Gaussian at its center.} 7 | \usage{ 8 | qualGaussDev(mu, sd) 9 | } 10 | \arguments{ 11 | \item{mu}{Center of Gaussian} 12 | 13 | \item{sd}{SD of Gaussian} 14 | } 15 | \value{ 16 | quality, ranging from 0 (bad agreement) to 1 (perfect, i.e. centered at 0) 17 | } 18 | \description{ 19 | Measure for centeredness around 0. 20 | Highest score is 1, worst score is 0. 21 | } 22 | -------------------------------------------------------------------------------- /man/plot_TopN.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_TopN} 4 | \alias{plot_TopN} 5 | \title{Plot line graph of TopN over Retention time.} 6 | \usage{ 7 | plot_TopN(data) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'scan.event.number', 'n'} 11 | } 12 | \value{ 13 | GGplot object 14 | } 15 | \description{ 16 | Number of Raw files must be 6 at most. Function will stop otherwise. 17 | } 18 | \examples{ 19 | data = data.frame(fc.raw.file = rep(c("d","a","x"), each=10), 20 | scan.event.number = 1:10, 21 | n = 11:20) 22 | plot_TopN(data) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/delLCS.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{delLCS} 4 | \alias{delLCS} 5 | \title{Removes the longest common suffix (LCS) from a vector of strings.} 6 | \usage{ 7 | delLCS(x) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of strings with common suffix} 11 | } 12 | \value{ 13 | Shortened vector of strings 14 | } 15 | \description{ 16 | Removes the longest common suffix (LCS) from a vector of strings. 17 | } 18 | \examples{ 19 | delLCS(c("TK12345_H1")) ## "" 20 | delLCS(c("TK12345_H1", "TK12345_H2")) ## "TK12345_H1" "TK12345_H2" 21 | delLCS(c("TK12345_H1", "TK12!45_H1")) ## "TK123" "TK12!" 22 | 23 | } 24 | -------------------------------------------------------------------------------- /man/getRunQualityTemplate.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mzQC.R 3 | \name{getRunQualityTemplate} 4 | \alias{getRunQualityTemplate} 5 | \title{Get an mzQC runQuality without actual metrics, but with full metadata} 6 | \usage{ 7 | getRunQualityTemplate(fc.raw.file, raw_file_mapping) 8 | } 9 | \arguments{ 10 | \item{fc.raw.file}{For which run} 11 | 12 | \item{raw_file_mapping}{A data.frame with cols 'from', 'to' and maybe 'best.effort' (if shorting was unsuccessful), as e.g. obtained by a FilenameMapper$raw_file_mapping} 13 | } 14 | \value{ 15 | An MzQCrunQuality object 16 | } 17 | \description{ 18 | Get an mzQC runQuality without actual metrics, but with full metadata 19 | } 20 | -------------------------------------------------------------------------------- /man/qualLinThresh.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_qualities.R 3 | \name{qualLinThresh} 4 | \alias{qualLinThresh} 5 | \title{Quality metric with linear response to input, reaching the maximum score at the given threshold.} 6 | \usage{ 7 | qualLinThresh(x, t = 1) 8 | } 9 | \arguments{ 10 | \item{x}{Numeric value(s) between [0, inf]} 11 | 12 | \item{t}{Threshold value, which indicates 100\%} 13 | } 14 | \value{ 15 | Value between [0, 1] 16 | } 17 | \description{ 18 | Ranges between 0 (worst score) and 1 (best score). 19 | Useful for performance measures where reaching a certain reference threshold 't' 20 | will be enough to reach 100\%. 21 | The input range from [0, t] is scored from 0-100\%. 22 | } 23 | -------------------------------------------------------------------------------- /man/pointsPutX.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_miscGGplot.R 3 | \name{pointsPutX} 4 | \alias{pointsPutX} 5 | \title{Distribute a set of points with fixed y-values on a stretch of the x-axis.} 6 | \usage{ 7 | pointsPutX(x_range, x_section, y, col = NA) 8 | } 9 | \arguments{ 10 | \item{x_range}{[min,max] valid range of x-values} 11 | 12 | \item{x_section}{[min,max] fraction in which to distribute the values (in [0,1] for min,max, e.g. c(0.03,0.08) for 3-8\%)} 13 | 14 | \item{y}{Y-values} 15 | 16 | \item{col}{Colour of the points (used as argument to aes(colour=))} 17 | } 18 | \value{ 19 | ggplot object with new geom_point 20 | } 21 | \description{ 22 | #' 23 | Usage: 24 | ggplot(...) + geom_X(...) + pointsPutX(...) 25 | } 26 | -------------------------------------------------------------------------------- /man/getHTMLTable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{getHTMLTable} 4 | \alias{getHTMLTable} 5 | \title{Create an HTML table with an extra header row} 6 | \usage{ 7 | getHTMLTable(data, caption = NA) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame which serves as table} 11 | 12 | \item{caption}{A set of headlines, e.g. c("top line", "bottom line")} 13 | } 14 | \value{ 15 | table as html character string for cat()'ing into an html document 16 | } 17 | \description{ 18 | Create an HTML table with an extra header row 19 | } 20 | \examples{ 21 | data = data.frame(raw.file = letters[1:4], 22 | id.rate = 3:6) 23 | getHTMLTable(data, 24 | caption = "some header line") 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/longestCommonSuffix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{longestCommonSuffix} 4 | \alias{longestCommonSuffix} 5 | \title{Like longestCommonPrefix(), but on the suffix.} 6 | \usage{ 7 | longestCommonSuffix(strings) 8 | } 9 | \arguments{ 10 | \item{strings}{Vector of strings} 11 | } 12 | \value{ 13 | Single string - might be empty ("") 14 | } 15 | \description{ 16 | Like longestCommonPrefix(), but on the suffix. 17 | } 18 | \examples{ 19 | 20 | longestCommonSuffix(c("123.ABC", "45677.ABC", "BC")) ## "BC" 21 | longestCommonSuffix(c("123.ABC", "", "BC")) ## "" 22 | longestCommonSuffix(c("123.ABC", "45677.ABC")) ## ".ABC" 23 | longestCommonSuffix(c("nothing", "in", "common")) ## "" 24 | 25 | } 26 | -------------------------------------------------------------------------------- /man/checkEnglishLocale.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{checkEnglishLocale} 4 | \alias{checkEnglishLocale} 5 | \title{When MaxQuant is run with a wrong locale (i.e. the decimal separator is not a '.', but a ','), 6 | then MaxQuant results are plainly wrong and broken. The can be detected by, e.g. checking for negative charge annotation} 7 | \usage{ 8 | checkEnglishLocale(df_evd) 9 | } 10 | \arguments{ 11 | \item{df_evd}{Evidence table from which we only need the 'charge' column} 12 | } 13 | \description{ 14 | When MaxQuant is run with a wrong locale (i.e. the decimal separator is not a '.', but a ','), 15 | then MaxQuant results are plainly wrong and broken. The can be detected by, e.g. checking for negative charge annotation 16 | } 17 | -------------------------------------------------------------------------------- /man/longestCommonPrefix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{longestCommonPrefix} 4 | \alias{longestCommonPrefix} 5 | \title{Get the longest common prefix from a set of strings.} 6 | \usage{ 7 | longestCommonPrefix(strings) 8 | } 9 | \arguments{ 10 | \item{strings}{Vector of strings} 11 | } 12 | \value{ 13 | Single string - might be empty ("") 14 | } 15 | \description{ 16 | Input is converted to character (e.g. from factor) first. 17 | } 18 | \examples{ 19 | longestCommonPrefix(c("CBA.321", "CBA.77654", "")) ## "" 20 | longestCommonPrefix(c("CBA.321", "CBA.77654", "CB")) ## "CB" 21 | longestCommonPrefix(c("ABC.123", "ABC.456")) ## "ABC." 22 | longestCommonPrefix(c("nothing", "in", "common")) ## "" 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /man/thinOut.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{thinOut} 4 | \alias{thinOut} 5 | \title{Thin out a data.frame by removing rows with similar numerical values in a certain column.} 6 | \usage{ 7 | thinOut(data, filterColname, binsize) 8 | } 9 | \arguments{ 10 | \item{data}{The data.frame to be filtered} 11 | 12 | \item{filterColname}{Name of the filter column as string} 13 | 14 | \item{binsize}{Width of a bin} 15 | } 16 | \value{ 17 | Data.frame with reduced rows, but identical input columns 18 | } 19 | \description{ 20 | All values in the numerical column 'filterColname' are assigned to bins of width 'binsize'. 21 | Only one value per bin is retained. All other rows are removed and the reduced 22 | data frame will all its columns is returned. 23 | } 24 | -------------------------------------------------------------------------------- /man/modsToTable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/modsToTable.R 3 | \name{modsToTable} 4 | \alias{modsToTable} 5 | \title{Convert list of (mixed)modifications to a frequency table} 6 | \usage{ 7 | modsToTable(mod_list) 8 | } 9 | \arguments{ 10 | \item{mod_list}{A vector with modifications, each for a specific peptide. Multiple mods per entry are allowed, each separated by comma.} 11 | } 12 | \value{ 13 | A data.frame with 'modification_names' and 'Freq' (0-100) 14 | } 15 | \description{ 16 | Convert list of (mixed)modifications to a frequency table 17 | } 18 | \examples{ 19 | modsToTable(c("Ox (M)", 20 | "Unmodified", 21 | "Ox (M),Acetyl (Prot N-term)", 22 | "2 Ox (M)", 23 | "Unmodified", 24 | "Unmodified")) 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /man/plot_MS2Oversampling.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_MS2Oversampling} 4 | \alias{plot_MS2Oversampling} 5 | \title{Plot bargraph of oversampled 3D-peaks.} 6 | \usage{ 7 | plot_MS2Oversampling(data) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'n', 'fraction'} 11 | } 12 | \value{ 13 | GGplot object 14 | } 15 | \description{ 16 | Per Raw file, at most three n's must be given, i.e. 17 | the fraction of 3D-peaks for n=1, n=2 and n=3(or more). 18 | The fractions must sum to 1 (=100%). 19 | } 20 | \examples{ 21 | data = data.frame(fc.raw.file = rep(letters[1:3], each=3), 22 | n = 1:3, 23 | fraction = c(0.8, 0.1, 0.1, 0.6, 0.3, 0.1, 0.7, 0.25, 0.05)) 24 | plot_MS2Oversampling(data) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/getPeptideCounts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{getPeptideCounts} 4 | \alias{getPeptideCounts} 5 | \title{Extract the number of peptides observed per Raw file 6 | from an evidence table.} 7 | \usage{ 8 | getPeptideCounts(df_evd) 9 | } 10 | \arguments{ 11 | \item{df_evd}{Data.frame of evidence.txt as read by MQDataReader} 12 | } 13 | \value{ 14 | Data.frame with columns 'fc.raw.file', 'counts', 'category', 'MBRgain' 15 | } 16 | \description{ 17 | Required columns are "fc.raw.file", "modified.sequence" and "is.transferred". 18 | } 19 | \details{ 20 | If match-between-runs was enabled during the MaxQuant run, 21 | the data.frame returned will contain separate values for 'transferred' evidence 22 | plus an 'MBRgain' column, which will give the extra MBR evidence in percent. 23 | } 24 | -------------------------------------------------------------------------------- /man/plot_ScanIDRate.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_ScanIDRate} 4 | \alias{plot_ScanIDRate} 5 | \title{Plot line graph of TopN over Retention time.} 6 | \usage{ 7 | plot_ScanIDRate(data) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'scan.event.number', 'ratio', 'count'} 11 | } 12 | \value{ 13 | GGplot object 14 | } 15 | \description{ 16 | Number of Raw files must be 6 at most. Function will stop otherwise. 17 | } 18 | \examples{ 19 | data = data.frame(fc.raw.file = factor(rep(c("d","a","x"), each=10), levels = c("d","a","x")), 20 | scan.event.number = 1:10, 21 | ratio = seq(40, 20, length.out=10), 22 | count = seq(400, 200, length.out=10)) 23 | plot_ScanIDRate(data) 24 | 25 | } 26 | -------------------------------------------------------------------------------- /man/thinOutBatch.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{thinOutBatch} 4 | \alias{thinOutBatch} 5 | \title{Apply 'thinOut' on all subsets of a data.frame, split by a batch column} 6 | \usage{ 7 | thinOutBatch(data, filterColname, batchColname, binCount = 1000) 8 | } 9 | \arguments{ 10 | \item{data}{The data.frame to be split and filtered(thinned)} 11 | 12 | \item{filterColname}{Name of the filter column as string} 13 | 14 | \item{batchColname}{Name of the split column as string} 15 | 16 | \item{binCount}{Number of bins in the 'filterColname' dimension.} 17 | } 18 | \value{ 19 | Data.frame with reduced rows, but identical input columns 20 | } 21 | \description{ 22 | The binsize is computed from the global data range of the filter column by dividing the range 23 | into binCount bins. 24 | } 25 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /man/getProteinCounts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{getProteinCounts} 4 | \alias{getProteinCounts} 5 | \title{Extract the number of protein groups observed per Raw file 6 | from an evidence table.} 7 | \usage{ 8 | getProteinCounts(df_evd) 9 | } 10 | \arguments{ 11 | \item{df_evd}{Data.frame of evidence.txt as read by MQDataReader} 12 | } 13 | \value{ 14 | Data.frame with columns 'fc.raw.file', 'counts', 'category', 'MBRgain' 15 | } 16 | \description{ 17 | Required columns are "protein.group.ids", "fc.raw.file" and "is.transferred". 18 | } 19 | \details{ 20 | If match-between-runs was enabled during the MaxQuant run, 21 | the data.frame returned will contain separate values for 'transferred' evidence 22 | plus an 'MBRgain' column, which will give the extra MBR evidence in percent. 23 | } 24 | -------------------------------------------------------------------------------- /man/ScoreInAlignWindow.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQalign.R 3 | \name{ScoreInAlignWindow} 4 | \alias{ScoreInAlignWindow} 5 | \title{Compute the fraction of features per Raw file which have an acceptable RT difference after alignment} 6 | \usage{ 7 | ScoreInAlignWindow(data, allowed.deltaRT = 1) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'rtdiff' and 'raw.file'} 11 | 12 | \item{allowed.deltaRT}{The allowed matching difference (1 minute by default)} 13 | } 14 | \value{ 15 | A data.frame with one row for each raw.file and columns 'raw.file' and 'withinRT' (0-1) 16 | } 17 | \description{ 18 | Using the result from 'alignmentCheck()', score the features of every Raw file and see if they 19 | have been properly aligned. 20 | Returned value is between 0 (bad) and 1 (all aligned). 21 | } 22 | -------------------------------------------------------------------------------- /man/computeMatchRTFractions.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQalign.R 3 | \name{computeMatchRTFractions} 4 | \alias{computeMatchRTFractions} 5 | \title{Combine several data structs into a final picture for segmentation incurred by 'Match-between-runs'.} 6 | \usage{ 7 | computeMatchRTFractions(qMBR, qMBRSeg_Dist_inGroup) 8 | } 9 | \arguments{ 10 | \item{qMBR}{A data.frame as computed by peakSegmentation()} 11 | 12 | \item{qMBRSeg_Dist_inGroup}{A data.frame as computed by inMatchWindow()} 13 | } 14 | \value{ 15 | A data.frame which details the distribution of singlets and pairs (inRT and outRT) for each Raw file and genuine vs. all 16 | } 17 | \description{ 18 | qMBRSeg_Dist_inGroup might be empty if there are only singlets (transferred and genuine), but then the scores will be pretty 19 | boring as well (100%). 20 | } 21 | -------------------------------------------------------------------------------- /man/plot_TIC.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_TIC} 4 | \alias{plot_TIC} 5 | \title{Plot Total Ion Count over time} 6 | \usage{ 7 | plot_TIC(data, x_lim, y_lim) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'RT', 'intensity'} 11 | 12 | \item{x_lim}{Plot range of x-axis} 13 | 14 | \item{y_lim}{Plot range of y-axis} 15 | } 16 | \value{ 17 | GGplot object 18 | } 19 | \description{ 20 | The input is a data.frame with already averaged counts over binned RT-slices. 21 | } 22 | \examples{ 23 | 24 | data = data.frame(fc.raw.file = rep(c("file A", "file B", "file C"), each=81), 25 | RT = c(20:100), 26 | intensity = c(rnorm(81, mean=20), rnorm(81, mean=10), rnorm(81, mean=30))) 27 | plot_TIC(data, c(10, 100), c(0, 40)) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /man/plot_MS2Decal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_MS2Decal} 4 | \alias{plot_MS2Decal} 5 | \title{Plot bargraph of oversampled 3D-peaks.} 6 | \usage{ 7 | plot_MS2Decal(data) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'file', 'msErr', 'type'} 11 | } 12 | \value{ 13 | GGplot object 14 | } 15 | \description{ 16 | Per Raw file, at most three n's must be given, i.e. 17 | the fraction of 3D-peaks for n=1, n=2 and n=3(or more). 18 | The fractions must sum to 1 (=100%). 19 | } 20 | \examples{ 21 | n = c(100, 130, 50) 22 | data = data.frame(file = repEach(paste(letters[1:3],"\nLTQ [Da]"), n), 23 | msErr = c(rnorm(n[1], 0.5), rnorm(n[2], 0.0), rnorm(n[3], -0.5)), 24 | type = c("forward", "decoy")[1+(runif(sum(n))>0.95)]) 25 | plot_MS2Decal(data) 26 | 27 | } 28 | -------------------------------------------------------------------------------- /R/modsToTable.R: -------------------------------------------------------------------------------- 1 | #' 2 | #' Convert list of (mixed)modifications to a frequency table 3 | #' 4 | #' @param mod_list A vector with modifications, each for a specific peptide. Multiple mods per entry are allowed, each separated by comma. 5 | #' @return A data.frame with 'modification_names' and 'Freq' (0-100) 6 | #' 7 | #' @export 8 | #' 9 | #' @examples 10 | #' modsToTable(c("Ox (M)", 11 | #' "Unmodified", 12 | #' "Ox (M),Acetyl (Prot N-term)", 13 | #' "2 Ox (M)", 14 | #' "Unmodified", 15 | #' "Unmodified")) 16 | #' 17 | #' 18 | modsToTable = function(mod_list) 19 | { 20 | modification_names = unlist(strsplit(mod_list, ",", fixed=TRUE)) 21 | tt = data.frame(table(modification_names) / length(mod_list) * 100) 22 | if (! ("modification_names" %in% colnames(tt))) stop("table has wrong column names!") 23 | return(tt) 24 | } 25 | -------------------------------------------------------------------------------- /man/appendEnv.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{appendEnv} 4 | \alias{appendEnv} 5 | \title{Add the value of a variable to an environment (fast append)} 6 | \usage{ 7 | appendEnv(env_name, v, v_name = NULL) 8 | } 9 | \arguments{ 10 | \item{env_name}{String of the environment variable} 11 | 12 | \item{v}{Value to be inserted} 13 | 14 | \item{v_name}{String used as variable name. Automatically generated if omitted.} 15 | } 16 | \value{ 17 | Always TRUE 18 | } 19 | \description{ 20 | The environment must exist, and its name must be given as string literal in 'env_name'! 21 | The value of the variable 'v' will be stored under the name given in 'v_name'. 22 | If 'v_name' is not given, a variable name will be created by increasing an internal counter 23 | and using the its value padded with zeros as name (i.e., "0001", "0002" etc). 24 | } 25 | -------------------------------------------------------------------------------- /man/plot_TopNoverRT.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_TopNoverRT} 4 | \alias{plot_TopNoverRT} 5 | \title{Plot line graph of TopN over Retention time.} 6 | \usage{ 7 | plot_TopNoverRT(data) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'rRT', 'topN'} 11 | } 12 | \value{ 13 | GGplot object 14 | } 15 | \description{ 16 | Number of Raw files must be 6 at most. Function will stop otherwise. 17 | } 18 | \examples{ 19 | data = data.frame(fc.raw.file = rep(letters[1:3], each=100), 20 | rRT = seq(20, 120, length.out = 100), 21 | topN = c(round(runif(100, min=3, max=5)), 22 | round(runif(100, min=5, max=8)), 23 | round(runif(100, min=1, max=3))) 24 | ) 25 | plot_TopNoverRT(data) 26 | 27 | } 28 | -------------------------------------------------------------------------------- /man/plot_IDsOverRT.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_IDsOverRT} 4 | \alias{plot_IDsOverRT} 5 | \title{Plot IDs over time for each Raw file.} 6 | \usage{ 7 | plot_IDsOverRT(data, x_lim = range(data$RT), y_max = max(data$counts)) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns as described above} 11 | 12 | \item{x_lim}{Limits of the x-axis (2-tuple)} 13 | 14 | \item{y_max}{Maximum of the y-axis (single value)} 15 | } 16 | \value{ 17 | GGplot object 18 | } 19 | \description{ 20 | Uses plot_DataOverRT() internally. 21 | } 22 | \examples{ 23 | data = data.frame(fc.raw.file = rep(paste('file', letters[1:3]), each=30), 24 | RT = seq(20, 120, length.out = 30), 25 | counts = c(rnorm(30, 400, 20), rnorm(30, 250, 15), rnorm(30, 50, 15))) 26 | plot_IDsOverRT(data) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /man/plot_RTPeakWidth.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_RTPeakWidth} 4 | \alias{plot_RTPeakWidth} 5 | \title{Plot RT peak width over time} 6 | \usage{ 7 | plot_RTPeakWidth(data, x_lim, y_lim) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'RT', 'peakWidth'} 11 | 12 | \item{x_lim}{Plot range of x-axis} 13 | 14 | \item{y_lim}{Plot range of y-axis} 15 | } 16 | \value{ 17 | GGplot object 18 | } 19 | \description{ 20 | The input is a data.frame with already averaged counts over binned RT-slices. 21 | } 22 | \examples{ 23 | 24 | data = data.frame(fc.raw.file = rep(c("file A", "file B", "file C"), each=81), 25 | RT = c(20:100), 26 | peakWidth = c(rnorm(81, mean=20), rnorm(81, mean=10), rnorm(81, mean=30))) 27 | plot_RTPeakWidth(data, c(10, 100), c(0, 40)) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /man/assignBlocks.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{assignBlocks} 4 | \alias{assignBlocks} 5 | \title{Assign set numbers to a vector of values.} 6 | \usage{ 7 | assignBlocks(values, set_size = 5, sort_values = TRUE) 8 | } 9 | \arguments{ 10 | \item{values}{Vector of values} 11 | 12 | \item{set_size}{Number of distinct values allowed in a set} 13 | 14 | \item{sort_values}{Before assigning values to sets, sort the values?} 15 | } 16 | \value{ 17 | Vector (same length as input) with set numbers 18 | } 19 | \description{ 20 | Each set has size set_size (internally optimized using \code{\link{correctSetSize}}), holding values from 'values'. 21 | This gives n such sets and the return value is just the set index for each value. 22 | } 23 | \examples{ 24 | #library(PTXQC) 25 | assignBlocks(c(1:11, 1), set_size = 3, sort_values = FALSE) 26 | ## --> 1 1 1 2 2 2 3 3 3 4 4 1 27 | 28 | } 29 | -------------------------------------------------------------------------------- /man/getMaxima.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{getMaxima} 4 | \alias{getMaxima} 5 | \title{Find the local maxima in a vector of numbers.} 6 | \usage{ 7 | getMaxima(x, thresh_rel = 0.2) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of numbers} 11 | 12 | \item{thresh_rel}{Minimum relative intensity to maximum intensity of 'x' required 13 | to be a maximum (i.e., a noise threshold). Default is 20\%.} 14 | } 15 | \value{ 16 | Vector of bool's, where TRUE indicates a local maximum. 17 | } 18 | \description{ 19 | A vector of booleans is returned with the same length as input 20 | which contains TRUE when there is a maximum. 21 | Simply sum up the vector to get the number of maxima. 22 | } 23 | \examples{ 24 | r = getMaxima(c(1,0,3,4,5,0)) 25 | all(r == c(TRUE,FALSE,FALSE,FALSE,TRUE,FALSE)) 26 | 27 | getMaxima(c(1, NA, 3, 2, 3, NA, 4, 2, 5)) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /man/qualCenteredRef.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_qualities.R 3 | \name{qualCenteredRef} 4 | \alias{qualCenteredRef} 5 | \title{Quality metric for 'centeredness' of a distribution around zero with a user-supplied range threshold.} 6 | \usage{ 7 | qualCenteredRef(x, tol) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of values (hopefully in interval [-tol, tol])} 11 | 12 | \item{tol}{Border of interval (must be positive)} 13 | } 14 | \value{ 15 | Value between [0, 1] 16 | } 17 | \description{ 18 | Ranges between 0 (worst score) and 1 (best score). 19 | The best score is achieved when the median of 'x' is close to the center of the interval [-tol, tol]. 20 | If median of 'x' is close to the border (on either side), the score decreases linearly to zero. 21 | Can be used for uncalibrated mass errors, as a measure of how well they are centered around 0. 22 | } 23 | \details{ 24 | NA's are removed for all computations. 25 | } 26 | -------------------------------------------------------------------------------- /man/getAbundanceClass.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{getAbundanceClass} 4 | \alias{getAbundanceClass} 5 | \title{Assign a relative abundance class to a set of (log10) abundance values} 6 | \usage{ 7 | getAbundanceClass(x) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of numeric values (in log10)} 11 | } 12 | \value{ 13 | Vector of factors corresponding to input with abundance class names (e.g. low, high) 14 | } 15 | \description{ 16 | Abundances (should be logged already) are grouped into different levels, 17 | starting from the smallest values ("low") to the highest values ("high"). 18 | Intermediate abundances are either assigned as "mid", or "low-mid". 19 | If the range is too large, only "low" and "high" are assigned, the intermediate values 20 | are just numbers. 21 | } 22 | \details{ 23 | Example: 24 | getAbundanceClass(c(12.4, 17.1, 14.9, 12.3)) ## --> factor(c("low", "high", "mid", "low")) 25 | } 26 | -------------------------------------------------------------------------------- /man/qualCentered.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_qualities.R 3 | \name{qualCentered} 4 | \alias{qualCentered} 5 | \title{Quality metric for 'centeredness' of a distribution around zero.} 6 | \usage{ 7 | qualCentered(x) 8 | } 9 | \arguments{ 10 | \item{x}{Numeric values (e.g. ppm errors)} 11 | } 12 | \value{ 13 | Value between [0, 1] 14 | } 15 | \description{ 16 | Ranges between 0 (worst score) and 1 (best score). 17 | A median of zero gives the best score of 1. 18 | The closer the median is to the most extreme value of the distribution, the smaller the score (until reaching 0). 19 | Can be used for calibrated mass errors, as a measure of how well they are centered around 0. 20 | E.g. if the median is 0.1, while the range is [-0.5,0.5], the score will be 0.8 (punishing the 20% deviation). 21 | If the range of data is asymmetric, e.g. [-1.5,-0.5] and does not include zero, the score cannot reach 1, 22 | since the median can never be zero. 23 | } 24 | -------------------------------------------------------------------------------- /man/qualHighest.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_qualities.R 3 | \name{qualHighest} 4 | \alias{qualHighest} 5 | \title{Score an empirical density distribution of values, where the best possible distribution is right-skewed.} 6 | \usage{ 7 | qualHighest(x, N) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of numeric values (e.g. height of histogram bins)} 11 | 12 | \item{N}{Length of x (just a precaution currently)} 13 | } 14 | \value{ 15 | Quality score in the range of [0,1] 16 | } 17 | \description{ 18 | The score is computed according to 19 | } 20 | \details{ 21 | q = ((N-1) - sum_i( ((N-i-1)*x_i) ) / (N-1) 22 | 23 | Scores range from 0 (worst), to 1 (best). 24 | E.g. c(0,0,0,16) would yield a score of 1. 25 | c(16,0,0,0,0) gives a score of 0. 26 | } 27 | \examples{ 28 | qualHighest(c(0,0,0,16), 4) ## 1 29 | qualHighest(c(16,0,0,0), 4) ## 0 30 | qualHighest(c(1,1,1,1), 4) ## 0.5 31 | qualHighest(c(0,16,0,0), 4) ## 1/3 32 | 33 | } 34 | -------------------------------------------------------------------------------- /man/qualBestKS.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_qualities.R 3 | \name{qualBestKS} 4 | \alias{qualBestKS} 5 | \title{From a list of vectors, compute all vs. all Kolmogorov-Smirnoff distance statistics (D)} 6 | \usage{ 7 | qualBestKS(x) 8 | } 9 | \arguments{ 10 | \item{x}{List of vectors, where each vector holds a distribution} 11 | } 12 | \value{ 13 | A data.frame with ks-test values of the "reference" to all other distributions (see Details) 14 | } 15 | \description{ 16 | ... and report the row of the matrix which has maximum sum (i.e the best "reference" distribution). 17 | The returned data.frame has as many rows as distributions given and two columns. 18 | The first column 'name' gives the name of the list element, the second column 'ks_best' gives '1-statistic' of the 19 | Kolmogorov-Smirnoff test to the "reference" distribution (which was picked by maximising the sum of 'ks_best'). 20 | Thus, the row with a 'ks_best' of 1 is the reference distribution. 21 | } 22 | -------------------------------------------------------------------------------- /man/read.MQ.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/MQDataReader.R 3 | \name{read.MQ} 4 | \alias{read.MQ} 5 | \title{Convenience wrapper for MQDataReader when only a single MQ file should be read 6 | and file mapping need not be stored.} 7 | \usage{ 8 | read.MQ( 9 | file, 10 | filter = "", 11 | type = "pg", 12 | col_subset = NA, 13 | add_fs_col = 10, 14 | LFQ_action = FALSE, 15 | ... 16 | ) 17 | } 18 | \arguments{ 19 | \item{file}{see \code{MQDataReader::readMQ()}} 20 | 21 | \item{filter}{see \code{MQDataReader::readMQ()}} 22 | 23 | \item{type}{see \code{MQDataReader::readMQ()}} 24 | 25 | \item{col_subset}{see \code{MQDataReader::readMQ()}} 26 | 27 | \item{add_fs_col}{see \code{MQDataReader::readMQ()}} 28 | 29 | \item{LFQ_action}{see \code{MQDataReader::readMQ()}} 30 | 31 | \item{...}{see \code{MQDataReader::readMQ()}} 32 | } 33 | \value{ 34 | see \code{MQDataReader::readMQ()} 35 | } 36 | \description{ 37 | For params, see \code{MQDataReader::readMQ()}. 38 | } 39 | -------------------------------------------------------------------------------- /man/assembleMZQC.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mzQC.R 3 | \name{assembleMZQC} 4 | \alias{assembleMZQC} 5 | \title{Collects all 'mzQC' members from each entry in lst_qcMetrics and stores them in an overall mzQC object, which can be written to disk (see writeMZQC()) or augmented otherwise} 6 | \usage{ 7 | assembleMZQC(lst_qcMetrics, raw_file_mapping) 8 | } 9 | \arguments{ 10 | \item{lst_qcMetrics}{A list of qcMetric objects which have their mzQC member populated with "MzQCrunQuality" and/or "MzQCsetQuality" objects} 11 | 12 | \item{raw_file_mapping}{A data.frame with cols 'from', to' and maybe 'best.effort' (if shorting was unsuccessful), as e.g. obtained by a FilenameMapper$raw_file_mapping} 13 | } 14 | \value{ 15 | An MzQCmzQC object (root object of an mzQC document) 16 | } 17 | \description{ 18 | Collects all 'mzQC' members from each entry in lst_qcMetrics and stores them in an overall mzQC object, which can be written to disk (see writeMZQC()) or augmented otherwise 19 | } 20 | -------------------------------------------------------------------------------- /man/inMatchWindow.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQalign.R 3 | \name{inMatchWindow} 4 | \alias{inMatchWindow} 5 | \title{For grouped peaks: separate them into in-width vs. out-width class.} 6 | \usage{ 7 | inMatchWindow(data, df.allowed.deltaRT) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'rtdiff_mixed', 'rtdiff_genuine'} 11 | 12 | \item{df.allowed.deltaRT}{The allowed matching difference for each Raw file (as data.frame(fc.rawfile, m))} 13 | } 14 | \value{ 15 | A data.frame with one row for each raw.file and columns 'raw.file' and score 'withinRT' (0-1) 16 | } 17 | \description{ 18 | Looking at groups only: Compute the fraction of 3D-peak pair groups per Raw file which 19 | have an acceptable RT difference after alignment using the result from 'idTransferCheck()', 20 | i.e. compute the fraction of groups which are within a certain RT tolerance. 21 | } 22 | \details{ 23 | Returned value is between 0 (bad) and 1 (all within tolerance). 24 | } 25 | -------------------------------------------------------------------------------- /man/plot_Charge.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_Charge} 4 | \alias{plot_Charge} 5 | \title{The plots shows the charge distribution per Raw file. 6 | The output of 'mosaicize()' can be used directly.} 7 | \usage{ 8 | plot_Charge(d_charge) 9 | } 10 | \arguments{ 11 | \item{d_charge}{A data.frame with columns as described above} 12 | } 13 | \value{ 14 | GGplot object 15 | } 16 | \description{ 17 | The input is a data.frame with columns 18 | 'Var1' - name of the Raw file 19 | 'Var2' - charge (used as fill color) 20 | 'Var1_center' - contains X-position of the Raw file 21 | 'Var2_height' - relative frequency of the charge 22 | 'Margin_var1' - 23 | where each row represents one peptide sequence. 24 | } 25 | \examples{ 26 | data = data.frame(raw.file = c(rep('file A', 100), rep('file B', 40)), 27 | data = c(rep(2, 60), rep(3, 30), rep(4, 10), 28 | rep(2, 30), rep(3, 7), rep(4, 3))) 29 | plot_Charge(mosaicize(data)) 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/plot_ContEVD.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_ContEVD} 4 | \alias{plot_ContEVD} 5 | \title{Plot contaminants from evidence.txt, broken down into top5-proteins.} 6 | \usage{ 7 | plot_ContEVD(data, top5) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'contaminant', 'pname', 'intensity'} 11 | 12 | \item{top5}{Name of the Top-5 Proteins (by relative intensity or whatever seems relevant)} 13 | } 14 | \value{ 15 | GGplot object 16 | } 17 | \description{ 18 | Plot contaminants from evidence.txt, broken down into top5-proteins. 19 | } 20 | \examples{ 21 | 22 | data = data.frame(intensity = 1:12, 23 | pname = rep(letters[1:3], 4), 24 | fc.raw.file = rep(paste("f", 1:4), each=3), 25 | contaminant = TRUE) 26 | ## providing more proteins than present... d,e will be ignored 27 | plot_ContEVD(data, top5 = letters[1:5]) 28 | ## classify 'c' as 'other' 29 | plot_ContEVD(data, top5 = letters[1:2]) 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/plot_MBRgain.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_MBRgain} 4 | \alias{plot_MBRgain} 5 | \title{Plot MaxQuant Match-between-runs id transfer performance as a scatterplot.} 6 | \usage{ 7 | plot_MBRgain(data, title_sub = "") 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns as described above} 11 | 12 | \item{title_sub}{Subtitle text} 13 | } 14 | \value{ 15 | GGplot object 16 | } 17 | \description{ 18 | Per Raw file, the absolute number of transferred IDs as well as the relative gain in percent. 19 | } 20 | \details{ 21 | The input is a data.frame with columns 22 | 'fc.raw.file' - raw file name 23 | 'abs' - absolute number of transferred ID's 24 | 'pc' - gain on top of genuine IDs [%] 25 | where each row represents one rawfile. 26 | } 27 | \examples{ 28 | data = data.frame(fc.raw.file = paste("file", letters[1:4]), 29 | abs = c(5461, 5312, 3618, 502), 30 | pc = c(34, 32, 22, 2)) 31 | plot_MBRgain(data, "MBR gain: 18\%") 32 | 33 | } 34 | -------------------------------------------------------------------------------- /man/peakWidthOverTime.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{peakWidthOverTime} 4 | \alias{peakWidthOverTime} 5 | \title{Discretize RT peak widths by averaging values per time bin.} 6 | \usage{ 7 | peakWidthOverTime(data, RT_bin_width = 2) 8 | } 9 | \arguments{ 10 | \item{data}{Data.frame with columns 'retention.time' and 'retention.length'} 11 | 12 | \item{RT_bin_width}{Bin size in minutes} 13 | } 14 | \value{ 15 | Data.frame with columns 'bin', 'RT', 'peakWidth' 16 | } 17 | \description{ 18 | Should be applied for each Raw file individually. 19 | } 20 | \details{ 21 | Returns a data.frame, where 'bin' gives the index of each bin, 'RT' is 22 | the middle of each bin and 'peakWidth' is the averaged peak width per bin. 23 | } 24 | \examples{ 25 | data = data.frame(retention.time = seq(30,200, by=0.001)) ## one MS/MS per 0.1 sec 26 | data$retention.length = seq(0.3, 0.6, length.out = nrow(data)) + rnorm(nrow(data), 0, 0.1) 27 | d = peakWidthOverTime(data) 28 | plot(d$RT, d$peakWidth) 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/supCount.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{supCount} 4 | \alias{supCount} 5 | \title{Compute shortest prefix length which makes all strings in a vector uniquely identifyable.} 6 | \usage{ 7 | supCount(x, prefix_l = 1) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of strings} 11 | 12 | \item{prefix_l}{Starting prefix length, which is incremented in steps of 1 until all prefixes are unique (or maximum string length is reached)} 13 | } 14 | \value{ 15 | Integer with minimal prefix length required 16 | } 17 | \description{ 18 | If there is no unique prefix (e.g. if a string is contained twice), then the length 19 | of the longest string is returned, i.e. if the return value is used in a call to substr, nothing happens 20 | e.g. substr(x, 1, supCount(x)) == x 21 | } 22 | \examples{ 23 | supCount(c("abcde...", "abcd...", "abc...")) ## 5 24 | 25 | x = c("doubled", "doubled", "aLongDummyString") 26 | all( substr(x, 1, supCount(x)) == x ) 27 | ## TRUE (no unique prefix due to duplicated entries) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /man/plot_MissedCleavages.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_MissedCleavages} 4 | \alias{plot_MissedCleavages} 5 | \title{Plot bargraph of missed cleavages.} 6 | \usage{ 7 | plot_MissedCleavages(data, title_sub = "") 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', '...' (missed cleavage classes)} 11 | 12 | \item{title_sub}{Plot's subtitle} 13 | } 14 | \value{ 15 | GGplot object 16 | } 17 | \description{ 18 | Per Raw file, an arbitrary number of missed cleavage classes (one per column) can be given. 19 | The total fraction of 3D-peaks must sum to 1 (=100%). 20 | Columns are ordered by name. 21 | } 22 | \details{ 23 | A visual threshold line is drawn at 75% (expected MC0 count). 24 | } 25 | \examples{ 26 | data = data.frame(fc.raw.file = letters[1:5], 27 | MC0 = c(0.8, 0.5, 0.85, 0.2, 0.9), 28 | MC1 = c(0.1, 0.4, 0.05, 0.7, 0.0), 29 | "MS2+" = c(0.1, 0.1, 0.1, 0.1, 0.1), 30 | check.names = FALSE) 31 | plot_MissedCleavages(data, "contaminant inclusion unknown") 32 | 33 | } 34 | -------------------------------------------------------------------------------- /man/plot_CountData.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_CountData} 4 | \alias{plot_CountData} 5 | \title{Plot Protein groups per Raw file} 6 | \usage{ 7 | plot_CountData(data, y_max, thresh_line, title) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'counts', 'category'} 11 | 12 | \item{y_max}{Plot limit of y-axis} 13 | 14 | \item{thresh_line}{Position of a threshold line, indicating the usual target value} 15 | 16 | \item{title}{Main title, and optional subtitle (if vector of length 2 is provided)} 17 | } 18 | \value{ 19 | GGplot object 20 | } 21 | \description{ 22 | The input is a data.frame with protein/peptide counts, where 'category' designates 23 | the origin of information (genuine ID, transferred ID, or both). 24 | } 25 | \examples{ 26 | 27 | data = data.frame(fc.raw.file = rep(c("file A", "file B"), each=3), 28 | counts = c(3674, 593, 1120, 2300, 400, 600), 29 | category = c("genuine","genuine+transferred","transferred")) 30 | plot_CountData(data, 6000, 4000, c("EVD: Protein Groups count", "gain: 23\%")) 31 | 32 | } 33 | -------------------------------------------------------------------------------- /man/ggAxisLabels.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_miscGGplot.R 3 | \name{ggAxisLabels} 4 | \alias{ggAxisLabels} 5 | \title{Function to thin out the number of labels shown on an axis in GGplot} 6 | \usage{ 7 | ggAxisLabels(x, n = 20) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of labels (passed by GGplot)} 11 | 12 | \item{n}{Number of labels to show} 13 | } 14 | \value{ 15 | Shortened version of 'x' 16 | } 17 | \description{ 18 | By default, 20 labels (or up to 40 see below) are shown. 19 | If the number of items is less than twice the number of desired labels, 20 | all labels will be shown (to avoid irregular holes for some labels). 21 | I.e. if n=20, and x has 22 entries, there would be only two labels removed, giving a very irregular picture. 22 | It only becomes somewhat regular if after any label there is at least one blank, i.e. at most 23 | half the entries are labeled. 24 | #' 25 | Example: 26 | ## p is any ggplot object 27 | p + scale_y_discrete(breaks = ggAxisLabels) 28 | ## customize 'n' 29 | my.ggAxisLabels = function(x) ggAxisLabels(x, n = 4) 30 | p + scale_y_discrete(breaks = my.ggAxisLabels) 31 | } 32 | -------------------------------------------------------------------------------- /man/getMetaFilenames.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mzQC.R 3 | \name{getMetaFilenames} 4 | \alias{getMetaFilenames} 5 | \title{Parses the given mqpar.xml file (or, if not found, tries the 'txt_folder' + '/../../' folder (i.e. where the raw data should be)) to extract the full filepaths for all Raw files} 6 | \usage{ 7 | getMetaFilenames(mqpar_file, txt_folder) 8 | } 9 | \arguments{ 10 | \item{mqpar_file}{Location of the mqpar.xml (can be empty, if unknown)} 11 | 12 | \item{txt_folder}{Fallback option: path to the txt folder (which contains evidence.txt, etc)} 13 | } 14 | \value{ 15 | May return 'NULL' if no mqpar.xml could be found. 16 | Otherwise: data.frame with columns: 17 | \itemize{ 18 | \item 'file' (no path), 'path' (full path incl. names) 19 | \item 'file_no_suffix' (as 'file' but without suffix) 20 | \item 'CV' (CV term for filetype, e.g. for Thermo Raw) 21 | } 22 | } 23 | \description{ 24 | Parses the given mqpar.xml file (or, if not found, tries the 'txt_folder' + '/../../' folder (i.e. where the raw data should be)) to extract the full filepaths for all Raw files 25 | } 26 | -------------------------------------------------------------------------------- /man/fixCalibration.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQ.R 3 | \name{fixCalibration} 4 | \alias{fixCalibration} 5 | \title{Detect (and fix) MaxQuant mass recalibration columns, since they 6 | sometimes report wrong values.} 7 | \usage{ 8 | fixCalibration( 9 | df_evd, 10 | df_idrate = NULL, 11 | tolerance_sd_PCoutOfCal = 2, 12 | low_id_rate = 1 13 | ) 14 | } 15 | \arguments{ 16 | \item{df_evd}{Evidence data.frame with columns ()} 17 | 18 | \item{df_idrate}{Data.frame from summary.txt, giving ID rates for each raw file (cols: "ms.ms.identified....", "fc.raw.file"). Can also be NULL.} 19 | 20 | \item{tolerance_sd_PCoutOfCal}{Maximal standard deviation allowed before considered 'failed'} 21 | 22 | \item{low_id_rate}{Minimum ID rate in Percent before a Raw file is considered 'failed'} 23 | } 24 | \value{ 25 | list of data (stats, affected_raw_files, df_evd, recal_message, recal_message_post) 26 | } 27 | \description{ 28 | Returns a list of items for both diagnostics and possibly a fixed evidence data.frame. 29 | Also two strings with messages are returned, which can serve as user message for 30 | pre and post calibration status. 31 | } 32 | -------------------------------------------------------------------------------- /man/plot_RatiosPG.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_RatiosPG} 4 | \alias{plot_RatiosPG} 5 | \title{Plot ratios of labeled data (e.g. SILAC) from proteinGroups.txt} 6 | \usage{ 7 | plot_RatiosPG(df_ratios, d_range, main_title, main_col, legend_title) 8 | } 9 | \arguments{ 10 | \item{df_ratios}{A data.frame with columns 'x', 'y', 'col', 'ltype'} 11 | 12 | \item{d_range}{X-axis range of plot} 13 | 14 | \item{main_title}{Plot title} 15 | 16 | \item{main_col}{Color of title} 17 | 18 | \item{legend_title}{Legend text} 19 | } 20 | \value{ 21 | GGplot object 22 | } 23 | \description{ 24 | The 'x' values are expected to be log2() transformed already. 25 | } 26 | \examples{ 27 | 28 | x1 = seq(-3, 3, by = 0.1) 29 | y1 = dnorm(x1) 30 | x2 = seq(-5, 1, by = 0.1) 31 | y2 = dnorm(x2, mean = -1) 32 | data = data.frame( x = c(x1,x2), 33 | y = c(y1,y2), 34 | col = c(rep("ok", length(x1)), rep("shifted", length(x2))), 35 | ltype = c(rep("solid", length(x1)), rep("dotted", length(x2)))) 36 | plot_RatiosPG(data, range(data$x), "Ratio plot", "red", "group") 37 | 38 | } 39 | -------------------------------------------------------------------------------- /man/wait_for_writable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{wait_for_writable} 4 | \alias{wait_for_writable} 5 | \title{Check if a file is writable and blocks an interactive session, waiting for user input.} 6 | \usage{ 7 | wait_for_writable( 8 | filename, 9 | prompt_text = paste0("The file '", filename, 10 | "' is not writable. Please close all applications using this file. Press '", 11 | abort_answer, "' to abort!"), 12 | abort_answer = "n" 13 | ) 14 | } 15 | \arguments{ 16 | \item{filename}{The file to test for writable} 17 | 18 | \item{prompt_text}{If not writable, show this prompt text to the user} 19 | 20 | \item{abort_answer}{If the user enters this string into the prompt, this function will stop()} 21 | } 22 | \value{ 23 | TRUE if writable, FALSE if aborted by user or (not-writeable and non-interactive) 24 | } 25 | \description{ 26 | This functions gives the user a chance to make the output file writeable before a write attempt 27 | is actually made by R to avoid having run the whole program again upon write failure. 28 | } 29 | \details{ 30 | Note: The file will not be overwritten or changed by this function. 31 | } 32 | -------------------------------------------------------------------------------- /man/byX.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{byX} 4 | \alias{byX} 5 | \title{Calls FUN on a subset of data in blocks of size 'subset_size' of unique indices.} 6 | \usage{ 7 | byX(data, indices, subset_size = 5, FUN, sort_indices = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{data}{Data.frame whose subsets to use on FUN} 11 | 12 | \item{indices}{Vector of group assignments, same length as nrow(data)} 13 | 14 | \item{subset_size}{Number of groups to use in one subset} 15 | 16 | \item{FUN}{Function applied to subsets of data} 17 | 18 | \item{sort_indices}{Sort groups (by their sorted character(!) names) before building subsets} 19 | 20 | \item{...}{More arguments to FUN} 21 | } 22 | \value{ 23 | list of function result (one entry for each subset) 24 | } 25 | \description{ 26 | One subset consists of 'subset_size' unique groups and thus of all rows which 27 | in 'data' which have any of these groups. 28 | The last subset might have less groups, if the number of unique groups is not dividable by subset_size. 29 | } 30 | \details{ 31 | FUN is applied on each subset. 32 | } 33 | \examples{ 34 | byX(data.frame(d=1:10), 1:10, 2, sum) 35 | 36 | } 37 | -------------------------------------------------------------------------------- /man/plotTable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plotTable} 4 | \alias{plotTable} 5 | \title{Plot a table with row names and title} 6 | \usage{ 7 | plotTable( 8 | data, 9 | title = "", 10 | footer = "", 11 | col_names = colnames(data), 12 | fill = c("grey90", "grey70"), 13 | col = "black", 14 | just = "centre" 15 | ) 16 | } 17 | \arguments{ 18 | \item{data}{A data.frame with columns as described above} 19 | 20 | \item{title}{Table title} 21 | 22 | \item{footer}{Footer text} 23 | 24 | \item{col_names}{Column names for Table} 25 | 26 | \item{fill}{Fill pattern (by row)} 27 | 28 | \item{col}{Text color (by column)} 29 | 30 | \item{just}{(ignored)} 31 | } 32 | \value{ 33 | gTree object with class 'PTXQC_table' 34 | } 35 | \description{ 36 | Restriction: currently, the footer will be cropped at the table width. 37 | } 38 | \examples{ 39 | data = data.frame(raw.file = letters[1:4], 40 | id.rate = 3:6) 41 | plotTable(data, 42 | title = "Bad files", 43 | footer = "bottom", 44 | col_names = c("first col", "second col"), 45 | col=c("red", "green")) 46 | 47 | } 48 | -------------------------------------------------------------------------------- /man/byXflex.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{byXflex} 4 | \alias{byXflex} 5 | \title{Same as \code{\link{byX}}, but with more flexible group size, to avoid that the last group has only a few entries (<50\% of desired size).} 6 | \usage{ 7 | byXflex(data, indices, subset_size = 5, FUN, sort_indices = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{data}{Data.frame whose subset to use on FUN} 11 | 12 | \item{indices}{Vector of group assignments, same length as nrow(data)} 13 | 14 | \item{subset_size}{Ideal number of groups to use in one subset -- this can be changed internally, from 75\%-150\%} 15 | 16 | \item{FUN}{function Applied to subsets of data} 17 | 18 | \item{sort_indices}{Groups are formed by their sorted character(!) names} 19 | 20 | \item{...}{More arguments to FUN} 21 | } 22 | \value{ 23 | list of function result (one entry for each subset) 24 | } 25 | \description{ 26 | The 'subset_size' param is internally optimized using \code{\link{correctSetSize}} and 27 | then \code{\link{byX}} is called. 28 | } 29 | \examples{ 30 | stopifnot( 31 | byXflex(data.frame(d=1:10), 1:10, 2, sum, sort_indices = FALSE) == 32 | c(3, 7, 11, 15, 19) 33 | ) 34 | 35 | } 36 | -------------------------------------------------------------------------------- /man/LCSn.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{LCSn} 4 | \alias{LCSn} 5 | \title{Find longest common substring from 'n' strings.} 6 | \usage{ 7 | LCSn(strings, min_LCS_length = 0) 8 | } 9 | \arguments{ 10 | \item{strings}{A vector of strings in which to search for LCS} 11 | 12 | \item{min_LCS_length}{Minimum length expected. Empty string is returned if the result is shorter} 13 | } 14 | \value{ 15 | longest common substring (or "" if shorter than \code{min_LCS_length}) 16 | } 17 | \description{ 18 | Warning: greedy heuristic! This is not guaranteed to find the best solution (or any solution at all), since its done pairwise with the shortest input string as reference. 19 | } 20 | \examples{ 21 | LCSn(c("1_abcde...", 22 | "2_abcd...", 23 | "x_abc...")) ## --> "_abc" 24 | LCSn(c("16_IMU008_CISPLA_E5_R11", 25 | "48_IMU008_CISPLA_P4_E7_R31", 26 | "60_IMU008_CISPLA_E7_R11"), 3) ## -->"_IMU008_CISPLA_" 27 | LCSn(c("AAAAACBBBBB", 28 | "AAAAADBBBBB", 29 | "AAAABBBBBEF", 30 | "AAABBBBBDGH")) ## --> "BBBBB" 31 | LCSn(c("AAAXXBBB", 32 | "BBBXXDDD", 33 | "XXAAADDD")) ## --> fails due to greedy approach; should be "XX" 34 | 35 | } 36 | -------------------------------------------------------------------------------- /man/plot_IonInjectionTimeOverRT.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_IonInjectionTimeOverRT} 4 | \alias{plot_IonInjectionTimeOverRT} 5 | \title{Plot line graph of TopN over Retention time.} 6 | \usage{ 7 | plot_IonInjectionTimeOverRT(data, stats, extra_limit) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'rRT', 'medIIT'} 11 | 12 | \item{stats}{A data.frame with columns 'fc.raw.file', 'mean'} 13 | 14 | \item{extra_limit}{Visual guidance line (maximum acceptable IIT)} 15 | } 16 | \value{ 17 | GGplot object 18 | } 19 | \description{ 20 | Number of Raw files must be 6 at most. Function will stop otherwise. 21 | } 22 | \examples{ 23 | data = data.frame(fc.raw.file = rep(c("d","a","x"), each=100), 24 | rRT = seq(20, 120, length.out = 100), 25 | medIIT = c(round(runif(100, min=3, max=5)), 26 | round(runif(100, min=5, max=8)), 27 | round(runif(100, min=1, max=3))) 28 | ) 29 | stats = data.frame(fc.raw.file = c("d","a","x"), 30 | mean = c(4, 6.5, 2)) 31 | plot_IonInjectionTimeOverRT(data, stats, 10) 32 | 33 | } 34 | -------------------------------------------------------------------------------- /man/RTalignmentTree.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQalign.R 3 | \name{RTalignmentTree} 4 | \alias{RTalignmentTree} 5 | \title{Return a tree plot with a possible alignment tree.} 6 | \usage{ 7 | RTalignmentTree(df_evd, col_fraction = c()) 8 | } 9 | \arguments{ 10 | \item{df_evd}{Evidence table containing calibrated retention times and sequence information.} 11 | 12 | \item{col_fraction}{Empty vector or 1-values vector giving the name of the fraction column (if existing)} 13 | } 14 | \value{ 15 | ggplot object containing the correlation tree 16 | } 17 | \description{ 18 | This allows the user to judge which Raw files have similar corrected RT's (i.e. where aligned successfully). 19 | If there are clear sub-clusters, it might be worth introducing artifical fractions into MaxQuant, 20 | to avoid ID-transfer between these clusters (use the MBR-Align and MBR-ID-Transfer metrics to support the decision). 21 | } 22 | \details{ 23 | If the input contains fractions, leaf nodes will be colored accordingly. 24 | Distinct sub-clusters should have their own color. 25 | If not, MaxQuant's fraction settings should be optimized. 26 | Note that introducing fractions in MaxQuant will naturally lead to a clustering here (it's somewhat circular). 27 | } 28 | -------------------------------------------------------------------------------- /inst/dragNdrop/QC-dragdrop/createQC_dragNdrop_withYAML.bat: -------------------------------------------------------------------------------- 1 | @echo OFF 2 | REM Here we hardcode the YAML file which is forwarded to 'createQC_dragNdrop.bat' 3 | REM The '%~dp0' just prefixes the YAML file with the path to this .bat file 4 | REM i.e. the YAML file should be right next to it. 5 | REM You can also put the .yaml file somewhere else and hardcode the path 6 | REM e.g. set yaml_file=c:\temp\my.yaml 7 | REM Just make sure the file ending remains '.yaml' 8 | set yaml_file=%~dp0\config.yaml 9 | 10 | ECHO. 11 | ECHO This batch file allows invoking 'createQC_dragNdrop.bat' 12 | ECHO with a YAML config file which resides in this directory. 13 | 14 | REM check number of arguments (must be exactly 1 [txt folder]) 15 | set argC=0 16 | for %%x in (%*) do Set /A argC+=1 17 | if %argC% NEQ 1 ( 18 | ECHO. 19 | ECHO Wrong number of arguments^! 20 | ECHO. 21 | ECHO Exactly one argument (containing the txt folder or any file within^) is expected^! 22 | ECHO. 23 | goto end 24 | ) 25 | 26 | 27 | ECHO. 28 | ECHO Using '%yaml_file%' as YAML config 29 | ECHO. 30 | ECHO. 31 | REM Calling original bat file with two arguments 32 | REM We use %~dp0 to get the path of this bat file, since the working directory depends on the calling environment 33 | "%~dp0\createQC_dragNdrop.bat" %1 "%yaml_file%" 34 | 35 | 36 | :end 37 | pause; -------------------------------------------------------------------------------- /man/mosaicize.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{mosaicize} 4 | \alias{mosaicize} 5 | \title{Prepare a Mosaic plot of two columns in long format.} 6 | \usage{ 7 | mosaicize(data) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with exactly two columns} 11 | } 12 | \value{ 13 | Data.frame 14 | } 15 | \description{ 16 | Found at http://stackoverflow.com/questions/19233365/how-to-create-a-marimekko-mosaic-plot-in-ggplot2 17 | Modified (e.g. to pass R check) 18 | } 19 | \details{ 20 | Returns a data frame, which can be used for plotting and has the following columns: 21 | 'Var1' - marginalized values from 1st input column 22 | 'Var2' - marginalized values from 2nd input column 23 | 'Freq' - relative frequency of the combination given in [Var1, Var2] 24 | 'margin_var1' - frequency of the value given in Var1 25 | 'var2_height' - frequency of the value given in Var2, relative to Var1 26 | 'var1_center' - X-position when plotting (large sets get a larger share) 27 | } 28 | \examples{ 29 | data = data.frame(raw.file = c(rep('file A', 100), rep('file B', 40)), 30 | charge = c(rep(2, 60), rep(3, 30), rep(4, 10), 31 | rep(2, 30), rep(3, 7), rep(4, 3))) 32 | mosaicize(data) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /tests/testthat/test_qcMetric.R: -------------------------------------------------------------------------------- 1 | library(PTXQC) 2 | #library(testthat) 3 | library(ggplot2) 4 | context("qcMetric.R") 5 | 6 | test_that("qcMetric", { 7 | 8 | dd = data.frame(x=1:10, y=11:20) 9 | 10 | a = qcMetric$new(helpText="small help text", 11 | workerFcn=function(.self, data, gtit) 12 | { 13 | # usually, plots are produced, but they are hard to check. So we generate simple values 14 | pl = lapply(1:2, function(xx) ggplot(data) + geom_point(aes(x=x*xx,y=y)) + ggtitle(paste(gtit, xx))) 15 | qcScores = data.frame(r=1, z=9:10) 16 | return(list(plots = pl, qcScores = qcScores)) 17 | }, 18 | qcCat="LC", 19 | qcName="MS/MS Peak shape", 20 | orderNr = 30) 21 | 22 | a$setData(dd, "title assigned by worker") 23 | s = a$qcScores 24 | expect_equivalent(s, data.frame(r=1, z=9:10)) 25 | 26 | p = a$plots 27 | expect_equal(length(p), 2) 28 | a$getPlots(TRUE) ## just check if it works 29 | a$getPlots(FALSE) ## just check if it works 30 | expect_equal(paste("title assigned by worker", 1:2), a$getTitles()) 31 | 32 | expect_equal("small help text", a$helpText) 33 | expect_equal("MS/MS Peak shape", a$qcName) 34 | 35 | expect_equal(30, a$orderNr) 36 | }) 37 | 38 | -------------------------------------------------------------------------------- /man/plot_DataOverRT.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_DataOverRT} 4 | \alias{plot_DataOverRT} 5 | \title{Plot some count data over time for each Raw file.} 6 | \usage{ 7 | plot_DataOverRT( 8 | data, 9 | title, 10 | y_lab, 11 | x_lim = range(data$RT), 12 | y_max = max(data$counts) 13 | ) 14 | } 15 | \arguments{ 16 | \item{data}{A data.frame with columns as described above} 17 | 18 | \item{title}{The plot title} 19 | 20 | \item{y_lab}{Label of y-axis} 21 | 22 | \item{x_lim}{Limits of the x-axis (2-tuple)} 23 | 24 | \item{y_max}{Maximum of the y-axis (single value)} 25 | } 26 | \value{ 27 | GGplot object 28 | } 29 | \description{ 30 | The input is a data.frame with columns 31 | 'RT' - RT in seconds, representing one bin 32 | 'counts' - number of counts at this bin 33 | 'fc.raw.file' - name of the Raw file 34 | where each row represents one bin in RT. 35 | } 36 | \details{ 37 | At most nine(!) Raw files can be plotted. If more are given, 38 | an error is thrown. 39 | } 40 | \examples{ 41 | data = data.frame(fc.raw.file = rep(paste('file', letters[1:3]), each=30), 42 | RT = seq(20, 120, length.out = 30), 43 | counts = c(rnorm(30, 400, 20), rnorm(30, 250, 15), rnorm(30, 50, 15))) 44 | plot_DataOverRT(data, "some title", "count data") 45 | 46 | } 47 | -------------------------------------------------------------------------------- /man/getQCHeatMap.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_QCHeat.R 3 | \name{getQCHeatMap} 4 | \alias{getQCHeatMap} 5 | \title{Generate a Heatmap from a list of QC measurements.} 6 | \usage{ 7 | getQCHeatMap(lst_qcMetrics, raw_file_mapping) 8 | } 9 | \arguments{ 10 | \item{lst_qcMetrics}{List of QCMetric objects} 11 | 12 | \item{raw_file_mapping}{Data.frame with 'from' and 'to' columns for name mapping to unify names from list entries} 13 | } 14 | \value{ 15 | A ggplot object for printing 16 | } 17 | \description{ 18 | Each list entry is a data.frame with two columns. 19 | The first one contains the Raw file name (or the short version). 20 | and should be named 'raw.file' (or 'fc.raw.file'). 21 | The second column's name must be an expression (see ?plotmath) 22 | and contains quality values in the range [0,1]. If values are outside this range, 23 | a warning is issued and values are cut to the nearest allowed value (e.g. '1.2' becomes '1'). 24 | List entries are merged and columns are ordered by name. 25 | 26 | All substrings enclosed by 'X[0-9]*X.' will be removed (can be used for sorting columns). 27 | The resulting string is evaluated as an expression. 28 | E.g. parse(text = ) 29 | } 30 | \details{ 31 | To judge the overall quality of each raw file a summary column is added, 32 | values being the mean of all other columns per row. 33 | } 34 | -------------------------------------------------------------------------------- /vignettes/readme.txt: -------------------------------------------------------------------------------- 1 | This folder contains the package vignettes in Markdown (.Rmd files). 2 | 3 | When the package is build, R/knitr will automatically create 'proper' vignette files, 4 | which end up as HTML in PTXQC/doc/*.html. 5 | 6 | On GitHub, you can just open any of the vignettes and they will be displayed as HTML in your browser. 7 | 8 | 9 | Technical thoughts on GitHub: 10 | 11 | Since this package is also hosted on GitHub, vignettes can be directly viewed 'raw' by just browsing to this directory (PTXQC/vignettes). 12 | GitHub has a nice feature, which renders the Markdown header as table (instead of displaying the YAML text or ugly LaTex commands). 13 | 14 | Currently, GitHub will apply this nice formatting only if the vignette is encoded as ANSI. Using UTF-8 encoding showed the ugly header formatting. 15 | Despite the fact that we promise UTF-8 to LaTex/Knitr in the header, ANSI seems to work nicely. 16 | 17 | A markdown header is basically YAML, mixable with LaTex and might look like this: 18 | 19 | --- 20 | title: "Basic R-Usage Guide for PTXQC" 21 | author: "Chris Bielow " 22 | date: '`r Sys.Date()`' 23 | output: 24 | html_document: default 25 | pdf_document: null 26 | vignette: > 27 | %\VignetteIndexEntry{Basic R-Usage Guide for PTXQC} 28 | %\VignetteEngine{knitr::rmarkdown} 29 | \usepackage[utf8]{inputenc} 30 | --- 31 | 32 | See our vignettes for complete examples. -------------------------------------------------------------------------------- /man/getPCA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_PCA.R 3 | \name{getPCA} 4 | \alias{getPCA} 5 | \title{Create a principal component analysis (PCA) plot for the first two dimensions.} 6 | \usage{ 7 | getPCA(data, do_plot = TRUE, connect_line_order = NA, gg_layer) 8 | } 9 | \arguments{ 10 | \item{data}{Matrix(!) where each row is one high-dimensional point, with ncol dimensions, 11 | e.g. a mouse as an array of proteinexpressions 12 | rownames(data) give classes for colouring (can be duplicates in matrices, as opposed to data.frames)} 13 | 14 | \item{do_plot}{Show PCA plot? if ==2, then shows correlations plot as well} 15 | 16 | \item{connect_line_order}{Connect points by lines, the order is given by this vector. 17 | Default: NA (no lines)} 18 | 19 | \item{gg_layer}{More parameters added to a ggplot object (ggplot(x) + gg_layer)} 20 | } 21 | \value{ 22 | [invisible] Named list with "PCA": The PCA object as returned by \code{\link[stats]{prcomp}}, access $x for PC values 23 | and "plots": list of plot objects (one or two) 24 | } 25 | \description{ 26 | Create a principal component analysis (PCA) plot for the first two dimensions. 27 | } 28 | \examples{ 29 | n = 5 30 | m = 10 31 | data = matrix(runif(n * m), nrow = n, ncol = m) 32 | rownames(data) = 1:n 33 | getPCA(data, connect_line_order = 1:n, gg_layer = ggplot2::ggtitle("test")) 34 | 35 | } 36 | -------------------------------------------------------------------------------- /man/plot_peptideMods.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_peptideMods.R 3 | \name{plot_peptideMods} 4 | \alias{plot_peptideMods} 5 | \title{Plot peptide modification frequencies} 6 | \usage{ 7 | plot_peptideMods(tbl, y_max = NA, show_missing_modification_levels = TRUE) 8 | } 9 | \arguments{ 10 | \item{tbl}{A data.frame with 'fc.raw.file', 'modification_names' (can be a factor), and 'Freq' (0-100)} 11 | 12 | \item{y_max}{The upper limit of the y-axis's (==Freq); useful for multiple plots with identical limits; if 'NA' the limit is computed from the given 'tbl'} 13 | 14 | \item{show_missing_modification_levels}{If 'tbl$modification_names' is a factor and has more (but missing) levels than actually used, should missing values be dropped or assumed as '0' frequency?} 15 | } 16 | \value{ 17 | GGplot object 18 | } 19 | \description{ 20 | The input is a data.frame, as obtained from modsToTableByRaw(). 21 | } 22 | \examples{ 23 | 24 | data = data.frame(fc.raw.file = rep(c("file A", "file B"), each=3), 25 | modifications = c("Oxidation (M)", 26 | "Unmodified", 27 | "Oxidation (M), Acetyl (Protein N-term)", 28 | "2 Oxidation (M)", 29 | "Unmodified", 30 | "Unmodified")) 31 | tbl = modsToTableByRaw(data) 32 | plot_peptideMods(tbl,show_missing_modification_levels = TRUE) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /man/plot_ContUser.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_ContUser} 4 | \alias{plot_ContUser} 5 | \title{Plot user-defined contaminants from evidence.txt} 6 | \usage{ 7 | plot_ContUser(data, name_contaminant, extra_limit, subtitle = NULL) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'fc.raw.file', 'variable', 'value'} 11 | 12 | \item{name_contaminant}{Name of the contaminant shown in title} 13 | 14 | \item{extra_limit}{Position where a h-line is plotted (for visual guidance)} 15 | 16 | \item{subtitle}{Optional subtitle for plot} 17 | } 18 | \value{ 19 | GGplot object 20 | } 21 | \description{ 22 | Kolmogorov-Smirnoff p-values are plotted on top of each group. 23 | High p-values indicate that Andromeda scores for contaminant peptides 24 | are equal or higher compared to sample peptide scores, i.e. the probability that 25 | sample peptides scores are NOT greater than contaminant peptide scores. 26 | } 27 | \examples{ 28 | 29 | data = data.frame(fc.raw.file = letters[1:3], 30 | variable = c(rep("spectralCount", 3), 31 | rep("intensity", 3), 32 | rep("above.thresh", 3), 33 | rep("score_KS", 3)), 34 | value = c(10, 20, 15, 9, 21, 14, 0, 1, 1, 0.3, 0.01, 0.04)) 35 | plot_ContUser(data, "myco", 5, "subtitle") 36 | 37 | } 38 | -------------------------------------------------------------------------------- /man/getMQPARValue.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_mqpar.R 3 | \name{getMQPARValue} 4 | \alias{getMQPARValue} 5 | \title{Retrieve a parameter value from a mqpar.xml file} 6 | \usage{ 7 | getMQPARValue(mqpar_filename, xpath, allow_multiple = FALSE) 8 | } 9 | \arguments{ 10 | \item{mqpar_filename}{Filename (incl. absolute or relative path) to the mqpar.xml file} 11 | 12 | \item{xpath}{An XPath to extract the content of XML tag(s), e.g. '//firstSearchTol'} 13 | 14 | \item{allow_multiple}{If the XPath expression returns more than one value, all values must be identical (not allowing multiple different values) or 'stop()' is called} 15 | } 16 | \value{ 17 | The stored value as string(!) 18 | } 19 | \description{ 20 | If the file has the param, then return it as string. 21 | If the file is missing, warning is shown and NULL is returned. 22 | If the param (i.e. XML tag) is unknown or cannot be extracted, the program will quit (since this is a hard error). 23 | When multiple occurrences of the param are found (usually due to parameter groups), we test if the values are all identical. 24 | If so, the value is returned. If the values are different, a warning is emitted and NULL is returned unless 'allow_multiple = TRUE' 25 | } 26 | \details{ 27 | E.g. calling getMQPARValue("mqpar.xml", "//firstSearchTol") 28 | will look up the line 29 | 20 30 | and return "20" (string!). 31 | } 32 | -------------------------------------------------------------------------------- /man/findAlignReference.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQalign.R 3 | \name{findAlignReference} 4 | \alias{findAlignReference} 5 | \title{Return list of raw file names which were reported by MaxQuant as reference point for alignment.} 6 | \usage{ 7 | findAlignReference(data) 8 | } 9 | \arguments{ 10 | \item{data}{The data.frame with columns 'retention.time.calibration' and 'raw.file'} 11 | } 12 | \value{ 13 | List of reference raw files (usually just one) 14 | } 15 | \description{ 16 | There is only one reference point which has '0' in 'retention.time.calibration' column in evidence.txt 17 | as corrected RT. This is true for most MaxQuant versions 18 | and also true for fractions. However, some evidence.txt files show 0.03 as an averaged minimum per Raw file. 19 | We use the raw.file with the smallest average as reference. 20 | } 21 | \details{ 22 | Note that MaxQuant uses a guide tree to align the Raw files, so the order of files does not influence the 23 | alignment. But the first file will always be used as reference point when reporting delta-RTs. And this file is also 24 | used by PTXQC as reference file vs all other files to find the real calibration function (see alignmentCheck()). 25 | 26 | This function might return multiple raw file names (if MQ decides to change its mind at some point in the future). 27 | In this case the result should be treated with caution or (better) regarded as failure. 28 | } 29 | -------------------------------------------------------------------------------- /man/modsToTableByRaw.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/modsToTableByRaw.R 3 | \name{modsToTableByRaw} 4 | \alias{modsToTableByRaw} 5 | \title{Convert list of (mixed)modifications to a frequency table} 6 | \usage{ 7 | modsToTableByRaw( 8 | df_evd, 9 | name_unmod = "Unmodified", 10 | name_unmod_inverse = "Modified (total)" 11 | ) 12 | } 13 | \arguments{ 14 | \item{df_evd}{data.frame with 'fc.raw.file' and a 'modifications' column, which contains the modifications for each peptide.} 15 | 16 | \item{name_unmod}{String in 'modifications' which represents an unmodified peptide} 17 | 18 | \item{name_unmod_inverse}{If non-empty, then inverse the frequencies of the 'name_unmod' modifications (i.e. 100-x) IFF they are >=50\% on average (across Raw files) and rename them to this string} 19 | } 20 | \value{ 21 | A data.table with 'fc.raw.file', 'modification_names' (factor), and 'Freq' (0-100) 22 | } 23 | \description{ 24 | Convert list of (mixed)modifications to a frequency table 25 | } 26 | \examples{ 27 | data = data.frame(fc.raw.file = rep(c("file A", "file B"), 28 | each = 3), 29 | modifications = c("Oxidation (M)", 30 | "Unmodified", 31 | "Oxidation (M),Acetyl (Protein N-term)", 32 | "2 Oxidation (M)", 33 | "Unmodified", "Unmodified")) 34 | modsToTableByRaw(data) 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /man/shortenStrings.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{shortenStrings} 4 | \alias{shortenStrings} 5 | \title{Shorten a string to a maximum length and indicate shorting by appending '..'} 6 | \usage{ 7 | shortenStrings(x, max_len = 20, verbose = TRUE, allow_duplicates = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of input strings} 11 | 12 | \item{max_len}{Maximum length allowed} 13 | 14 | \item{verbose}{Print which strings were shortened} 15 | 16 | \item{allow_duplicates}{If shortened strings are not discernible any longer, consider the short version valid (not the default), otherwise (default) return the full string (--> no-op)} 17 | } 18 | \value{ 19 | A vector of shortened strings 20 | } 21 | \description{ 22 | Some axis labels are sometimes just too long and printing them will either 23 | squeeze the actual plot (ggplot) or make the labels disappear beyond the margins (graphics::plot) 24 | One ad-hoc way of avoiding this is to shorten the names, hoping they are still meaningful to the viewer. 25 | } 26 | \details{ 27 | This function should be applied AFTER you tried more gentle methods, such as \code{\link{delLCP}} or \code{\link{simplifyNames}}. 28 | } 29 | \examples{ 30 | r = shortenStrings(c("gamg_101", "gamg_101230100451", "jurkat_06_100731121305", "jurkat_06_1")) 31 | all(r == c("gamg_101", "gamg_101230100..", "jurkat_06_1007..", "jurkat_06_1")) 32 | 33 | } 34 | \seealso{ 35 | \code{\link{delLCP}}, \code{\link{simplifyNames}} 36 | } 37 | -------------------------------------------------------------------------------- /man/plot_ContUserScore.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_ContUserScore} 4 | \alias{plot_ContUserScore} 5 | \title{Plot Andromeda score distribution of contaminant peptide vs. matrix peptides.} 6 | \usage{ 7 | plot_ContUserScore(data, raw.file, score) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'x', 'y', 'condition'} 11 | 12 | \item{raw.file}{Name of Raw file for which the data is displayed (will become part of the plot title)} 13 | 14 | \item{score}{Score of how distinct the distributions are (will become part of the title)} 15 | } 16 | \value{ 17 | GGplot object 18 | } 19 | \description{ 20 | The data is expected to be an ECDF already, x being the Andromeda score, y being the culmulative probability. 21 | The Score is the probability of a Kolm.-Smirnoff test that the contaminant scores are larger (i.e. 22 | large p-values indicate true contamination). 23 | You will only see this plot if the %-threshold (YAML config) was reached. This is a saveguard against false-positive, 24 | but high-scoring contaminant peptides, which would erroneously give you a large p-value and make you believe 25 | your sample is contaminated although that's not the case. 26 | } 27 | \examples{ 28 | 29 | data = data.frame(x = 10:60, 30 | y = c(seq(0,1,length=51), seq(0.1, 1, length=51)), 31 | condition = rep(c("sample","contaminant"), each=51)) 32 | plot_ContUserScore(data, 'test file', 0.96) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /man/plot_IDRate.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_IDRate} 4 | \alias{plot_IDRate} 5 | \title{Plot percent of identified MS/MS for each Raw file.} 6 | \usage{ 7 | plot_IDRate(data, id_rate_bad, id_rate_great, label_ID) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns as described above} 11 | 12 | \item{id_rate_bad}{Number below which the ID rate is considered bad} 13 | 14 | \item{id_rate_great}{Number above which the ID rate is considered great} 15 | 16 | \item{label_ID}{Named vector with colors for the categories given in data$cat} 17 | } 18 | \value{ 19 | GGplot object 20 | } 21 | \description{ 22 | Useful for a first overall impression of the data. 23 | } 24 | \details{ 25 | The input is a data.frame with columns 26 | 'fc.raw.file' - name of the Raw file 27 | 'ms.ms.identified....' - fraction of identified MS/MS spectra in percent 28 | 'cat' - identification category as arbitrary string 29 | where each row represents one Raw file. 30 | } 31 | \examples{ 32 | id_rate_bad = 20; id_rate_great = 35; 33 | label_ID = c("bad (<20\%)" = "red", "ok (...)" = "blue", "great (>35\%)" = "green") 34 | data = data.frame(fc.raw.file = paste('file', letters[1:3]), 35 | ms.ms.identified.... = rnorm(3, 25, 15)) 36 | data$cat = factor(cut(data$ms.ms.identified...., 37 | breaks=c(-1, id_rate_bad, id_rate_great, 100), 38 | labels=names(label_ID))) 39 | plot_IDRate(data, id_rate_bad, id_rate_great, label_ID) 40 | 41 | } 42 | -------------------------------------------------------------------------------- /man/boxplotCompare.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQ.R 3 | \name{boxplotCompare} 4 | \alias{boxplotCompare} 5 | \title{Boxplots - one for each condition (=column) in a data frame.} 6 | \usage{ 7 | boxplotCompare( 8 | data, 9 | log2 = TRUE, 10 | ylab = "intensity", 11 | mainlab = ylab, 12 | sublab = "", 13 | boxes_per_page = 30, 14 | abline = NA, 15 | coord_flip = TRUE, 16 | names = NA 17 | ) 18 | } 19 | \arguments{ 20 | \item{data}{Data frame in long format with numerical expression data} 21 | 22 | \item{log2}{Apply log2 to the data (yes/no)} 23 | 24 | \item{ylab}{Label on Y-axis} 25 | 26 | \item{mainlab}{Main title} 27 | 28 | \item{sublab}{Sub title} 29 | 30 | \item{boxes_per_page}{Maximum number of boxplots per plot. Yields multiple plots if more groups are given.} 31 | 32 | \item{abline}{Draw a horizontal green line at the specified y-position (e.g. to indicate target median values)} 33 | 34 | \item{coord_flip}{Exchange Y and X-axis for better readability} 35 | 36 | \item{names}{An optional data.frame(long=.., short=..), giving a renaming scheme (long->short) for the 'name' column} 37 | } 38 | \value{ 39 | List of ggplot objects 40 | } 41 | \description{ 42 | Given a data.frame with two/three columns in long format (name, value, [contaminant]; in that order), each group (given from 1st column) 43 | is plotted as a bar. 44 | Contaminants (if given) are separated and plotted as yellow bars. 45 | } 46 | \details{ 47 | Boxes are shaded: many NA or Inf lead to more transparency. Allows to easily spot sparse groups 48 | } 49 | -------------------------------------------------------------------------------- /tests/testthat/test_modsToTableByRaw.R: -------------------------------------------------------------------------------- 1 | context("modstoTableByRaw.R") 2 | 3 | test_that("modstoTableByRaw", { 4 | dt_in = data.frame( fc.raw.file = rep(c("file A", "file B"), each = 3), 5 | modifications = c("A", "Unmodified", "A,B", "C", "Unmodified", "Unmodified")) 6 | r = modsToTableByRaw(dt_in) 7 | 8 | testthat::expect_identical(colnames(r), c('fc.raw.file', 'modification_names', 'Freq')) 9 | 10 | exp = data.frame(fc.raw.file = rep(c("file A", "file B"), times = c(3, 2)), 11 | modification_names = factor(c("A", "B", "Unmodified", "C", "Unmodified"), levels = levels(r$modification_names)), 12 | Freq = c(200/3, 100/3, 100/3, 100/3, 200/3)) 13 | testthat::expect_equal(r, exp) 14 | 15 | dt_in = data.frame( fc.raw.file = rep(c("file A", "file B"), each = 3), 16 | modifications = c("C", "Unmodified", "Unmodified", "Unmodified", "A", "Unmodified")) 17 | r_rename = modsToTableByRaw(dt_in, name_unmod = "Unmodified", name_unmod_inverse = "MOD_TOTAL") 18 | exp_rename = data.frame(fc.raw.file = rep(c("file A", "file B"), times = c(2, 2)), 19 | modification_names = factor(c("C", "MOD_TOTAL", "A", "MOD_TOTAL"), levels = levels(r_rename$modification_names)), 20 | Freq = c(100/3, 100/3, 100/3, 100/3)) 21 | testthat::expect_equal(r_rename, exp_rename) 22 | testthat::expect_equal("Unmodified" %in% levels(r_rename$modification_names), FALSE) 23 | 24 | }) 25 | -------------------------------------------------------------------------------- /man/YAMLClass-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/YAMLClass.R 3 | \docType{class} 4 | \name{YAMLClass-class} 5 | \alias{YAMLClass-class} 6 | \alias{YAMLClass} 7 | \title{Query a YAML object for a certain parameter.} 8 | \description{ 9 | If the object has the param, then return it. 10 | If the param is unknown, create it with the given default value and return the default. 11 | } 12 | \section{Fields}{ 13 | 14 | \describe{ 15 | \item{\code{yamlObj}}{A Yaml object as created by \code{\link[yaml]{yaml.load}}} 16 | }} 17 | 18 | \section{Methods}{ 19 | 20 | \describe{ 21 | \item{\code{getYAML(param_name, default, min = NA, max = NA)}}{Query this YAML object for a certain parameter and return its value. If it does not exist it is created with a default value. 22 | An optional min/max range can be specified and will be enforced if the value is known (default will be used upon violation).} 23 | 24 | \item{\code{setYAML(param_name, value)}}{Set a YAML parameter to a certain value. Overwrites the old value or creates a new entry if hithero unknown.} 25 | 26 | \item{\code{writeYAML(filename)}}{Write YAML config (including some documentation) to a YAML file. Returns TRUE on success (always), unless writing the file generates an error.} 27 | }} 28 | 29 | \examples{ 30 | yc = YAMLClass$new(list()) 31 | val = yc$getYAML("cat$subCat", "someDefault") 32 | val ## someDefault 33 | val = yc$setYAML("cat$subCat", "someValue") 34 | val ## someValue 35 | yc$getYAML("cat$subCat", "someDefault") ## still 'someValue' (since its set already) 36 | 37 | } 38 | -------------------------------------------------------------------------------- /man/getFragmentErrors.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQ.R 3 | \name{getFragmentErrors} 4 | \alias{getFragmentErrors} 5 | \title{Extract fragment mass deviation errors from a data.frame from msms.txt} 6 | \usage{ 7 | getFragmentErrors(x, recurse = 0) 8 | } 9 | \arguments{ 10 | \item{x}{Data frame in long format with numerical expression data} 11 | 12 | \item{recurse}{Internal usage only. Leave at 0 when calling.} 13 | } 14 | \value{ 15 | Data frame with mass errors ('msErr') and their 'unit' (Da or ppm) or NULL (if no fragments were given) 16 | } 17 | \description{ 18 | Given a data.frame as obtainable from a msms.txt with 19 | - a 'mass.analyzer' column which contains only a single value for the whole column 20 | - a 'mass.deviations..da.' and (if available) 'mass.deviations..ppm.' 21 | - a 'masses' column (only required if 'mass.deviations..ppm.' is unavailable and the mass.analyzer 22 | indicates hig-res data) 23 | } 24 | \details{ 25 | Mass deviations are extracted from the columns, e.g. each cell containing values separated by 26 | semicolons is split into single values. The appropriate unit is chosen (Da or ppm, depending on 27 | ITMS or FTMS data). Also the fragmentation type can be used: CID indicates ITMS, HCD to FTMS. 28 | This is not 100% safe, but older MQ versions do not report the mass analyzer properly. 29 | 30 | Sometimes, peptides are identified purely based on MS1, i.e. have no fragments. These will be ignored. 31 | 32 | If ppm mass deviations are not available, errors in Da will be converted to ppm using the corresponding mass values. 33 | } 34 | -------------------------------------------------------------------------------- /man/createYaml.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createYaml.R 3 | \name{createYaml} 4 | \alias{createYaml} 5 | \title{Creates a yaml file storing the parameters that are used for creating the PTXQC report 6 | and returns these parameters as well as a list of available qc-Metrics objects.} 7 | \usage{ 8 | createYaml( 9 | yc, 10 | param = list(), 11 | DEBUG_PTXQC = FALSE, 12 | txt_files = NULL, 13 | metrics = NULL 14 | ) 15 | } 16 | \arguments{ 17 | \item{yc}{A yaml class object created by YAMLClass$new()} 18 | 19 | \item{param}{list of parameters sorted by names; if empty, will be populated with defaults} 20 | 21 | \item{DEBUG_PTXQC}{print some debugging information; default FALSE} 22 | 23 | \item{txt_files}{list of paths to MaxQuant files; if NULL, it is assumed that the parameters are for mzTab-mode} 24 | 25 | \item{metrics}{list of metric names that should be plotted; if NULL, will be populated with defaults} 26 | } 27 | \value{ 28 | list of parameters used for creating the report and list of qc-Metrics objects 29 | } 30 | \description{ 31 | Valid parameters are: 32 | param_useMQPAR, add_fs_col, id_rate_bad, id_rate_great , pg_ratioLabIncThresh , param_PG_intThresh, 33 | param_EV_protThresh , param_EV_intThresh, param_EV_pepThresh , yaml_contaminants, param_EV_MatchingTolerance, 34 | param_evd_mbr , param_EV_PrecursorTolPPM, param_EV_PrecursorOutOfCalSD , param_EV_PrecursorTolPPMmainSearch, 35 | param_MSMSScans_ionInjThresh, param_OutputFormats and param_PageNumbers 36 | 37 | Please provide them as a list() of this format: list$parameter_name 38 | } 39 | -------------------------------------------------------------------------------- /man/plot_MBRIDtransfer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_MBRIDtransfer} 4 | \alias{plot_MBRIDtransfer} 5 | \title{Plot MaxQuant Match-between-runs id transfer performance.} 6 | \usage{ 7 | plot_MBRIDtransfer(data) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns as described above} 11 | } 12 | \value{ 13 | GGplot object 14 | } 15 | \description{ 16 | The plots shows the different categories of peak classes 17 | } 18 | \details{ 19 | The input is a data.frame with columns 20 | 'fc.raw.file' - raw file name 21 | 'single' - fraction of peptides with are represent only once 22 | 'multi.inRT' - fraction of peptides with are represent multiple times, 23 | but within a certain RT peak width 24 | 'multi.outRT' - fraction of peptides with are represent multiple times, 25 | with large RT distance 26 | 'sample' - raw file 27 | where each row represents one peptide sequence. 28 | } 29 | \examples{ 30 | data = data.frame(fc.raw.file = rep(c("file A", "file B"), each = 3), 31 | single = c(0.9853628, 0.8323160, 0.9438375, 32 | 0.9825538, 0.8003763, 0.9329961), 33 | multi.inRT = c(0.002927445, 0.055101018, 0.017593087, 34 | 0.005636457, 0.099640044, 0.031870056), 35 | multi.outRT = c(0.01170978, 0.11258294, 0.03856946, 36 | 0.01180972, 0.09998363, 0.03513386), 37 | sample = rep(c("genuine", "transferred", "all"), 2)) 38 | plot_MBRIDtransfer(data) 39 | 40 | } 41 | -------------------------------------------------------------------------------- /man/idTransferCheck.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQalign.R 3 | \name{idTransferCheck} 4 | \alias{idTransferCheck} 5 | \title{Check how close transferred ID's after alignment are to their genuine IDs within one Raw file.} 6 | \usage{ 7 | idTransferCheck(df_evd_all) 8 | } 9 | \arguments{ 10 | \item{df_evd_all}{A data.frame with columns 'type', 'calibrated.retention.time', 'modified.sequence', 'charge', 'raw.file'} 11 | } 12 | \value{ 13 | A data.frame containing the RT diff for each ID-group found in a Raw file (bg = genuine). 14 | } 15 | \description{ 16 | The input is a data.frame containing feature evidence with corrected retention times, 17 | e.g. a 'calibrated.retention.time' column. 18 | } 19 | \details{ 20 | Note that this function must be given MS/MS identifications of type "MULTI-MSMS" and "MSMS-MATCH". 21 | It will stop() otherwise. 22 | 23 | We compare for each peptide sequence (and charge) the RT difference within groups of either genuine as well as mixed pairs. 24 | For every comparison made, we report the RT span If alignment worked perfectly, the span are very small (<1 min), 25 | for the mixed group, i.e. the pairs are accidentally split 3D peaks. Alignment performance has no influence on the 26 | genuine-only groups. 27 | 28 | Note: We found early MaxQuant versions (e.g. 1.2.2.5) to have an empty 'modified.sequence' column for 'MULTI-MATCH' entries. 29 | The sequence which SHOULD be present is equal to the immediate upper row. This is what we use to guess the sequence. 30 | However, this relies on the data.frame not being subsetted before (we can sort using the 'id' column)! 31 | } 32 | -------------------------------------------------------------------------------- /man/plot_CalibratedMSErr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_CalibratedMSErr} 4 | \alias{plot_CalibratedMSErr} 5 | \title{Plot bargraph of uncalibrated mass errors for each Raw file.} 6 | \usage{ 7 | plot_CalibratedMSErr( 8 | data, 9 | MQBug_raw_files, 10 | stats, 11 | y_lim, 12 | extra_limit = NA, 13 | title_sub = "" 14 | ) 15 | } 16 | \arguments{ 17 | \item{data}{A data.frame with columns 'fc.raw.file', 'mass.error..ppm.'} 18 | 19 | \item{MQBug_raw_files}{List of Raw files with invalid calibration values} 20 | 21 | \item{stats}{A data.frame with columns 'fc.raw.file', 'outOfCal'} 22 | 23 | \item{y_lim}{Range of y-axis} 24 | 25 | \item{extra_limit}{Position where a v-line is plotted (for visual guidance)} 26 | 27 | \item{title_sub}{Subtitle} 28 | } 29 | \value{ 30 | GGplot object 31 | } 32 | \description{ 33 | Boxes are optionally colored to indicate that a MQ bug was detected or 34 | if PTXQC detected a too narrow search window. 35 | } 36 | \examples{ 37 | n = c(150, 1000, 1000, 1000) 38 | data = data.frame(fc.raw.file = repEach(letters[4:1], n), 39 | mass.error..ppm. = c(rnorm(n[1], 1, 2.4), 40 | rnorm(n[2], 0.5, 0.5), 41 | rnorm(n[3], 0.1, 0.7), 42 | rnorm(n[4], 0.3, 0.8))) 43 | stats = data.frame(fc.raw.file = letters[4:1], 44 | sd = c(2.4, 0.5, 0.7, 0.8), 45 | outOfCal = c(TRUE, FALSE, FALSE, FALSE)) 46 | plot_CalibratedMSErr(data, MQBug_raw_files = letters[1], stats, y_lim = c(-20,20), 15, "subtitle") 47 | 48 | } 49 | -------------------------------------------------------------------------------- /man/plot_UncalibratedMSErr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_UncalibratedMSErr} 4 | \alias{plot_UncalibratedMSErr} 5 | \title{A boxplot of uncalibrated mass errors for each Raw file.} 6 | \usage{ 7 | plot_UncalibratedMSErr( 8 | data, 9 | MQBug_raw_files, 10 | stats, 11 | y_lim, 12 | extra_limit, 13 | title_sub 14 | ) 15 | } 16 | \arguments{ 17 | \item{data}{A data.frame with columns 'fc.raw.file', 'uncalibrated.mass.error..ppm.'} 18 | 19 | \item{MQBug_raw_files}{List of Raw files with invalid calibration values} 20 | 21 | \item{stats}{A data.frame with columns 'fc.raw.file', 'sd', 'outOfCal'} 22 | 23 | \item{y_lim}{Range of y-axis} 24 | 25 | \item{extra_limit}{Position where a v-line is plotted (for visual guidance)} 26 | 27 | \item{title_sub}{Subtitle} 28 | } 29 | \value{ 30 | GGplot object 31 | } 32 | \description{ 33 | Boxes are optionally colored to indicate that a MQ bug was detected or 34 | if PTXQC detected a too narrow search window. 35 | } 36 | \examples{ 37 | n = c(150, 1000, 1000, 1000) 38 | data = data.frame(fc.raw.file = repEach(letters[4:1], n), 39 | uncalibrated.mass.error..ppm. = c(rnorm(n[1], 13, 2.4), 40 | rnorm(n[2], 1, 0.5), 41 | rnorm(n[3], 3, 0.7), 42 | rnorm(n[4], 4.5, 0.8))) 43 | stats = data.frame(fc.raw.file = letters[4:1], 44 | sd_uncal = c(2.4, 0.5, 0.7, 0.8), 45 | outOfCal = c(TRUE, FALSE, FALSE, FALSE)) 46 | plot_UncalibratedMSErr(data, MQBug_raw_files = letters[1], 47 | stats, y_lim = c(-20,20), 15, "subtitle") 48 | 49 | } 50 | -------------------------------------------------------------------------------- /man/FilenameMapper-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/FilenameMapper.R 3 | \docType{class} 4 | \name{FilenameMapper-class} 5 | \alias{FilenameMapper-class} 6 | \alias{FilenameMapper} 7 | \title{Make sure to call $readMappingFile(some_file) if you want to support a user-defined file mapping. 8 | Otherwise, calls to $getShortNames() will create/augment the mapping for filenames.} 9 | \description{ 10 | Make sure to call $readMappingFile(some_file) if you want to support a user-defined file mapping. 11 | Otherwise, calls to $getShortNames() will create/augment the mapping for filenames. 12 | } 13 | \section{Fields}{ 14 | 15 | \describe{ 16 | \item{\code{raw_file_mapping}}{Data.frame with columns 'from', 'to' and maybe 'best.effort' (if shorting was unsuccessful)} 17 | 18 | \item{\code{mapping.creation}}{how the current mapping was obtained (user or auto)} 19 | 20 | \item{\code{external.mapping.file}}{Filename of user-defined mapping file; only defined if readMappingFile() was called} 21 | }} 22 | 23 | \section{Methods}{ 24 | 25 | \describe{ 26 | \item{\code{getShortNamesStatic(raw.files, max_len, fallbackStartNr = 1)}}{Static method: Shorten a set of Raw file names and return a data frame with the mappings. 27 | Mapping will have: $from, $to and optionally $best.effort (if shorting was unsuccessful and numbers had to be used) 28 | \itemize{ 29 | \item{\verb{raw.files} Vector of Raw files.} 30 | \item{\verb{max_len} Maximal length of shortening results, before resorting to canonical names (file 1,...).} 31 | \item{\verb{fallbackStartNr} Starting index for canonical names.} 32 | } 33 | \subsection{Return Value}{ data.frame with mapping.}} 34 | }} 35 | 36 | \examples{ 37 | a = FilenameMapper$new() 38 | a$readMappingFile('filenamemapping.txt') 39 | 40 | } 41 | -------------------------------------------------------------------------------- /man/delLCP.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{delLCP} 4 | \alias{delLCP} 5 | \title{Removes the longest common prefix (LCP) from a vector of strings.} 6 | \usage{ 7 | delLCP(x, min_out_length = 0, add_dots = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of strings with common prefix} 11 | 12 | \item{min_out_length}{Minimal length of the shortest element of x after LCP removal [default: 0, i.e. empty string is allowed] . If the output would be shorter, the last part of the LCP is kept.} 13 | 14 | \item{add_dots}{Prepend output with '..' if shortening was done.} 15 | } 16 | \value{ 17 | Shortened vector of strings 18 | } 19 | \description{ 20 | You should provide only unique strings (to increase speed). 21 | If only a single string is given, the empty string will be returned unless \code{minOutputLength} is set. 22 | } 23 | \examples{ 24 | delLCP(c("TK12345_H1"), min_out_length=0) 25 | ## "" 26 | 27 | delLCP(c("TK12345_H1"), min_out_length=4) 28 | ## "5_H1" 29 | 30 | delLCP(c("TK12345_H1"), min_out_length=4, add_dots = TRUE) 31 | ## "..5_H1" 32 | 33 | delLCP(c("TK12345_H1", "TK12345_H2"), min_out_length=4) 34 | ## "5_H1" "5_H2" 35 | 36 | delLCP(c("TK12345_H1", "TK12345_H2"), min_out_length=4, add_dots = TRUE) 37 | ## "..5_H1" "..5_H2" 38 | 39 | delLCP(c("TK12345_H1", "TK12345_H2"), min_out_length=8) 40 | ## "12345_H1", "12345_H2" 41 | 42 | delLCP(c("TK12345_H1", "TK12345_H2"), min_out_length=8, add_dots = TRUE) 43 | ## "TK12345_H1", "TK12345_H2" (unchanged, since '..' would add another two) 44 | 45 | delLCP(c("TK12345_H1", "TK12345_H2"), min_out_length=60) 46 | ## "TK12345_H1", "TK12345_H2" (unchanged) 47 | 48 | delLCP(c("TK12345_H1", "TK12345_H2"), min_out_length=60, add_dots = TRUE) 49 | ## "TK12345_H1", "TK12345_H2" (unchanged) 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /man/QCMetaFilenames.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mzQC.R 3 | \name{QCMetaFilenames} 4 | \alias{QCMetaFilenames} 5 | \title{Define a Singleton class which holds the full raw filenames (+path) and their PSI-MS CV terms for usage in the mzQC metadata} 6 | \description{ 7 | The internal data is filled using, e.g. 'getMetaFilenames()' 8 | } 9 | \section{Super class}{ 10 | \code{\link[R6P:Singleton]{R6P::Singleton}} -> \code{QCMetaFilenames} 11 | } 12 | \section{Public fields}{ 13 | \if{html}{\out{
}} 14 | \describe{ 15 | \item{\code{data}}{Stores the data of the singleton. Set the data once before using the singleton all over the place} 16 | } 17 | \if{html}{\out{
}} 18 | } 19 | \section{Methods}{ 20 | \subsection{Public methods}{ 21 | \itemize{ 22 | \item \href{#method-QCMetaFilenames-clone}{\code{QCMetaFilenames$clone()}} 23 | } 24 | } 25 | \if{html}{\out{ 26 |
Inherited methods 27 | 30 |
31 | }} 32 | \if{html}{\out{
}} 33 | \if{html}{\out{}} 34 | \if{latex}{\out{\hypertarget{method-QCMetaFilenames-clone}{}}} 35 | \subsection{Method \code{clone()}}{ 36 | The objects of this class are cloneable with this method. 37 | \subsection{Usage}{ 38 | \if{html}{\out{
}}\preformatted{QCMetaFilenames$clone(deep = FALSE)}\if{html}{\out{
}} 39 | } 40 | 41 | \subsection{Arguments}{ 42 | \if{html}{\out{
}} 43 | \describe{ 44 | \item{\code{deep}}{Whether to make a deep clone.} 45 | } 46 | \if{html}{\out{
}} 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /man/alignmentCheck.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQalign.R 3 | \name{alignmentCheck} 4 | \alias{alignmentCheck} 5 | \title{Verify an alignment by checking the retention time differences of identical peptides across Raw files} 6 | \usage{ 7 | alignmentCheck(data, referenceFile) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns 'calibrated.retention.time', 'id', 'modified.sequence', 'charge', 'raw.file' and 'fraction' (if present)} 11 | 12 | \item{referenceFile}{A raw file name as occuring in data$raw.file, serving as alignment reference (when no fractions are used).} 13 | } 14 | \value{ 15 | A data.frame containing the RT diff for each feature found in a Raw file and the reference. 16 | } 17 | \description{ 18 | The input is a data frame containing feature evidence with corrected retention times, 19 | e.g. a 'calibrated.retention.time' column. 20 | } 21 | \details{ 22 | Note that this function must be given real MS/MS identifications only (type "MULTI-MSMS") 23 | in order to work correctly! 24 | 25 | For each peptide sequence (and charge) in the reference Raw file, this function looks up the 26 | already calibrated retention time difference of the same feature in all other files. For every comparison made, 27 | we report the RT difference. If alignment worked perfectly, the differences are very small (<1 min). 28 | 29 | An 'id' column must be present, to enable mapping the result of this function to the original data frame. 30 | 31 | A reference Raw file can be identified using 'findAlignReference()'. If Maxquants experimental design included 32 | pre-fractionation, a column named 'fraction' should be given and 'referenceFile' should be empty. This function will 33 | pick the one Raw file for each fraction (the first in order) to use as reference. Only the immediately neighbouring 34 | fractions will be matched to this reference. 35 | } 36 | -------------------------------------------------------------------------------- /inst/dragNdrop/QC-dragdrop/_internal/compute_QC_report.R: -------------------------------------------------------------------------------- 1 | ## load packages 2 | library(PTXQC) 3 | library(yaml) 4 | ## the next library() is needed to prevent a spurious error in certain R versions (might be a bug in R or a package) 5 | ## error message is: 6 | ## Error in Scales$new : could not find function "loadMethod" 7 | library(methods) 8 | 9 | argv = commandArgs(TRUE) 10 | #argv = c('Z:\\projects\\QC\\PTXQC\\data\\_txt_withMBR_withFractions_MQ15') 11 | cat("Command line args are:\n") 12 | cat(paste(argv, collapse="\n", sep="")) 13 | cat("\n") 14 | 15 | if(!(length(argv) %in% 1:2)) 16 | { 17 | stop("Wrong number of parameters!\n", 18 | "Received: \n - ", paste(argv, collapse="\n - ", sep=""), 19 | "\n\nUsage: []\n"); 20 | } 21 | 22 | PATH_TO_TXT = argv[1] 23 | fi = file.info(PATH_TO_TXT) 24 | if (is.na(fi$isdir) || !fi$isdir) 25 | { 26 | stop(paste0("Argument '", PATH_TO_TXT, "' is not a valid directory\n")); 27 | } 28 | 29 | YAML_CONFIG = list() 30 | if (length(argv)==2 && nchar(argv[2])>0) 31 | { ## YAML was passed via command line 32 | cat("\nUsing YAML config provided via command line ...\n") 33 | YAML_CONFIG = yaml.load_file(input = argv[2]) 34 | } else { 35 | ## use a YAML config inside the target directory if present 36 | rprt_fns = getReportFilenames(PATH_TO_TXT) 37 | if (file.exists(rprt_fns$yaml_file)) 38 | { 39 | cat("\nUsing YAML config already present in target directory ...\n") 40 | YAML_CONFIG = yaml.load_file(input = rprt_fns$yaml_file) 41 | } 42 | } 43 | ## use YAML_CONFIG to get output-filenames (which contains the log-file name) 44 | yc = YAMLClass$new(YAML_CONFIG) 45 | use_extended_reportname = yc$getYAML("PTXQC$ReportFilename$extended", TRUE) 46 | rprt_fns = getReportFilenames(PATH_TO_TXT, use_extended_reportname) 47 | 48 | output_files = try(createReport(PATH_TO_TXT, NULL, YAML_CONFIG, rprt_fns, enable_log = TRUE)) 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /man/simplifyNames.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{simplifyNames} 4 | \alias{simplifyNames} 5 | \title{Removes common substrings (infixes) in a set of strings.} 6 | \usage{ 7 | simplifyNames( 8 | strings, 9 | infix_iterations = 2, 10 | min_LCS_length = 7, 11 | min_out_length = 7 12 | ) 13 | } 14 | \arguments{ 15 | \item{strings}{A vector of strings which are to be shortened} 16 | 17 | \item{infix_iterations}{Number of successive rounds of substring removal} 18 | 19 | \item{min_LCS_length}{Minimum length of the longest common substring (default:7, minimum: 6)} 20 | 21 | \item{min_out_length}{Minimum length of shortest element of output (no shortening will be done which causes output to be shorter than this threshold)} 22 | } 23 | \value{ 24 | A list of shortened strings, with the same length as the input 25 | } 26 | \description{ 27 | Usually handy for plots, where condition names should be as concise as possible. 28 | E.g. you do not want names like 29 | 'TK20130501_H2M1_010_IMU008_CISPLA_E3_R1.raw' and 30 | 'TK20130501_H2M1_026_IMU008_CISPLA_E7_R2.raw' 31 | but rather 'TK.._010_I.._E3_R1.raw' and 32 | 'TK.._026_I.._E7_R2.raw' 33 | 34 | If multiple such substrings exist, the algorithm will remove the longest first and iterate 35 | a number of times (two by default) to find the second/third etc longest common substring. 36 | Each substring must fulfill a minimum length requirement - if its shorter, its not considered worth removing 37 | and the iteration is aborted. 38 | } 39 | \examples{ 40 | #library(PTXQC) 41 | simplifyNames(c('TK20130501_H2M1_010_IMU008_CISPLA_E3_R1.raw', 42 | 'TK20130501_H2M1_026_IMU008_CISPLA_E7_R2.raw'), infix_iterations = 2) 43 | # --> "TK.._010_I.._E3_R1.raw","TK.._026_I.._E7_R2.raw" 44 | 45 | try(simplifyNames(c("bla", "foo"), min_LCS_length=5)) 46 | # --> error, since min_LCS_length must be >=6 47 | 48 | } 49 | -------------------------------------------------------------------------------- /tests/testthat/test_createYaml.R: -------------------------------------------------------------------------------- 1 | library(PTXQC) 2 | context("createYaml.R") 3 | 4 | test_that("createYaml", { 5 | 6 | ## 7 | ##test empty yc object, no parameter or metric specifications 8 | ## 9 | 10 | yc <- YAMLClass$new(list()) 11 | expect_equal(length(createYaml(yc)$param), 19) 12 | 13 | ## 14 | ##test invalid parameter input 15 | ## 16 | 17 | yc <- YAMLClass$new(list()) 18 | 19 | parameter <- list() 20 | parameter$nonsense1 <- c(1,4) 21 | parameter$nonsense2 <- "test" 22 | parameter$param_PG_intThresh <- 30 23 | 24 | expect_null(createYaml(yc, param = parameter)$param$nonsense1) 25 | expect_null(createYaml(yc, param = parameter)$param$nonsense2) 26 | expect_equivalent(createYaml(yc, param = parameter)$param$param_PG_intThresh, 30) 27 | expect_equal(length(createYaml(yc)$param), 19) 28 | 29 | ## 30 | ##test valid parameter input 31 | ## 32 | 33 | yc <- YAMLClass$new(list()) 34 | 35 | parameter$add_fs_col <- 14 36 | parameter$param_OutputFormats <- "txt" 37 | 38 | expect_equivalent(createYaml(yc, param = parameter)$param$add_fs_col, 14) 39 | expect_equivalent(createYaml(yc, param = parameter)$param$param_OutputFormats, "txt") 40 | 41 | ##test default values 42 | yc <- YAMLClass$new(list()) 43 | 44 | expect_equivalent(createYaml(yc)$param$param_PG_intThresh, 25) 45 | expect_equivalent(createYaml(yc)$param$param_OutputFormats, c("html", "plainPDF")) 46 | 47 | 48 | ## 49 | ##test metrics deactivation (all except qcMetric_PAR) 50 | ## 51 | yc <- YAMLClass$new(list()) 52 | 53 | mets <- "qcMetric_PAR" 54 | expect_equal(createYaml(yc, param = parameter, metrics = mets)$yc$yamlObj$order$qcMetric_EVD_UpSet, -1) 55 | expect_equal(createYaml(yc, param = parameter, metrics = mets)$yc$yamlObj$order$qcMetric_PAR, 1) 56 | 57 | ##test no deactivation 58 | yc <- YAMLClass$new(list()) 59 | expect_false(any(createYaml(yc)$yc$yamlObj$order < 1)) 60 | 61 | }) 62 | 63 | 64 | -------------------------------------------------------------------------------- /man/getReportFilenames.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{getReportFilenames} 4 | \alias{getReportFilenames} 5 | \title{Assembles a list of output file names, which will be created during reporting.} 6 | \usage{ 7 | getReportFilenames( 8 | folder, 9 | report_name_has_folder = TRUE, 10 | mzTab_filename = NULL 11 | ) 12 | } 13 | \arguments{ 14 | \item{folder}{Directory where the MaxQuant output (txt folder) or the mzTab file resides} 15 | 16 | \item{report_name_has_folder}{Boolean: Should the report files (html, pdf) contain the name 17 | of the deepest(=last) subdirectory in **txt_folder** which is not `txt`? 18 | Useful for discerning different reports in a PDF viewer. 19 | E.g. when flag is FALSE: `report_v0.91.0.html`; and `report_v0.91.0_bloodStudy.html` when flag is TRUE (and the 20 | txt folder is `.../bloodStudy/txt/` or `...bloodStudy/`)} 21 | 22 | \item{mzTab_filename}{If input is an mzTab, specify its name, so that the filenames can use its basename as infix 23 | E.g. when `mzTab_filename = 'HEK293-study.mzTab'` then the output will be 24 | `report_HEK293-study.html`. 25 | This allows to get reports on multiple mzTabs in the same folder without overwriting report results.} 26 | } 27 | \value{ 28 | List of output file names (just names, no file is created) 29 | with list entries: 30 | **yaml_file**, **heatmap_values_file**, **R_plots_file**, **filename_sorting**, **mzQC_file**, **log_file**, **report_file_prefix**, **report_file_PDF**, **report_file_HTML** 31 | } 32 | \description{ 33 | You can combine **report_name_has_folder** (and **mzTab_filename** for mzTab files) to obtain report filenames which are even more 34 | robust to moving around (since they contain infixes of the mzTab filename and the folder), 35 | e.g. `@em `report_HEK293-study_myProjects.html``, where the input 36 | was `mzTab_filename='HEK293-study.mzTab` and `folder='c:/somePath/myProjects/`. 37 | } 38 | -------------------------------------------------------------------------------- /man/plot_MBRAlign.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_plots.R 3 | \name{plot_MBRAlign} 4 | \alias{plot_MBRAlign} 5 | \title{Plot MaxQuant Match-between-runs alignment performance.} 6 | \usage{ 7 | plot_MBRAlign(data, y_lim, title_sub, match_tol) 8 | } 9 | \arguments{ 10 | \item{data}{A data.frame with columns as described above} 11 | 12 | \item{y_lim}{Plot range of y-axis} 13 | 14 | \item{title_sub}{Subtitle} 15 | 16 | \item{match_tol}{Maximal residual RT delta to reference (usually ~1 min)} 17 | } 18 | \value{ 19 | GGplot object 20 | } 21 | \description{ 22 | The plots shows the correction function applied by MaxQuant, and the 23 | residual RT (ideally 0) of each peptide to its reference. Uncalibrated peptides 24 | are shown in red, calibrated ones in green. 25 | The MaxQuant RT correction which was applied prior is shown in blue. The range of this function 26 | can give hints if the allowed RT search window (20min by default) is sufficient or if 27 | MaxQuant should be re-run with more tolerant settings. 28 | } 29 | \details{ 30 | The input is a data.frame with columns 31 | 'calibrated.retention.time' - resulting (hopefully) calibratated RT after MQ-recal (the X-axis of the plot) 32 | 'retention.time.calibration' - delta applied by MaxQuant 33 | 'rtdiff' - remaining RT diff to reference peptide of the same sequence 34 | 'RTdiff_in' - is the feature aligned (within 'match_tol')? 35 | 'fc.raw.file_ext' - raw file 36 | where each row represents one peptide whose RT was corrected by MaxQuant. 37 | } 38 | \examples{ 39 | 40 | data = data.frame(fc.raw.file_ext = "file A", ## more than one would be possible 41 | calibrated.retention.time = c(20:100), 42 | retention.time.calibration = 6 + sin((20:100)/10)) 43 | data$rtdiff = rnorm(nrow(data)) 44 | data$RTdiff_in = c("green", "red")[1 + (abs(data$rtdiff) > 0.7)] 45 | 46 | plot_MBRAlign(data, c(-10, 10), "fancy subtitle", 0.7) 47 | 48 | } 49 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ### Contributing - Get Involved! 2 | 3 | We welcome input from our user base! 4 | PTX-QC has a very permissive **BSD-3 clause License** (see [DESCRIPTION](DESCRIPTION) file), so feel free to fork, patch and contribute! 5 | There are many ways to get involved, _you do not need to be a developer_! 6 | - suggest a new metric (and why you think it's useful) by opening [a new ticket][issuetracker] here on GitHub. 7 | - suggest changes to existing metrics (improvements or bugfixes), see above. 8 | - suggest improvements to our documentation (e.g. [additional vignettes][Ref_Vign]) 9 | - write code (in R) and submit a [Pull Request (PR)][PullRequest]. 10 | 11 | ### Bug reporting / Feature requests 12 | 13 | If you encounter a bug, e.g. error message, wrong figures, missing axis annotation or anything which looks 14 | suspicious, please use the [GitHub issue tracker][issuetracker] and file a report. 15 | 16 | You should include 17 | - **stage** you encounter the bug, e.g. during installation, report creation, or after report creation (i.e. a bug in the report itself). 18 | - **PDF/Html report** itself (if one was generated). 19 | - **version of PTXQC**, e.g. see the report_XXX.pdf/html (where XXX will be the version) or see the DESCRIPTION file of the PTXQC package or call `help(package="PTXQC")` within R 20 | - **error message** (very important!). Either copy it or provide a screen shot. 21 | 22 | Please be as precise as possible when providing the bug report - just imagine what kind of information you would like to have in order 23 | to track down the issue. 24 | In certain situations, the whole txt-folder or a single MaxQuant/mzTab file might be helpful to solve the problem. 25 | 26 | 27 | For more information, e.g. installation, please visit the main [README.md](https://github.com/cbielow/PTXQC) of PTX-QC. 28 | 29 | [issuetracker]: https://github.com/cbielow/PTXQC/issues 30 | [PullRequest]: https://github.com/cbielow/PTXQC/pulls 31 | [Ref_Vign]: https://github.com/cbielow/PTXQC/tree/master/vignettes 32 | -------------------------------------------------------------------------------- /man/MzTabReader-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/MzTabReader.R 3 | \docType{class} 4 | \name{MzTabReader-class} 5 | \alias{MzTabReader-class} 6 | \alias{MzTabReader} 7 | \title{Class to read an mzTab file and store the tables internally.} 8 | \description{ 9 | The 'sections' field is initialized after $readMzTab was called. 10 | The 'fn_map' fields should be initialized via ...$fn_map$readMappingFile(...) manually if user-defined filename mappings are desired 11 | and is automatically updated/queried when $readMzTab is called. 12 | } 13 | \section{Fields}{ 14 | 15 | \describe{ 16 | \item{\code{sections}}{MzTab sections as list. Valid list entries are: "MTD", "PRT", "PEP", "PSM", "SML", "filename" and "comments"} 17 | 18 | \item{\code{fn_map}}{FilenameMapper which can translate raw filenames into something shorter} 19 | }} 20 | 21 | \section{Methods}{ 22 | 23 | \describe{ 24 | \item{\code{RTUnitCorrection(dt)}}{Convert all RT columns from seconds (OpenMS default) to minutes (MaxQuant default)} 25 | 26 | \item{\code{getEvidence()}}{Basically the PSM table and additionally columns named 'raw.file' and 'fc.raw.file'.} 27 | 28 | \item{\code{getMSMSScans(identified_only = FALSE)}}{Basically the PSM table (partially renamed columns) and additionally two columns 'raw.file' and 'fc.raw.file'. 29 | If identified_only is TRUE, only MS2 scans which were identified (i.e. a PSM) are returned -- this is equivalent to msms.txt in MaxQuant.} 30 | 31 | \item{\code{getParameters()}}{Converts internal mzTab metadata section to a two column key-value data.frame similar to MaxQuants parameters.txt.} 32 | 33 | \item{\code{getProteins()}}{Basically the PRT table ...} 34 | 35 | \item{\code{getSummary()}}{Converts internal mzTab metadata section to a two data.frame with columns 'fc.raw.file', 'ms.ms.identified....' 36 | similar to MaxQuants summary.txt.} 37 | 38 | \item{\code{renameColumns(dt, namelist)}}{Renames all columns and throws a warning if a column does not exist in the data} 39 | }} 40 | 41 | -------------------------------------------------------------------------------- /man/peakSegmentation.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_MQalign.R 3 | \name{peakSegmentation} 4 | \alias{peakSegmentation} 5 | \title{Determine fraction of evidence which causes segmentation, i.e. sibling peaks at different RTs 6 | confirmed either by genuine or transferred MS/MS.} 7 | \usage{ 8 | peakSegmentation(df_evd_all) 9 | } 10 | \arguments{ 11 | \item{df_evd_all}{A data.frame of evidences containing the above columns} 12 | } 13 | \value{ 14 | A data.frame with one row per Raw file and 15 | three columns: 16 | 1) % of native single peaks (ignoring transferred IDs) 17 | 2) % of single peaks (group of size=1) using only groups which have one transferred evidence 18 | 3) % of single peaks using all groups 19 | } 20 | \description{ 21 | Sometimes, MQ splits a feature into 2 or more if the chromatograpic conditions are not optimal and there 22 | is a drop in RT intensity. 23 | If both features contain successful MS/MS scans, we will find the same peptide twice (with slightly different RT) 24 | in the same charge state. This constitutes a natively split peak and is rare (95% of all genuine peaks are unique). 25 | } 26 | \details{ 27 | If Match-between-runs is used and the RT alignment is not perfect, then a peptide might be inferred at a wrong 28 | RT position, even though this Raw file already contains MS/MS evidence of this peptide. 29 | Usually the number of peak duplicates rises drastically (e.g. only 75% of peaks are unique after MBR was used). 30 | In most cases, the RT is too far off to be a split peak. It's rather a lucky hit with accidentally the same mass-to-charge, 31 | and thus the intensity is random. 32 | To find by how much these peak pairs differ in RT, use idTransferCheck() and inMatchWindow(). 33 | 34 | Required columns are 'is.transferred', 'fc.raw.file', 'modified.sequence', 'charge', 'type'. 35 | 36 | Note that this function must be given MS/MS identifications of type "MULTI-MSMS" and "MSMS-MATCH". 37 | It will stop() otherwise. 38 | } 39 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /man/correctSetSize.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_misc.R 3 | \name{correctSetSize} 4 | \alias{correctSetSize} 5 | \title{Re-estimate a new set size to split a number of items into equally sized sets.} 6 | \usage{ 7 | correctSetSize(item_count, initial_set_size) 8 | } 9 | \arguments{ 10 | \item{item_count}{Known number of items which need to assigned to sets} 11 | 12 | \item{initial_set_size}{Desired number of items a single set should hold} 13 | } 14 | \value{ 15 | re-estimated set size which a set should hold in order to avoid underfilled sets 16 | } 17 | \description{ 18 | This is useful for plotting large datasets where multiple pages are needed. 19 | E.g. you know that you need 101 barplots, but you only want to fit about 25 per page. 20 | Naively one would now do five plots, with the last one only containing a single barplot. 21 | Using this function with correctSetSize(101, 25) would tell you to use 26 barplots per page, 22 | so you end up with four plots, all roughly equally filled. 23 | It also works the other extreme case, where your initial size is chosen slightly too high, e.g. 24 | Sets of size 5 for just 8 items is too much, because we can reduce the set size to 4 and still 25 | need two sets but now they are much more equally filled (correctSetSize(8, 5) == 4). 26 | } 27 | \details{ 28 | We allow for up to set sizes of 150\% from default, to avoid the last set being sparse (we remove it and distribute to the other bins) 29 | 150%\ oversize is the extreme case, which only happens with sets of size two. With more sets the overhead is much smaller (1/X). 30 | Once the number of sets is fixed, we distribute all items equally. 31 | 32 | E.g. 6 items & initial_set_size=5, would result in 2 bins (5 items, 1 item), but we'd rather have one bin of 6 items 33 | or 8 items & initial_set_size=5, would result in 2 bins (5+3 items), since the last set is more than half full, but we'd rather have 4+4 34 | } 35 | \examples{ 36 | stopifnot( 37 | correctSetSize(8, 5) == 4 38 | ) 39 | stopifnot( 40 | correctSetSize(101, 25) == 26 41 | ) 42 | 43 | } 44 | -------------------------------------------------------------------------------- /R/modsToTableByRaw.R: -------------------------------------------------------------------------------- 1 | #' 2 | #' Convert list of (mixed)modifications to a frequency table 3 | #' 4 | #' @param df_evd data.frame with 'fc.raw.file' and a 'modifications' column, which contains the modifications for each peptide. 5 | #' @param name_unmod String in 'modifications' which represents an unmodified peptide 6 | #' @param name_unmod_inverse If non-empty, then inverse the frequencies of the 'name_unmod' modifications (i.e. 100-x) IFF they are >=50\% on average (across Raw files) and rename them to this string 7 | #' @return A data.table with 'fc.raw.file', 'modification_names' (factor), and 'Freq' (0-100) 8 | #' 9 | #' @export 10 | #' 11 | #' @examples 12 | #' data = data.frame(fc.raw.file = rep(c("file A", "file B"), 13 | #' each = 3), 14 | #' modifications = c("Oxidation (M)", 15 | #' "Unmodified", 16 | #' "Oxidation (M),Acetyl (Protein N-term)", 17 | #' "2 Oxidation (M)", 18 | #' "Unmodified", "Unmodified")) 19 | #' modsToTableByRaw(data) 20 | #' 21 | #' 22 | modsToTableByRaw = function(df_evd, name_unmod = "Unmodified", name_unmod_inverse = "Modified (total)") 23 | { 24 | fc.raw.file <- modification_names <- Freq <- NULL ## make R check happy and avoid 'no visible binding for global variable' 25 | dt_evd = data.table::data.table(df_evd) 26 | mods_tbl = dt_evd[, modsToTable(.SD$modifications), by = fc.raw.file] 27 | 28 | mods_tbl$modification_names = as.factor(mods_tbl$modification_names) ## ensure all mods are known when subsetting the data later 29 | 30 | ## inverse frequencies for 'modified' if they are >=50% (to make the plot more compact) 31 | if (nchar(name_unmod_inverse)){ 32 | if (mean(mods_tbl[modification_names==name_unmod, Freq]) > 50) 33 | { 34 | mods_tbl[modification_names==name_unmod, Freq := 100 - Freq] 35 | mods_tbl[modification_names==name_unmod, modification_names := name_unmod_inverse] 36 | } 37 | mods_tbl = droplevels(mods_tbl) ## drop 'Unmodified' level 38 | } 39 | 40 | return(as.data.frame(mods_tbl)) 41 | } 42 | -------------------------------------------------------------------------------- /man/qualUniform.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fcn_qualities.R 3 | \name{qualUniform} 4 | \alias{qualUniform} 5 | \title{Compute deviation from uniform distribution} 6 | \usage{ 7 | qualUniform(x, weight = vector()) 8 | } 9 | \arguments{ 10 | \item{x}{Vector of numeric intensity/count values (e.g. ID's per RT bin); bins are assumed to have equal widths} 11 | 12 | \item{weight}{Vector of weights for values in 'x' (same length as 'x').} 13 | } 14 | \value{ 15 | Value between [0, 1] 16 | } 17 | \description{ 18 | The score ranges between 0 (worst score) and 1 (best score). 19 | Input 'x' is a vector of counts (or probabilities) for equally spaced bins in a histogram. 20 | A uniform distribution (e.g. c(3,3,3) will get a score of 1. The worst possible case (e.g. c(4,0,0)), will get a score of 0, 21 | and a linear increasing function (e.g. c(1,2,3)) will get something in between (0.585 here) 22 | } 23 | \details{ 24 | In addition, bin values can be weighted (e.g. by their confidence). The total sum of weights is normalized to 1 internally. 25 | 26 | The distance function used is the square root of the absolute difference between a uniform distribution and the input 'x' 27 | (summed for each element of 'x'). 28 | This distance is normalized to the worst possible input (e.g. one bin with 100% counts, all other bins being empty). 29 | } 30 | \examples{ 31 | stopifnot(qualUniform(c(3,3,3))==1) 32 | stopifnot(qualUniform(c(4,0,0))==0) 33 | 34 | ## how 'uniform' is a vector where only a single index has weight?-- answer: very 35 | stopifnot(qualUniform(c(4,0,0), c(1,0,0))==1) 36 | stopifnot(qualUniform(c(4,0,0), c(0,1,0))==1) 37 | stopifnot(qualUniform(c(0,4,0))==0) 38 | stopifnot(abs(qualUniform(c(3,2,1))-0.58578) < 0.0001) 39 | stopifnot(abs(qualUniform(c(1,2,3))-0.58578) < 0.0001) 40 | stopifnot(qualUniform(c(1,2,3), c(0,1,0))==1) 41 | stopifnot(abs(qualUniform(c(1,2,3))-0.58578) < 0.0001) 42 | stopifnot(abs(qualUniform(c(1,2,3), c(0,1,1))- 0.590316) < 0.0001) 43 | stopifnot(abs(qualUniform(c(2,3), c(1,1))-0.552786) < 0.0001) 44 | stopifnot(abs(qualUniform(1:120)-0.38661) < 0.0001) 45 | 46 | } 47 | -------------------------------------------------------------------------------- /R/PTXQC-package.R: -------------------------------------------------------------------------------- 1 | #' PTXQC: A package for computing Quality Control (QC) metrics for Proteomics (PTX) 2 | #' 3 | #' The following sections describe the main components: 4 | #' 5 | #' @section Input: 6 | #' Valid input data are either the files from MaxQuant's .txt folder (all versions from MaxQuant >= 1.0 upwards are supported) 7 | #' or a single mzTab file. All mzTab files will work, but most metrics can be obtained from OpenMS' mzTab as produced 8 | #' by the QualityControl TOPP tool (from OpenMS 2.5 onwards). 9 | #' 10 | #' @section Important functions: 11 | #' The central function of this package is called \code{\link{createReport}} and it accepts either MaxQuant or mzTab data, along with 12 | #' a configuration (optional). 13 | #' There is a parser for mzTab \code{\link{MzTabReader}} and MaxQuant txt files \code{\link{MQDataReader}}, as well as a plethora of QC metrics 14 | #' derived from a common \code{\link{qcMetric}} class and scoring functions \code{qual...}, e.g. \code{\link{qualGaussDev}}. 15 | #' 16 | #' @section Configuration: 17 | #' The user can modify the behaviour of PTXQC, e.g. to enable/disable certain metrics or change scoring thresholds, via a YAML object/file. 18 | #' By default a Yaml file is written automatically side-by-side to the input files upon running PTXQC for the first time on a particular input. 19 | #' A custom Yaml object can be passed to the main \code{\link{createReport}} function for customization. 20 | #' Use \code{yaml::yaml.load_file(input = 'myYAML.yaml')} to load an existing file and pass the Yaml object along. 21 | #' 22 | #' @section Output: 23 | #' Either a PDF and/or Html report which contains QC plots and a description of the metrics. 24 | #' 25 | "_PACKAGE" 26 | #' @name PTXQC 27 | #' @title Quality control for proteomics data 28 | #' 29 | #' @import data.table 30 | #' @import ggplot2 31 | #' @import ggdendro 32 | #' @import grid 33 | #' @import gridExtra 34 | #' @import grDevices 35 | #' @import gtable 36 | #' @import knitr 37 | #' @import methods 38 | #' @import plyr 39 | #' @import R6 40 | #' @import R6P 41 | #' @import RColorBrewer 42 | #' @rawNamespace import(reshape2, except = c(dcast, melt)) 43 | #' @import rmarkdown 44 | #' @importFrom seqinr circle 45 | #' @import stats 46 | #' @import utils 47 | #' @import UpSetR 48 | #' @import xml2 49 | #' @import yaml 50 | #' 51 | NULL -------------------------------------------------------------------------------- /man/createReport.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createReport.R 3 | \name{createReport} 4 | \alias{createReport} 5 | \title{Create a quality control report (in PDF format).} 6 | \usage{ 7 | createReport( 8 | txt_folder = NULL, 9 | mztab_file = NULL, 10 | yaml_obj = list(), 11 | report_filenames = NULL, 12 | enable_log = FALSE 13 | ) 14 | } 15 | \arguments{ 16 | \item{txt_folder}{Path to txt output folder of MaxQuant (e.g. "c:/data/Hek293/txt")} 17 | 18 | \item{mztab_file}{Alternative to **txt_folder**, you can provide a single mzTab file which contains PSM, PEP and PRT tables} 19 | 20 | \item{yaml_obj}{A nested list object with configuration parameters for the report. 21 | Useful to switch off certain plots or skip entire sections.} 22 | 23 | \item{report_filenames}{Optional list with names (as generated by \code{\link{getReportFilenames}}). 24 | If not provided, will be created internally by calling \code{\link{getReportFilenames}}.} 25 | 26 | \item{enable_log}{If TRUE all console output (including warnings and errors) is logged to the file given in **report_filenames$log_file**. 27 | Note: warnings/errors can only be shown in either the log **or** the console, not both!} 28 | } 29 | \value{ 30 | List with named filename strings, e.g. $yaml_file, $report_file etc.. 31 | } 32 | \description{ 33 | This is the main function of the package and the only thing you need to call directly if you are 34 | just interested in getting a QC report. 35 | } 36 | \details{ 37 | You need to provide either 38 | a) the folder name of the 'txt' output, as generated by MaxQuant or an mzTab file 39 | or b) an mzTab file as generated by the OpenMS QualityControl TOPP tool (other mzTab files will probably not work) 40 | 41 | Optionally, provide a YAML configuration object, which allows to (de)activate certain plots and holds other parameters. 42 | The yaml_obj is complex and best obtained by running this function once using the default (empty list). 43 | A full YAML configuration object will be written in the 'txt' folder you provide and can be loaded using 44 | \code{\link[yaml]{yaml.load}}. 45 | 46 | The PDF and the config file will be stored in the given txt folder. 47 | } 48 | \note{ 49 | You need write access to the txt/mzTab folder! 50 | 51 | For updates, bug fixes and feedback please visit \url{https://github.com/cbielow/PTXQC}. 52 | } 53 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: PTXQC 2 | Type: Package 3 | Title: Quality Report Generation for MaxQuant and mzTab Results 4 | Version: 1.1.3 5 | Date: 2025-07-15 6 | Authors@R: c(person(given = "Chris", 7 | family = "Bielow", 8 | role = c("aut", "cre"), 9 | email = "chris.bielow@bsc.fu-berlin.de"), 10 | person(given = "Juliane", 11 | family = "Schmachtenberg", 12 | role = "ctb"), 13 | person(given = "Swenja", 14 | family = "Wagner", 15 | role = "ctb"), 16 | person(given = "Patricia", 17 | family = "Scheil", 18 | role = "ctb"), 19 | person(given = "Tom", 20 | family = "Waschischek", 21 | role = "ctb"), 22 | person(given = "Guido", 23 | family = "Mastrobuoni", 24 | role = c("dtc", "rev"))) 25 | Description: Generates Proteomics (PTX) quality control (QC) reports for shotgun LC-MS data analyzed with the 26 | MaxQuant software suite (from .txt files) or mzTab files (ideally from OpenMS 'QualityControl' tool). 27 | Reports are customizable (target thresholds, subsetting) and available in HTML or PDF format. 28 | Published in J. Proteome Res., Proteomics Quality Control: Quality Control Software for MaxQuant Results (2015) 29 | . 30 | SystemRequirements: pandoc (http://pandoc.org) for building Vignettes and output reports as HTML 31 | Depends: 32 | R (>= 3.3.0) 33 | Imports: 34 | data.table, 35 | ggplot2 (>= 3.4), 36 | ggdendro, 37 | grid, 38 | gridExtra, 39 | grDevices, 40 | gtable, 41 | htmlTable, 42 | knitr (>= 1.10), 43 | magrittr, 44 | methods, 45 | plyr, 46 | R6, 47 | R6P, 48 | RColorBrewer, 49 | reshape2, 50 | rlang, 51 | rmarkdown, 52 | rmzqc (>= 0.5.0), 53 | seqinr, 54 | stats, 55 | utils, 56 | UpSetR, 57 | xml2, 58 | yaml 59 | Suggests: 60 | testthat 61 | VignetteBuilder: knitr 62 | License: BSD_3_clause + file LICENSE 63 | Encoding: UTF-8 64 | Roxygen: list() 65 | RoxygenNote: 7.3.2 66 | URL: https://github.com/cbielow/PTXQC 67 | BugReports: https://github.com/cbielow/PTXQC/issues 68 | -------------------------------------------------------------------------------- /man/PTXQC-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/PTXQC-package.R 3 | \docType{package} 4 | \name{PTXQC-package} 5 | \alias{PTXQC-package} 6 | \title{PTXQC: A package for computing Quality Control (QC) metrics for Proteomics (PTX)} 7 | \description{ 8 | The following sections describe the main components: 9 | } 10 | \section{Input}{ 11 | 12 | Valid input data are either the files from MaxQuant's .txt folder (all versions from MaxQuant >= 1.0 upwards are supported) 13 | or a single mzTab file. All mzTab files will work, but most metrics can be obtained from OpenMS' mzTab as produced 14 | by the QualityControl TOPP tool (from OpenMS 2.5 onwards). 15 | } 16 | 17 | \section{Important functions}{ 18 | 19 | The central function of this package is called \code{\link{createReport}} and it accepts either MaxQuant or mzTab data, along with 20 | a configuration (optional). 21 | There is a parser for mzTab \code{\link{MzTabReader}} and MaxQuant txt files \code{\link{MQDataReader}}, as well as a plethora of QC metrics 22 | derived from a common \code{\link{qcMetric}} class and scoring functions \code{qual...}, e.g. \code{\link{qualGaussDev}}. 23 | } 24 | 25 | \section{Configuration}{ 26 | 27 | The user can modify the behaviour of PTXQC, e.g. to enable/disable certain metrics or change scoring thresholds, via a YAML object/file. 28 | By default a Yaml file is written automatically side-by-side to the input files upon running PTXQC for the first time on a particular input. 29 | A custom Yaml object can be passed to the main \code{\link{createReport}} function for customization. 30 | Use \code{yaml::yaml.load_file(input = 'myYAML.yaml')} to load an existing file and pass the Yaml object along. 31 | } 32 | 33 | \section{Output}{ 34 | 35 | Either a PDF and/or Html report which contains QC plots and a description of the metrics. 36 | } 37 | 38 | \seealso{ 39 | Useful links: 40 | \itemize{ 41 | \item \url{https://github.com/cbielow/PTXQC} 42 | \item Report bugs at \url{https://github.com/cbielow/PTXQC/issues} 43 | } 44 | 45 | } 46 | \author{ 47 | \strong{Maintainer}: Chris Bielow \email{chris.bielow@bsc.fu-berlin.de} 48 | 49 | Other contributors: 50 | \itemize{ 51 | \item Juliane Schmachtenberg [contributor] 52 | \item Swenja Wagner [contributor] 53 | \item Patricia Scheil [contributor] 54 | \item Tom Waschischek [contributor] 55 | \item Guido Mastrobuoni [data contributor, reviewer] 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /R/qcMetric_EVD_modTable.R: -------------------------------------------------------------------------------- 1 | qcMetric_EVD_modTable = setRefClass( 2 | "qcMetric_EVD_modTable", 3 | contains = "qcMetric", 4 | methods = list(initialize=function() { callSuper( 5 | helpTextTemplate = 6 | "Compute an occurence table of modifications (e.g. Oxidation (M)) for all peptides, including the unmodified. 7 | 8 | The plot will show percentages, i.e. is normalized by the total number of peptide sequences (where different charge state counts as a separate peptide) per Raw file. 9 | 10 | The sum of frequencies may exceed 100% per Raw file, since a peptide can have multiple modifications. 11 | E.g. given three peptides in a single Raw file
12 | 1. _M(Oxidation (M))LVLDEADEM(Oxidation (M))LNK_
13 | 2. _(Acetyl (Protein N-term))M(Oxidation (M))YGLLLENLSEYIK_
14 | 3. DPFIANGER
15 | 16 | , the following frequencies arise: 17 | 18 | * 33% of 'Acetyl (Protein N-term)'
19 | * 33% of 'Oxidation (M)'
20 | * 33% of '2 Oxidation (M)'
21 | * 33% of 'Unmodified'
22 | 23 | Thus, 33% of sequences are unmodified, implying 66% are modified at least once. 24 | If a modification, e.g. Oxidation(M), occurs multiple times in a single peptide it's listed as a separate modification (here '2 Oxidation (M)'). 25 | 26 | Heatmap score [EVD: Pep ModTable]: Deviation of (unmodified peptides fraction) when compared to a representative Raw file ('qualMedianDist' function). 27 | ", 28 | workerFcn = function(.self, df_evd) 29 | { 30 | ## completeness check 31 | if (!checkInput(c("fc.raw.file", "modifications"), df_evd)) return() 32 | 33 | name_unmod = "Unmodified" 34 | name_unmod_inverse = "Modified (total)" 35 | tbl = modsToTableByRaw(df_evd, name_unmod, name_unmod_inverse) 36 | lpl = byXflex(tbl, tbl$fc.raw.file, FUN = plot_peptideMods) 37 | #for (pl in lpl) print(pl) 38 | 39 | ## QC measure: deviation from representative sample (in terms of unmodified peptide count) 40 | qc_mods = tbl[tbl$modification_names %in% c(name_unmod, name_unmod_inverse),] 41 | qc_mods[, .self$qcName] = qualMedianDist(qc_mods$Freq / 100) 42 | 43 | return(list(plots = lpl, qcScores = qc_mods[, c("fc.raw.file", .self$qcName)])) 44 | }, 45 | qcCat = "prep", 46 | qcName = "EVD:~Peptide~VarMod", 47 | orderNr = 0103 48 | ) 49 | return(.self) 50 | }) 51 | ) 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /R/plot_peptideMods.R: -------------------------------------------------------------------------------- 1 | 2 | #' 3 | #' Plot peptide modification frequencies 4 | #' 5 | #' The input is a data.frame, as obtained from modsToTableByRaw(). 6 | #' 7 | #' 8 | #' 9 | #' @param tbl A data.frame with 'fc.raw.file', 'modification_names' (can be a factor), and 'Freq' (0-100) 10 | #' @param y_max The upper limit of the y-axis's (==Freq); useful for multiple plots with identical limits; if 'NA' the limit is computed from the given 'tbl' 11 | #' @param show_missing_modification_levels If 'tbl$modification_names' is a factor and has more (but missing) levels than actually used, should missing values be dropped or assumed as '0' frequency? 12 | #' @return GGplot object 13 | #' 14 | #' @import ggplot2 15 | #' @export 16 | #' 17 | #' @examples 18 | #' 19 | #' data = data.frame(fc.raw.file = rep(c("file A", "file B"), each=3), 20 | #' modifications = c("Oxidation (M)", 21 | #' "Unmodified", 22 | #' "Oxidation (M), Acetyl (Protein N-term)", 23 | #' "2 Oxidation (M)", 24 | #' "Unmodified", 25 | #' "Unmodified")) 26 | #' tbl = modsToTableByRaw(data) 27 | #' plot_peptideMods(tbl,show_missing_modification_levels = TRUE) 28 | #' 29 | plot_peptideMods = function(tbl, y_max = NA, show_missing_modification_levels = TRUE) 30 | { 31 | if (is.na(y_max)){ 32 | y_max = max(tbl$Freq, na.rm = TRUE) 33 | } 34 | 35 | ## augment '0'-frequency for missing factors 36 | if (show_missing_modification_levels) { 37 | tbl$fc.raw.file = droplevels(as.factor(tbl$fc.raw.file)) ## we need fc.raw.file to be a factor, but we do not want its unused levels 38 | all_combinations = expand.grid(lapply(tbl[c("fc.raw.file","modification_names")], levels)) 39 | new_tbl = merge(tbl, all_combinations , all.y=TRUE) 40 | new_tbl$Freq[is.na(new_tbl$Freq)] = 0 ## replace new 'NA's with 0 41 | tbl = new_tbl 42 | } 43 | 44 | p = ggplot(tbl, aes(x = .data$fc.raw.file, y = .data$Freq, fill = .data$modification_names, colour = .data$modification_names)) + ## use 'colour' for outline of '0'-frequency features (invisible otherwise) 45 | geom_col(position = "dodge") + 46 | xlab("") + 47 | ylab("Occurence [%]") + 48 | scale_x_discrete_reverse(tbl$fc.raw.file) + 49 | guides(fill = guide_legend(reverse = TRUE), color = guide_none()) + ## reverse order of mods in legend, to match order in plot 50 | ylim(0, y_max) + 51 | ggtitle("EVD: variable modifications per Raw file") + 52 | coord_flip() 53 | return(p) 54 | } 55 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(print,PTXQC_table) 4 | export(FilenameMapper) 5 | export(LCS) 6 | export(LCSn) 7 | export(QCMetaFilenames) 8 | export(RTalignmentTree) 9 | export(YAMLClass) 10 | export(assembleMZQC) 11 | export(assignBlocks) 12 | export(boxplotCompare) 13 | export(byX) 14 | export(byXflex) 15 | export(correctSetSize) 16 | export(createReport) 17 | export(createYaml) 18 | export(delLCP) 19 | export(delLCS) 20 | export(getECDF) 21 | export(getFragmentErrors) 22 | export(getHTMLTable) 23 | export(getMQPARValue) 24 | export(getMaxima) 25 | export(getPCA) 26 | export(getReportFilenames) 27 | export(grepv) 28 | export(lcpCount) 29 | export(lcsCount) 30 | export(longestCommonPrefix) 31 | export(longestCommonSuffix) 32 | export(modsToTable) 33 | export(modsToTableByRaw) 34 | export(mosaicize) 35 | export(pasten) 36 | export(pastet) 37 | export(peakWidthOverTime) 38 | export(plotTable) 39 | export(plot_CalibratedMSErr) 40 | export(plot_Charge) 41 | export(plot_ContEVD) 42 | export(plot_ContUser) 43 | export(plot_ContUserScore) 44 | export(plot_ContsPG) 45 | export(plot_CountData) 46 | export(plot_DataOverRT) 47 | export(plot_IDRate) 48 | export(plot_IDsOverRT) 49 | export(plot_IonInjectionTimeOverRT) 50 | export(plot_MBRAlign) 51 | export(plot_MBRIDtransfer) 52 | export(plot_MBRgain) 53 | export(plot_MS2Decal) 54 | export(plot_MS2Oversampling) 55 | export(plot_MissedCleavages) 56 | export(plot_RTPeakWidth) 57 | export(plot_RatiosPG) 58 | export(plot_ScanIDRate) 59 | export(plot_TIC) 60 | export(plot_TopN) 61 | export(plot_TopNoverRT) 62 | export(plot_UncalibratedMSErr) 63 | export(plot_peptideMods) 64 | export(pointsPutX) 65 | export(qcMetric) 66 | export(qualBestKS) 67 | export(qualCentered) 68 | export(qualCenteredRef) 69 | export(qualGaussDev) 70 | export(qualHighest) 71 | export(qualLinThresh) 72 | export(qualMedianDist) 73 | export(qualUniform) 74 | export(read.MQ) 75 | export(renameFile) 76 | export(repEach) 77 | export(shortenStrings) 78 | export(simplifyNames) 79 | export(supCount) 80 | export(theme_blank) 81 | exportClasses(FilenameMapper) 82 | exportClasses(YAMLClass) 83 | exportClasses(qcMetric) 84 | import(R6) 85 | import(R6P) 86 | import(RColorBrewer) 87 | import(UpSetR) 88 | import(data.table) 89 | import(ggdendro) 90 | import(ggplot2) 91 | import(grDevices) 92 | import(grid) 93 | import(gridExtra) 94 | import(gtable) 95 | import(htmlTable) 96 | import(knitr) 97 | import(magrittr) 98 | import(methods) 99 | import(plyr) 100 | import(reshape2, except = c(dcast, melt)) 101 | import(rmarkdown) 102 | import(rmzqc) 103 | import(stats) 104 | import(utils) 105 | import(xml2) 106 | import(yaml) 107 | importFrom(seqinr,circle) 108 | -------------------------------------------------------------------------------- /R/fcn_mqpar.R: -------------------------------------------------------------------------------- 1 | 2 | #' Retrieve a parameter value from a mqpar.xml file 3 | #' 4 | #' If the file has the param, then return it as string. 5 | #' If the file is missing, warning is shown and NULL is returned. 6 | #' If the param (i.e. XML tag) is unknown or cannot be extracted, the program will quit (since this is a hard error). 7 | #' When multiple occurrences of the param are found (usually due to parameter groups), we test if the values are all identical. 8 | #' If so, the value is returned. If the values are different, a warning is emitted and NULL is returned unless 'allow_multiple = TRUE' 9 | #' 10 | #' E.g. calling getMQPARValue("mqpar.xml", "//firstSearchTol") 11 | #' will look up the line 12 | #' 20 13 | #' and return "20" (string!). 14 | #' 15 | #' 16 | #' @param mqpar_filename Filename (incl. absolute or relative path) to the mqpar.xml file 17 | #' @param xpath An XPath to extract the content of XML tag(s), e.g. '//firstSearchTol' 18 | #' @param allow_multiple If the XPath expression returns more than one value, all values must be identical (not allowing multiple different values) or 'stop()' is called 19 | #' 20 | #' @return The stored value as string(!) 21 | #' 22 | #' @export 23 | #' 24 | getMQPARValue = function(mqpar_filename, xpath, allow_multiple = FALSE) 25 | { 26 | #xpath = "//firstSearchTol" 27 | #mqpar_filename = txt_files$mqpar 28 | if (!file.exists(mqpar_filename)) { 29 | message("Info: The file '", mqpar_filename, "' was not found. MaxQuant parameters could not be extracted. Will fall back to default value, which however is only an approximation.", 30 | " Please either: a) copy the mqpar.xml which was used for this MQ analysis into your TXT folder or,", 31 | " b) make sure that you configure all YAML parameters whose name starts with 'MQpar_' correctly.", immediate. = TRUE) 32 | return (NULL) 33 | } 34 | 35 | lines = xml2::read_xml(mqpar_filename) 36 | ## is the tag present multiple times? (if yes, we found parameter groups) 37 | results = xml2::xml_text(xml2::xml_find_all(lines, xpath)) 38 | 39 | if (length(results) == 0) { 40 | stop("getMQPARValue(): The XPath '", xpath, "' was not found in the file '", mqpar_filename, "'. Please contact the package support.", call. = FALSE); 41 | } 42 | 43 | if ((allow_multiple == FALSE)) { 44 | 45 | if (length(unique(results)) == 1) { 46 | return (results[1]); 47 | } 48 | 49 | warning("getMQPARValue(): The XPath '", xpath, "' was found more than once in the file '", mqpar_filename, "' with different values (probably due to usage of parameter groups).", 50 | " PTXQC currently cannot deal with that -- the YAML param is going to be used. Sorry.", immediate. = TRUE); 51 | return (NULL); 52 | } 53 | 54 | ## all tests passed, return the result(s) 55 | return (results) 56 | } 57 | -------------------------------------------------------------------------------- /vignettes/PTXQC-Input_And_Output_Data.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Input/Output data for PTXQC" 3 | author: "Chris Bielow " 4 | date: '`r Sys.Date()`' 5 | output: 6 | html_document: default 7 | pdf_document: null 8 | vignette: > 9 | %\VignetteIndexEntry{Input/Output data for PTXQC} 10 | %\VignetteEngine{knitr::rmarkdown} 11 | \usepackage[utf8]{inputenc} 12 | --- 13 | 14 | # Input/Output data for PTXQC 15 | 16 | PTXQC generates quality control reports for [MaxQuant] txt data, and [OpenMS] mzTab data. 17 | 18 | ## Input 19 | 20 | When a full report is generated, PTXQC requires the following **input files**. 21 | 22 | MaxQuant: 23 | 24 | - parameters.txt 25 | - summary.txt 26 | - proteinGroups.txt 27 | - evidence.txt 28 | - msms.txt 29 | - msmsScans.txt 30 | 31 | These files can be found in the `/combined/txt` folder after MaxQuant analysis successfully finished. 32 | Here, `` is your main MaxQuant project folder containing your Raw files. 33 | 34 | OpenMS: 35 | 36 | - an .mzTab file from the QualityControl TOPP tool (see [OpenMSdoc] --> TOPP documentation --> QualityControl) 37 | 38 | Note: PTX-QC will compute all metrics for which input data is present. MzTab files from other software packages (even mzTab from MaxQuant) will be missing some data and thus only produce a small subset of metrics. 39 | 40 | 41 | If you are not interested in the full report, PTXQC can be configured to look only at some of these files by editing the YAML file. See the [PTX-CustomizeReport][Ref_VignCust] vignette 42 | ```{r, eval=FALSE} 43 | vignette("PTXQC-CustomizeReport", package = "PTXQC") 44 | ``` 45 | for details. Alternatively (for .txt input), you can rename any .txt file you want PTXQC to ignore. 46 | 47 | ## Output 48 | 49 | By default, PTXQC will generate a report in both **Html** and **PDF** format. 50 | 51 | To enable/disable a certain format (Html/PDF), just set it in the YAML config file (see above for the vignette hint on report customization). 52 | 53 | Further output files (with the same prefix name as the Html/PDF report), include 54 | 55 | - `report_vXXX_heatmap.txt` (values of the overview heatmap) 56 | - `report_vXXX_filename_sort.txt` (customize the order and naming of Raw files in the report) 57 | - `report_v0XXX.yaml` (the configuration file) 58 | 59 | The YAML configuration file is created the first time you run PTXQC on a txt-folder or mzTab file. Customize it as you see fit. 60 | 61 | Read more about `report_vXXX_filename_sort.txt` and `report_vXXX.yaml` in the [PTX-CustomizeReport][Ref_VignCust] vignette. 62 | 63 | 64 | [MaxQuant]: https://maxquant.org 65 | [OpenMS]: https://openms.de/ 66 | [OpenMSdoc]: https://abibuilder.cs.uni-tuebingen.de/archive/openms/Documentation/nightly/html/index.html 67 | [Ref_VignCust]: https://github.com/cbielow/PTXQC/blob/master/vignettes/PTXQC-CustomizeReport.Rmd 68 | 69 | -------------------------------------------------------------------------------- /vignettes/PTXQC-ListOfMetrics.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "List of Metrics" 3 | author: "Chris Bielow " 4 | date: '`r Sys.Date()`' 5 | output: 6 | html_document: 7 | mathjax: null 8 | number_sections: yes 9 | toc: no 10 | pdf_document: 11 | toc: no 12 | vignette: > 13 | %\VignetteIndexEntry{List of Metrics} 14 | %\VignetteEngine{knitr::rmarkdown} 15 | \usepackage[utf8]{inputenc} 16 | --- 17 | 18 | 19 | 22 | 23 | 24 | 25 | 35 | 36 | ```{r setup, include=TRUE, echo=FALSE, results="asis"} 37 | ## global options 38 | knitr::opts_chunk$set(echo=FALSE, warning=FALSE, error=FALSE, message=FALSE, fig.width=10) 39 | 40 | lst_qcMetrics_ord = PTXQC:::getMetricsObjects() 41 | 42 | txt_TOC = "# Table of Contents 43 | - [Overview](#Overview) 44 | - [Metrics](#Metrics) 45 | " 46 | txt_BODY = "" 47 | for (qcm in lst_qcMetrics_ord) 48 | { 49 | newname = gsub("(.*)\\(.*" , "\\1", gsub("[\\*~%]" , " ", gsub("[\\^\">]" , "", qcm$qcName))) 50 | ## remove weird symbols (to serve as link) 51 | newname_lnk = gsub("[^a-zA-Z0-9]", "", newname) 52 | txt_TOC = paste0(txt_TOC, paste0(" - [", newname, "](#", newname_lnk, ")\n")) 53 | txt_BODY = paste0(txt_BODY, '\n 54 | ## ', newname, ' 55 | \n 56 |
', qcm$helpTextTemplate, '
57 |

-- back to top --

\n\n') 58 | } 59 | 60 | ## print the TOC 61 | cat(txt_TOC) 62 | 63 | ``` 64 | 65 | # Overview 66 | 67 | The following metrics are implemented in PTXQC.
68 | 69 | Reasons why metrics might not appear in every report 70 | 71 | * applicable only to certain types of data, e.g. SILAC or TMT 72 | * metric was disabled manually using the YAML config file 73 | * missing input data (incomplete tables), i.e. some .txt files are missing 74 | 75 | Metric names are prefixed by the data-source, e.g. "EVD: Charge" displays and scores the charge distribution, based on data from 'evidence.txt' (EVD). 76 | 77 | * EVD: evidence.txt 78 | * SM: summary.txt 79 | * PAR: parameters.txt 80 | * PG: proteingroups.txt 81 | * MSMS: msms.txt 82 | * MS2Scans: msmsscans.txt 83 | 84 | 85 | Some metrics are incompletely named here, since they might contain (hithero unknown) thresholds, which are taken from mqpar.xml (when available) or defaulted in real reports. 86 | 87 | # Metrics
88 | ```{r metrics, echo=FALSE, results="asis"} 89 | cat(txt_BODY) 90 | ``` 91 | 92 | If the above list is empty, the vignette was not compiled (e.g. when viewing on GitHub). 93 | Please see https://CRAN.R-project.org/package=PTXQC --> Vignettes for a compiled version. 94 | 95 | -------------------------------------------------------------------------------- /inst/examples/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Examples 3 | 4 | PTXQC will provide you with a report in Html/PDF format, summarizing the quality of your data. 5 | 6 | Please refer to the publication (currently under review; link is coming soon) for details on which quality metrics are available and how they are scored. 7 | 8 | ## Obtaining example data 9 | If you want to generate a report yourself, example input data can be found on the **PRIDE** repository under the 10 | following accession numbers: [PXD003133 (MBR)][1], [PXD003134 (Myco)][2], and [PXD000427 (TMT)][3]. 11 | This data corresponds to the MaxQuant data used in the publication. 12 | 13 | The [PTXQC-Basic_Guide_for_R_users][4] vignette has R code snippets to automatically download the data. If you are not an R person and have Windows as operating system, just download the zip files from the PRIDE link above, and run PTXQC via drag'n'drop (as described in the [PTXQC-DragNDrop][5] vignette). 14 | 15 | ## Report Layout 16 | 17 | The first page shows an overview heatmap, representing scores for each Raw file for a set of quality metrics. 18 | The screenshots given here, a from a rather small run of just 5 files. You can easily analyse a study with more than 100 files, but the report will get bigger :) 19 | 20 | ![Overview Heatmap](./example_heatmap.png?raw=true "Overview heatmap showing quality criteria for each LC-MS file") 21 | 22 | After that, there is a summary of MaxQuant parameters (i.e. which FASTA files were used, was Match-between-runs activated etc...). 23 | 24 | In the remainder of the report you can follow up on each individual metric and explore the reason for failure. The Html output additionally contains a 25 | helpful description of each metric in case you have not read the [publication][JPR_paper] or need a refresh on what the plot actually tells you. 26 | 27 | For example, the alignment in MaxQuant via the Match-between-runs did not work optimal across all Raw files in this case, 28 | since MaxQuant could not normalize the LC gradients at the start and end of the run: 29 | ![Alignment Performance](./example_MBRalignment.png?raw=true "Alignment of 5 raw files (the first file serves as reference here)") 30 | 31 | Also, you could check how a new LC gradient influences the identifications over time: 32 | ![Identifications over Retention Time](./example_IDoverRT.png?raw=true "Identifications over Retention Time") 33 | 34 | Find a full report as [html][example_html] or [pdf][example_pdf]. 35 | 36 | See the package vignettes for documentation on how to create and customize a report. 37 | 38 | [1]: http://www.ebi.ac.uk/pride/archive/projects/PXD003133 39 | [2]: http://www.ebi.ac.uk/pride/archive/projects/PXD003134 40 | [3]: http://www.ebi.ac.uk/pride/archive/projects/PXD000427 41 | [4]: https://github.com/cbielow/PTXQC/blob/master/vignettes/PTXQC-Basic_Guide_for_R_users.Rmd 42 | [5]: https://github.com/cbielow/PTXQC/blob/master/vignettes/PTXQC-DragNDrop.Rmd 43 | [JPR_paper]: https://doi.org/10.1021/acs.jproteome.5b00780 44 | [example_html]: http://htmlpreview.github.io/?https://github.com/cbielow/PTXQC/blob/master/inst/examples/report_v1.1.0__txt_5files_withMatch-100min.html 45 | [example_pdf]: report_v1.1.0__txt_5files_withMatch-100min.pdf -------------------------------------------------------------------------------- /inst/examples/report_ecoli_small.mzQC: -------------------------------------------------------------------------------- 1 | { 2 | "mzQC": { 3 | "version": "1.0.0", 4 | "creationDate": "2023-04-11T15:33:24", 5 | "contactName": "bielow", 6 | "runQualities": [ 7 | { 8 | "metadata": { 9 | "label": "Toni_20120502_GM_Ecoli_01", 10 | "inputFiles": [ 11 | { 12 | "name": "Toni_20120502_GM_Ecoli_01.raw", 13 | "location": "file:///M:/projects/QC/ecoli_small/Toni_20120502_GM_Ecoli_01.raw", 14 | "fileFormat": { 15 | "accession": "MS:1000563", 16 | "name": "Thermo RAW format" 17 | } 18 | } 19 | ], 20 | "analysisSoftware": [ 21 | { 22 | "accession": "MS:1003162", 23 | "name": "PTX-QC", 24 | "version": "1.0.15", 25 | "uri": "https://github.com/cbielow/PTXQC/", 26 | "description": "\"Proteomics (PTX) - QualityControl (QC) software for QC report generation and visualization.\" [DOI:10.1021/acs.jproteome.5b00780, PMID:26653327, https://github.com/cbielow/PTXQC/]" 27 | } 28 | ] 29 | }, 30 | "qualityMetrics": [ 31 | { 32 | "accession": "MS:1002406", 33 | "name": "count of identified clusters", 34 | "description": "\"The number of protein clusters that have been identified, which must match the number of clusters that pass the threshold in the file.\" [DOI:10.1002/pmic.201400080, PMID:25092112]", 35 | "value": 1079 36 | } 37 | ] 38 | }, 39 | { 40 | "metadata": { 41 | "label": "Toni_20120502_GM_Ecoli_02", 42 | "inputFiles": [ 43 | { 44 | "name": "Toni_20120502_GM_Ecoli_02.raw", 45 | "location": "file:///M:/projects/QC/ecoli_small/Toni_20120502_GM_Ecoli_02.raw", 46 | "fileFormat": { 47 | "accession": "MS:1000563", 48 | "name": "Thermo RAW format" 49 | } 50 | } 51 | ], 52 | "analysisSoftware": [ 53 | { 54 | "accession": "MS:1003162", 55 | "name": "PTX-QC", 56 | "version": "1.0.15", 57 | "uri": "https://github.com/cbielow/PTXQC/", 58 | "description": "\"Proteomics (PTX) - QualityControl (QC) software for QC report generation and visualization.\" [DOI:10.1021/acs.jproteome.5b00780, PMID:26653327, https://github.com/cbielow/PTXQC/]" 59 | } 60 | ] 61 | }, 62 | "qualityMetrics": [ 63 | { 64 | "accession": "MS:1002406", 65 | "name": "count of identified clusters", 66 | "description": "\"The number of protein clusters that have been identified, which must match the number of clusters that pass the threshold in the file.\" [DOI:10.1002/pmic.201400080, PMID:25092112]", 67 | "value": 1054 68 | } 69 | ] 70 | } 71 | ], 72 | "controlledVocabularies": [ 73 | { 74 | "name": "Proteomics Standards Initiative Mass Spectrometry Ontology", 75 | "uri": "https://github.com/HUPO-PSI/psi-ms-CV/releases/download/v4.1.95/psi-ms.obo", 76 | "version": "4.1.95" 77 | } 78 | ] 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /vignettes/PTXQC-DragNDrop.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Drag'n'drop Usage Guide for PTXQC" 3 | author: "Chris Bielow " 4 | date: '`r Sys.Date()`' 5 | output: 6 | html_document: default 7 | pdf_document: null 8 | vignette: > 9 | %\VignetteIndexEntry{Drag'n'drop Usage Guide for PTXQC} 10 | %\VignetteEngine{knitr::rmarkdown} 11 | \usepackage[utf8]{inputenc} 12 | --- 13 | 14 | # Drag'n'drop Usage Guide for PTXQC 15 | 16 | **Requirements:** 17 | 18 | - any Windows System 19 | - R and PTXQC should be installed using the installation instructions 20 | at https://github.com/cbielow/PTXQC/tree/master/inst/dragNdrop. 21 | 22 | ## Generating a quick QC report without asking questions! 23 | 24 | - open a Windows Explorer and find your MaxQuant txt-output folder 25 | - open another Windows Explorer window and navigate to the (network) folder where the QC software 26 | was copied to during installation, e.g. `P:\Chris\Exchange\QC` (where drive P could be some network share). 27 | - drag'n'drop the txt folder onto `createQC_dragNdrop.bat` (you can also drag any file within the 28 | txt folder, e.g. `evidence.txt`) 29 | 30 | Drag'n'drop action 31 | 32 | - A console will pop up and show stuff. Wait... if all went well, one of the last lines is `Time elapsed: ... min` 33 | and a pdf report within your txt folder. It has a version and a folder name attached to it 34 | (e.g. `report_v0.63_diabetes.pdf`). The version number will increase every time there is an 35 | update in PTXQC (big change in version number means big change in functionality). 36 | The name is taken from the path where the txt is located in - it helps you to distinguish 37 | report files when they are open in a PDF viewer or copied somewhere else. 38 | The console window will stay up until you press a key. 39 | 40 | The command window, visible during report generation 41 | 42 | ## Generating a QC report using a configuration file 43 | 44 | There are two ways to customize parameters for a report: 45 | 46 | - PTXQC will search for a YAML file within the txt-folder for which it generates the report. 47 | If there is one (with the correct name, i.e. `report_vXXX.yaml`, where XXX is the PTXQC version number), 48 | this report file will be used. Thus, if you already have txt-folder containing a report pdf 49 | plus the `report_*.yaml` inside, just edit the YAML file and re-run 50 | PTXQC. 51 | - If your txt-folder has not been analysed by PTXQC before *or* you want to try another configuration, 52 | you can use the `createQC_dragNdrop_withYAML.bat`. This .bat file expects a YAML configuration file 53 | right next to itself. This YAML file you need to provide. But no worries. One such YAML file 54 | with default parameters is generated each time you invoke a QC report generation. 55 | Just take any YAML file from a previous run in any other txt-folder. Copy the YAML file next to the .bat file, and name it `config.yaml`. 56 | Modify it to your needs using a text editor such as Notepad. 57 | From now on, you can use the `createQC_dragNdrop_withYAML.bat` for any report which should use this configuration. 58 | The usage is identical to the one you already know - just target `createQC_dragNdrop_withYAML.bat` instead of `createQC_dragNdrop.bat` 59 | when dragging a txt-folder. 60 | 61 | **Note**: The second option will take precedence over the first. 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /man/qcMetric-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/qcMetric.R 3 | \docType{class} 4 | \name{qcMetric-class} 5 | \alias{qcMetric-class} 6 | \alias{qcMetric} 7 | \title{Class which can compute plots and generate mzQC output (usually for a single metric).} 8 | \arguments{ 9 | \item{df}{The expected data, usually a data frame. If empty, this function will return immediately without failure.} 10 | 11 | \item{...}{Additional arguments passed to the workerFcn()} 12 | } 13 | \description{ 14 | Internally calls the workerFcn() , which computes the actual plots metric scores and supporting data (e.g. mzQC metrics) of the derived class; the resulting data is checked and stored in the members of this class 15 | } 16 | \details{ 17 | Reference class which is instanciated with a metric description and a 18 | worker function (at initialization time, i.e. in the package) 19 | and can produce plots and mzQC values (at runtime, when data is provided) using setData(). 20 | 21 | All derived classes need to implement a 'workerFcn()' function, which returns a list with 22 | elements: c("plots", "mzQC", "htmlTable", "qcScores", "title"), 23 | where 'plots' is required; all others are optional. 24 | } 25 | \section{Fields}{ 26 | 27 | \describe{ 28 | \item{\code{helpText}}{Description (lengthy) of the metric and plot elements} 29 | 30 | \item{\code{workerFcn}}{Function which generates a result (usually plots). Data is provided using setData().} 31 | 32 | \item{\code{plots}}{List of plots (after setData() was called)} 33 | 34 | \item{\code{htmlTable}}{A table for display in the HTML report (preferred over a plot in Html mode)} 35 | 36 | \item{\code{qcScores}}{Data.frame of scores from a qcMetric (computed within workerFcn())} 37 | 38 | \item{\code{mzQC}}{An named list of mzQC MzQCqualityMetric's (named by their fc.raw.file for runQuality or concatenated fc.raw.files for setQualities (e.g. "file 1;file4")) (valid after setData() was called)} 39 | 40 | \item{\code{qcCat}}{QC category (LC, MS, or prep)} 41 | 42 | \item{\code{qcName}}{Name of the qcScore in the heatmap} 43 | 44 | \item{\code{orderNr}}{Column index during heatmap generation and for the general order of plots} 45 | }} 46 | 47 | 48 | \examples{ 49 | 50 | require(ggplot2) 51 | dd = data.frame(x=1:10, y=11:20) 52 | a = qcMetric$new(helpText="small help text", 53 | ## arbitrary arguments, matched during setData() 54 | workerFcn=function(.self, data, gtitle) 55 | { 56 | ## usually some code here to produce ggplots 57 | pl = lapply(1:2, function(xx) { 58 | ggplot(data) + 59 | geom_point(aes(x=x*xx,y=y)) + 60 | ggtitle(gtitle) 61 | }) 62 | ## add mzQC metric for count of identified clusters 63 | template_proteinCount = rmzqc::getQualityMetricTemplate("MS:1002406") 64 | mzqc = lapply(1:3, function(id){ 65 | out = template_proteinCount$copy(); 66 | out$value = id; 67 | return(out) }) 68 | names(mzqc) = paste0("file", 1:3); 69 | return(list(plots = pl, mzQC = mzqc)) 70 | }, 71 | qcCat="LC", 72 | qcName="MS/MS Peak shape", 73 | orderNr = 30) 74 | ## test some output 75 | a$setData(dd, "my title") 76 | a$plots ## the raw plots 77 | a$getPlots(TRUE) ## same as above 78 | a$getPlots(FALSE) ## plots without title 79 | a$getTitles() ## get the titles of the all plots 80 | a$helpText 81 | a$qcName 82 | a$mzQC 83 | 84 | 85 | } 86 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('[data-toggle="tooltip"]').tooltip(); 13 | 14 | var cur_path = paths(location.pathname); 15 | var links = $("#navbar ul li a"); 16 | var max_length = -1; 17 | var pos = -1; 18 | for (var i = 0; i < links.length; i++) { 19 | if (links[i].getAttribute("href") === "#") 20 | continue; 21 | // Ignore external links 22 | if (links[i].host !== location.host) 23 | continue; 24 | 25 | var nav_path = paths(links[i].pathname); 26 | 27 | var length = prefix_length(nav_path, cur_path); 28 | if (length > max_length) { 29 | max_length = length; 30 | pos = i; 31 | } 32 | } 33 | 34 | // Add class to parent
  • , and enclosing
  • if in dropdown 35 | if (pos >= 0) { 36 | var menu_anchor = $(links[pos]); 37 | menu_anchor.parent().addClass("active"); 38 | menu_anchor.closest("li.dropdown").addClass("active"); 39 | } 40 | }); 41 | 42 | function paths(pathname) { 43 | var pieces = pathname.split("/"); 44 | pieces.shift(); // always starts with / 45 | 46 | var end = pieces[pieces.length - 1]; 47 | if (end === "index.html" || end === "") 48 | pieces.pop(); 49 | return(pieces); 50 | } 51 | 52 | // Returns -1 if not found 53 | function prefix_length(needle, haystack) { 54 | if (needle.length > haystack.length) 55 | return(-1); 56 | 57 | // Special case for length-0 haystack, since for loop won't run 58 | if (haystack.length === 0) { 59 | return(needle.length === 0 ? 0 : -1); 60 | } 61 | 62 | for (var i = 0; i < haystack.length; i++) { 63 | if (needle[i] != haystack[i]) 64 | return(i); 65 | } 66 | 67 | return(haystack.length); 68 | } 69 | 70 | /* Clipboard --------------------------*/ 71 | 72 | function changeTooltipMessage(element, msg) { 73 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 74 | element.setAttribute('data-original-title', msg); 75 | $(element).tooltip('show'); 76 | element.setAttribute('data-original-title', tooltipOriginalTitle); 77 | } 78 | 79 | if(ClipboardJS.isSupported()) { 80 | $(document).ready(function() { 81 | var copyButton = ""; 82 | 83 | $("div.sourceCode").addClass("hasCopyButton"); 84 | 85 | // Insert copy buttons: 86 | $(copyButton).prependTo(".hasCopyButton"); 87 | 88 | // Initialize tooltips: 89 | $('.btn-copy-ex').tooltip({container: 'body'}); 90 | 91 | // Initialize clipboard: 92 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 93 | text: function(trigger) { 94 | return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); 95 | } 96 | }); 97 | 98 | clipboardBtnCopies.on('success', function(e) { 99 | changeTooltipMessage(e.trigger, 'Copied!'); 100 | e.clearSelection(); 101 | }); 102 | 103 | clipboardBtnCopies.on('error', function() { 104 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 105 | }); 106 | }); 107 | } 108 | })(window.jQuery || window.$) 109 | -------------------------------------------------------------------------------- /R/qcMetric_PAR.R: -------------------------------------------------------------------------------- 1 | 2 | qcMetric_PAR = setRefClass( 3 | "qcMetric_PAR", 4 | contains = "qcMetric", 5 | methods = list(initialize=function() { callSuper( 6 | helpText="MaxQuant parameters, extracted from parameters.txt (abbreviated as 'PAR'), summarizes the settings used for the MaxQuant analysis. 7 | Key parameters are MaxQuant version, Re-quantify, Match-between-runs and mass search tolerances. 8 | A list of protein database files is also provided, allowing to 9 | track database completeness and database version information (if given in the filename).", 10 | workerFcn=function(.self, d_parAll) 11 | { 12 | ##todo: read in mqpar.xml to get group information and ppm tolerances for all groups (parameters.txt just gives Group1) 13 | 14 | line_break = "\n"; ## use space to make it work with table 15 | ## remove AIF stuff 16 | 17 | df_mqpar = d_parAll[!grepl("^AIF ", d_parAll$parameter),] 18 | df_mqpar$value = gsub(";", line_break, df_mqpar$value) 19 | ## seperate FASTA files (usually they destroy the layout) 20 | idx_fastafile = grepl("fasta file", df_mqpar$parameter, ignore.case = TRUE) 21 | d_par_file = df_mqpar[idx_fastafile, ] 22 | fasta_files = sapply(unlist(strsplit(d_par_file$value, "\n")), function(x) rev(strsplit(x,"\\", fixed = TRUE)[[1]])[1]) 23 | d_par = df_mqpar[!idx_fastafile, ] 24 | ## remove duplicates 25 | d_par = d_par[!duplicated(d_par$parameter),] 26 | rownames(d_par) = d_par$parameter 27 | 28 | ## trim long param names (the user should know what they mean) 29 | allowed_len = nchar("Min. score for unmodified .."); 30 | d_par$parameter = sapply(d_par$parameter, function (s) { 31 | if (nchar(s) > allowed_len) { 32 | s = paste(substring(s, 1, allowed_len), "..", collapse = "", sep="") 33 | } 34 | return (s) 35 | }) 36 | 37 | 38 | ## sort by name 39 | d_par = d_par[order(d_par$parameter), ] 40 | 41 | ## two column layout 42 | if (nrow(d_par) %% 2 != 0) d_par[nrow(d_par)+1,] = "" ## make even number of rows 43 | mid = nrow(d_par) / 2 44 | d_par$page = 1 45 | d_par$page[1:mid] = 0 46 | 47 | parC = c("parameter", "value") 48 | 49 | d_par2 = cbind(d_par[d_par$page==0, parC], d_par[d_par$page==1, parC]) 50 | 51 | ## HTML: alternative table 52 | ## (do this before line breaks, since Html can handle larger strings) 53 | tbl_f = getHTMLTable(d_par2, caption = fasta_files) 54 | 55 | ## break long values into multiple lines (to preserve PDF table width) 56 | splitMaxLen = function(s) { 57 | allowed_len = nchar("Use least modified peptide"); ## this is a typical entry -- everything which is longer gets split 58 | r = paste(sapply(unlist(strsplit(s, line_break, fixed = TRUE)), function(s1) { 59 | if (!is.na(s1) && nchar(s1) > allowed_len) { 60 | s_beg = seq(from = 1, to = nchar(s1) - 1, by = allowed_len) 61 | s1 = paste(unlist(substring(s1, s_beg, s_beg + allowed_len - 1)), collapse = line_break) 62 | } 63 | return(s1) 64 | }), collapse = line_break) 65 | return (r) 66 | } 67 | d_par2[ , 2] = sapply(d_par2[ , 2], splitMaxLen) 68 | d_par2[ , 4] = sapply(d_par2[ , 4], splitMaxLen) 69 | 70 | plot_title = "PAR: parameters" 71 | ## PDF: split table onto multiple pages if necessary... 72 | par_pl = byXflex(d_par2, 1:nrow(d_par2), 25, plotTable, sort_indices = TRUE, title = plot_title, footer = fasta_files) 73 | 74 | return(list(plots = par_pl, htmlTable = tbl_f)) 75 | }, 76 | qcCat = NA_character_, 77 | qcName = "PAR:~MQ~Parameters", 78 | orderNr = 0001 79 | ) 80 | return(.self) 81 | }) 82 | ) 83 | 84 | -------------------------------------------------------------------------------- /tests/testthat/test_qualities.R: -------------------------------------------------------------------------------- 1 | library(PTXQC) 2 | context("fcn_qualities.R") 3 | 4 | test_that("qualLinThresh", { 5 | expect_error(qualLinThresh(-3)) 6 | expect_error(qualLinThresh(c(1,2,-3))) 7 | expect_equal(qualLinThresh(3, 10), 0.3) 8 | expect_equal(qualLinThresh(3), 1) 9 | expect_equal(qualLinThresh(3, 3), 1) 10 | expect_equal(qualLinThresh(c(0,1,3,NA), 3), c(0, 1/3, 1, 0)) 11 | }) 12 | 13 | test_that("qualCentered", { 14 | expect_equal(qualCentered(3), 0) 15 | ## median is 0 -- perfect 16 | expect_equal(qualCentered(-5:5), 1) 17 | ## some outliers, but still median is 0 -- perfect 18 | expect_equal(qualCentered(c(-5:5, -9999, 10)), 1) 19 | ## median 2, max=3: 1 - 2/3 20 | expect_equal(qualCentered( c(1,2,3)), 1 - 2/3) 21 | expect_equal(qualCentered(-c(1,2,3)), 1 - 2/3) 22 | ## further off ... 23 | expect_equal(qualCentered( c(5,6,7)), 1 - 6/7) 24 | expect_equal(qualCentered(-c(5,6,7)), 1 - 6/7) 25 | }) 26 | 27 | test_that("qualCenteredRef", { 28 | expect_error(qualCenteredRef(3, 0)) 29 | expect_error(qualCenteredRef(3, -1)) 30 | 31 | ## median is 13 32 | expect_equal(qualCenteredRef(c(10:16), 13), 0) 33 | expect_equal(qualCenteredRef(c(10:16), 13*2), 0.5) 34 | expect_equal(qualCenteredRef(c(10:16), 13*4), 0.75) 35 | 36 | ## median is 13, ref-interval is smaller -- worst score 37 | expect_equal(qualCenteredRef(c(10:16), 12), 0) 38 | ## median is perfectly 0 -- ref-interval does not really matter 39 | expect_equal(qualCenteredRef(-5:5, 1), 1) 40 | expect_equal(qualCenteredRef(-5:5, 100), 1) 41 | }) 42 | 43 | test_that("qualMedianDist", { 44 | ## values need be in [0,1] 45 | expect_error(qualMedianDist(-3)) 46 | expect_error(qualMedianDist(c(0.1,0.3,-0.3))) 47 | 48 | ## median: 0.5 49 | x = (1:9)/10 50 | expect_equal(qualMedianDist(x), 1 - abs(0.5 - x)) 51 | }) 52 | 53 | test_that("qualUniform", { 54 | expect_equal(qualUniform(c(3,3,3)), 1) 55 | expect_equal(qualUniform(c(4,0,0)), 0) 56 | 57 | ## how 'uniform' is a vector where only a single index has weight?-- answer: very 58 | expect_equal(qualUniform(c(4,0,0), c(1,0,0)), 1) 59 | expect_equal(qualUniform(c(4,0,0), c(0,1,0)), 1) 60 | expect_equal(qualUniform(c(0,4,0)), 0) 61 | expect_lt(abs(qualUniform(c(3,2,1))-0.58578), 0.0001) 62 | expect_lt(abs(qualUniform(c(1,2,3))-0.58578), 0.0001) 63 | expect_equal(qualUniform(c(1,2,3), c(0,1,0)), 1) 64 | expect_lt(abs(qualUniform(c(1,2,3))-0.58578), 0.0001) 65 | expect_lt(abs(qualUniform(c(1,2,3), c(0,1,1))- 0.590316), 0.0001) 66 | expect_lt(abs(qualUniform(c(2,3), c(1,1))-0.552786), 0.0001) 67 | expect_lt(abs(qualUniform(1:120)-0.38661), 0.0001) 68 | }) 69 | 70 | 71 | test_that("qualGaussDev", { 72 | expect_error(qualGaussDev(-3)) 73 | expect_equal(qualGaussDev(0, -4), NaN) 74 | 75 | ## perfect 76 | expect_equal(qualGaussDev(0, 1), 1) 77 | expect_equal(qualGaussDev(0, 3), 1) 78 | 79 | ## shifted slighty 80 | expect_equal(qualGaussDev(1, 1), 0.6065307, tolerance = .001) 81 | ## shifted more... 82 | expect_equal(qualGaussDev(2, 1), 0.1353353, tolerance = .001) 83 | 84 | }) 85 | 86 | test_that("qualHighest", { 87 | expect_equal(qualHighest(c(0,0,0,16), 4), 1) 88 | expect_equal(qualHighest(c(16,0,0,0), 4), 0) 89 | expect_equal(qualHighest(c(1,1,1,1), 4) , 0.5) 90 | expect_equal(qualHighest(c(0,16,0,0), 4), 1/3) 91 | }) 92 | 93 | 94 | test_that("qualBestKS", { 95 | ## sample some Gaussians 96 | g1 = rnorm(100) 97 | g2 = rnorm(100) 98 | g3 = rnorm(100) 99 | go = rnorm(100, mean=4) ## this will be our outlier distribution 100 | x = list(g1,g2,g3,go) 101 | 102 | r = qualBestKS(x) 103 | 104 | expect_equal(max(r$ks_best[1:3]), 1) 105 | expect_true(all(r$ks_best[1:3] > 0.7)) ## the three similar ones, should score good (one of them the the reference) 106 | expect_lt(r$ks_best[4], 0.2) ## outlier should score badly 107 | }) 108 | 109 | 110 | -------------------------------------------------------------------------------- /vignettes/PTXQC-Basic_Guide_for_R_users.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Basic R-Usage Guide for PTXQC" 3 | author: "Chris Bielow " 4 | date: '`r Sys.Date()`' 5 | output: 6 | html_document: default 7 | pdf_document: null 8 | vignette: > 9 | %\VignetteIndexEntry{Basic R-Usage Guide for PTXQC} 10 | %\VignetteEngine{knitr::rmarkdown} 11 | \usepackage[utf8]{inputenc} 12 | --- 13 | 14 | # Basic R-Usage Guide for PTXQC 15 | 16 | This vignette serves as a quickstart guide for R users to create a report 17 | from within R using PTXQC. 18 | 19 | **Target Audience:** R users 20 | 21 | Reports can be generated using the default configuration of PTXQC. 22 | See 23 | ```{r, eval=FALSE} 24 | vignette("PTXQC-InputData", package = "PTXQC") 25 | ``` 26 | how a txt folder should look like. 27 | 28 | ## Generate a default report 29 | 30 | This is the most simple invokation of PTXQC::createReport(). 31 | 32 | ```{r, eval=FALSE} 33 | require(PTXQC) 34 | 35 | ## the next require() is needed to prevent a spurious error in certain R versions (might be a bug in R or a package) 36 | ## error message is: 37 | ## Error in Scales$new : could not find function "loadMethod" 38 | require(methods) 39 | 40 | ## specify a path to a MaxQuant txt folder 41 | ## Note: This folder needs to be complete (see 'vignette("PTXQC-InputData", package = "PTXQC")') 42 | if (1) { 43 | ## we will use an example dataset from PRIDE (dataset 2 of the PTXQC publication) 44 | local_zip = tempfile(fileext=".zip") 45 | tryCatch({ 46 | download.file("ftp://ftp.pride.ebi.ac.uk/pride/data/archive/2015/11/PXD003133/txt_20min.zip", destfile = local_zip) 47 | }, error = function(err) { 48 | ## on Windows, one can get a 'cannot open URL' using the default method. So we try another 49 | download.file("ftp://ftp.pride.ebi.ac.uk/pride/data/archive/2015/11/PXD003133/txt_20min.zip", destfile = local_zip, method= "internal") 50 | 51 | }) 52 | unzip(local_zip, exdir = tempdir()) ## extracts content 53 | txt_folder = file.path(tempdir(), "txt_20min") 54 | } else { 55 | ## if you have local MaxQuant output, just use it 56 | txt_folder = "c:/Proteomics/MouseLiver/combined/txt" 57 | } 58 | 59 | r = createReport(txt_folder) 60 | 61 | cat(paste0("\nReport generated as '", r$report_file, "'\n\n")) 62 | 63 | ``` 64 | 65 | ## Generate a customized report 66 | 67 | The report can be customized via a YAML configuration file. 68 | For details, see 69 | 70 | ```{r, eval=FALSE} 71 | vignette("PTXQC-CustomizeReport", package = "PTXQC") 72 | ``` 73 | 74 | After editing the YAML configuration to your needs, run the code below. 75 | 76 | ```{r, eval=FALSE} 77 | require(PTXQC) 78 | require(yaml) 79 | 80 | ## the next require() is needed to prevent a spurious error in certain R versions (might be a bug in R or a package) 81 | ## error message is: 82 | ## Error in Scales$new : could not find function "loadMethod" 83 | require(methods) 84 | 85 | ## specify a path to a MaxQuant txt folder 86 | ## Note: This folder can be incomplete, depending on your YAML config 87 | if (1) { 88 | ## we will use an example dataset from PRIDE (dataset 2 of the PTXQC publication) 89 | local_zip = tempfile(fileext=".zip") 90 | download.file("ftp://ftp.pride.ebi.ac.uk/pride/data/archive/2015/11/PXD003133/txt_20min.zip", destfile = local_zip) 91 | unzip(local_zip, exdir = tempdir()) ## extracts content 92 | txt_folder = file.path(tempdir(), "txt_20min") 93 | } else { 94 | ## if you have local MaxQuant output, just use it 95 | txt_folder = "c:/Proteomics/MouseLiver/combined/txt" 96 | } 97 | 98 | ## use a YAML config inside the target directory if present 99 | fh_out = getReportFilenames(txt_folder) 100 | if (file.exists(fh_out$yaml_file)) 101 | { 102 | cat("\nUsing YAML config already present in target directory ...\n") 103 | yaml_config = yaml.load_file(input = fh_out$yaml_file) 104 | } else { 105 | cat("\nYAML config not found in folder '", txt_folder, "'. The first run of PTXQC will create one for you.", sep="") 106 | yaml_config = list() 107 | } 108 | 109 | r = createReport(txt_folder, mztab_file = NULL, yaml_obj = yaml_config) 110 | 111 | cat(paste0("\nReport generated as '", r$report_file, "'\n\n")) 112 | 113 | ``` 114 | 115 | That's it. 116 | 117 | 118 | --------------------------------------------------------------------------------