| Title: | visualization and annotation of isotopic enrichment patterns of peptides and metabolites with stable isotope labeling from proteomics and metabolomics |
|---|---|
| Description: | Visualisation of peptide isotopic peaks and SIP peptide spectra match (PSM). Filtration of high quality PSM. Accurate isotopic abundance calculation of peptide and metabolites. Visualisation of SIP proteomics results. |
| Authors: | Yi Xiong [aut, cre] (ORCID: <https://orcid.org/0009-0005-4591-2366>) |
| Maintainer: | Yi Xiong <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1.1 |
| Built: | 2026-06-04 10:22:24 UTC |
| Source: | https://github.com/bioc/Aerith |
Unified container storing theoretical or observed spectra, their charge states, and the associated peptide or compound identifier.
Instances of this class are typically created by helper constructors
like getPrecursorSpectra(), getSipPrecursorSpectra(), or converted from
raw scans with getRealScan(). The class underpins downstream plotting and
annotation methods.
spectraA data.frame with columns such as Mass, MZ, Prob,
Kind, and Charge, holding peaks and metadata.
chargesNumeric vector of precursor charge states carried
alongside spectra.
AAstrCharacter string containing the peptide sequence or compound label used to generate the spectrum.
getPrecursorSpectra(), getSipPrecursorSpectra(),
getSipBYionSpectra(), plot,AAspectra,missing-method
AAstr <- "KHRIP" spectra <- getPrecursorSpectra(AAstr, 1:2) class(spectra)AAstr <- "KHRIP" spectra <- getPrecursorSpectra(AAstr, 1:2) class(spectra)
annotatePrecursor
annotatePrecursor( realMZ, realIntensity, realCharge, pepSeq, charge, Atom, Prob, isoCenter = 0, isoWidth = 0, calScores = FALSE )annotatePrecursor( realMZ, realIntensity, realCharge, pepSeq, charge, Atom, Prob, isoCenter = 0, isoWidth = 0, calScores = FALSE )
realMZ |
mz vector in precursor scan |
realIntensity |
intensity vector in precursor scan |
realCharge |
charge vector in precursor scan |
pepSeq |
a string of peptide |
charge |
charge of precursor ion in consideration |
Atom |
"C13" or "N15" |
Prob |
its SIP abundance (0.0~1.0) |
isoCenter |
isolation window center, set it 0 as default if not filtering by isolation window |
isoWidth |
isolation window width, set it 0 as default if not filtering by isolation window |
calScores |
FALSE as default, calculate matched spectra entropy score or not |
a List about matched precursor isotopic peaks information
realMZ <- c( 894.9413, 895.4429, 895.9444, 896.3896, 896.4448, 896.9463, 897.3890, 897.8896, 898.3930, 898.4734, 901.8851, 902.4465, 902.9483, 903.4498, 903.9504, 910.8968, 911.4449, 912.3784 ) realIntensity <- c( 16660537.0, 12344664.0, 6128400.5, 1448961.1, 1614148.1, 713238.8, 1999402.4, 1124157.4, 567865.2, 647140.8, 709644.2, 7805729.0, 8421993.0, 3200114.2, 1286055.5, 620246.8, 540861.6, 1079918.5 ) realCharge <- c(2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 2) anno <- annotatePrecursor( realMZ, realIntensity, realCharge, "GITINTSHVEYDTPTR", 2, "C13", 0.01, 902.4471, 20, TRUE )realMZ <- c( 894.9413, 895.4429, 895.9444, 896.3896, 896.4448, 896.9463, 897.3890, 897.8896, 898.3930, 898.4734, 901.8851, 902.4465, 902.9483, 903.4498, 903.9504, 910.8968, 911.4449, 912.3784 ) realIntensity <- c( 16660537.0, 12344664.0, 6128400.5, 1448961.1, 1614148.1, 713238.8, 1999402.4, 1124157.4, 567865.2, 647140.8, 709644.2, 7805729.0, 8421993.0, 3200114.2, 1286055.5, 620246.8, 540861.6, 1079918.5 ) realCharge <- c(2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 2) anno <- annotatePrecursor( realMZ, realIntensity, realCharge, "GITINTSHVEYDTPTR", 2, "C13", 0.01, 902.4471, 20, TRUE )
annotatePSM
annotatePSM( realMZ, realIntensity, realCharge, pepSeq, charges, Atom, Prob, isoCenter = 0, isoWidth = 0, calScores = FALSE )annotatePSM( realMZ, realIntensity, realCharge, pepSeq, charges, Atom, Prob, isoCenter = 0, isoWidth = 0, calScores = FALSE )
realMZ |
mz vector in MS2 scan |
realIntensity |
intensity vector in MS2 scan |
realCharge |
charge vector in MS2 scan |
pepSeq |
a string of peptide |
charges |
charges of product ions in consideration |
Atom |
"C13" or "N15" |
Prob |
its SIP abundance (0.0~1.0) |
isoCenter |
isolation window center, set it 0 as default if not remove peaks in isolation window |
isoWidth |
isolation window width, set it 0 as default if not remove peaks in isolation window |
calScores |
FALSE as default, calculate WDP MVH Xcor scores or not |
a List about matched peaks information of this PSM
demo_file <- system.file("extdata", "107728.FT2", package = "Aerith") scan1 <- readOneScanMS2(ftFile = demo_file, 107728) anno <- annotatePSM( scan1$peaks$mz, scan1$peaks$intensity, scan1$peaks$charge, "HSQVFSTAEDNQSAVTIHVLQGER", 1:2, "C13", 0.0107, 886.65, 4.0, TRUE )demo_file <- system.file("extdata", "107728.FT2", package = "Aerith") scan1 <- readOneScanMS2(ftFile = demo_file, 107728) anno <- annotatePSM( scan1$peaks$mz, scan1$peaks$intensity, scan1$peaks$charge, "HSQVFSTAEDNQSAVTIHVLQGER", 1:2, "C13", 0.0107, 886.65, 4.0, TRUE )
This function calculates the isotopic distribution of B and Y ions for a given amino acid string with a user-defined isotopic distribution and returns a DataFrame containing the mass, probability, and type of each ion.
BYion_peak_calculator_DIY(AAstr, Atom, Prob)BYion_peak_calculator_DIY(AAstr, Atom, Prob)
AAstr |
A string representing the amino acid sequence. |
Atom |
A string representing the isotope ("C13", "N15", "H2", "O18", "S34"). |
Prob |
A double representing the abundance of the specified isotope (0.0 to 1.0). |
A DataFrame with three columns: "Mass" containing the mass of each ion, "Prob" containing the probability of each ion, and "Kind" indicating whether the ion is a B or Y ion.
# Example usage df <- BYion_peak_calculator_DIY("PEPTIDE", "C13", 0.2) df <- BYion_peak_calculator_DIY("PEPTIDE", "N15", 0.5)# Example usage df <- BYion_peak_calculator_DIY("PEPTIDE", "C13", 0.2) df <- BYion_peak_calculator_DIY("PEPTIDE", "N15", 0.5)
This function calculates the isotope numbers for a given chemical formula using a Monte Carlo simulation approach.
cal_isotope_numbers(formula, num_simulations = 10000)cal_isotope_numbers(formula, num_simulations = 10000)
formula |
A character string representing the chemical formula. |
num_simulations |
An integer specifying the number of simulations to run. Default is 10,000. |
A data frame containing the results of the simulations.
cal_isotope_numbers("C6H12O6") cal_isotope_numbers("CF3COOH", num_simulations = 5000)cal_isotope_numbers("C6H12O6") cal_isotope_numbers("CF3COOH", num_simulations = 5000)
This function calculates the isotope numbers for Stable Isotope Probing (SIP) based on a given chemical formula using a Monte Carlo simulation approach.
cal_isotope_numbers_SIP(formula, num_simulations = 10000, ...)cal_isotope_numbers_SIP(formula, num_simulations = 10000, ...)
formula |
A character string representing the chemical formula, "C6H12O6" for example. |
num_simulations |
An integer specifying the number of simulations to run. Default is 10,000. |
... |
Additional arguments passed to the function, C13=0.5 for example to set the abundance of C13 to 0.5. |
A dataframe containing the results of the isotope number and mass calculations.
cal_isotope_numbers_SIP("C6H12O6") cal_isotope_numbers_SIP("C6H12O6", num_simulations = 10000, C13 = 0.5)cal_isotope_numbers_SIP("C6H12O6") cal_isotope_numbers_SIP("C6H12O6", num_simulations = 10000, C13 = 0.5)
This function calculates the isotope peaks for a given chemical formula using Fast Fourier Transform (FFT). It approximates the delta mass of isotopes is one neutron mass and ignore the fine structure of isotopes.
cal_isotope_peaks_fft(formula, N_width = 100, min_abundance = 1e-04, ...)cal_isotope_peaks_fft(formula, N_width = 100, min_abundance = 1e-04, ...)
formula |
A character string representing the chemical formula. |
N_width |
An integer specifying the width of the isotope envelope in FFT. Default is 100. Wider isotopic envolope will require larger N_width. |
min_abundance |
A numeric value specifying the minimum abundance threshold for the peaks. Default is 0.0001. |
... |
Additional arguments passed to the function. For example C13=0.5 will change the abundance of C13 to 0.5 and adjust the abundance of C12 accordingly. |
data.frame A data frame containing the calculated isotope peaks mass and their abundances.
# Example usage: cal_isotope_peaks_fft("C6H12O6") cal_isotope_peaks_fft("C6H12O6", N_width = 200, min_abundance = 0.001, C13 = 0.5)# Example usage: cal_isotope_peaks_fft("C6H12O6") cal_isotope_peaks_fft("C6H12O6", N_width = 200, min_abundance = 0.001, C13 = 0.5)
Simple calculator of C H O N P S atom count and mass without isotope of B Y ions
calBYAtomCountAndBaseMass(AAstrs)calBYAtomCountAndBaseMass(AAstrs)
AAstrs |
a CharacterVector of peptides |
a list of data.frame of C H O N P S atom count and each data.frame is for one peptide
peps <- calBYAtomCountAndBaseMass(c("HK~FL","AD!CH","~ILKMV"))peps <- calBYAtomCountAndBaseMass(c("HK~FL","AD!CH","~ILKMV"))
Simple calculator of C H O N P S atom count of peptide
calPepAtomCount(AAstrs)calPepAtomCount(AAstrs)
AAstrs |
a CharacterVector of peptides |
a dataframe of C H O N P S atom count each row is for one peptide
df <- calPepAtomCount(c("HKFL","ADCH"))df <- calPepAtomCount(c("HKFL","ADCH"))
Simple calculator neutron mass by average delta mass of each isotope
calPepNeutronMass(AAstrs, Atom, Probs)calPepNeutronMass(AAstrs, Atom, Probs)
AAstrs |
a CharacterVector of peptides |
Atom |
a Character of "C13", "H2", "O18", "N15", or "S34" |
Probs |
a NumericVector with the same length of AAstr for SIP abundances |
a vector of peptide neutron masses
masses <- calPepNeutronMass(c("HKFL", "ADCH"), "C13", c(0.2, 0.3))masses <- calPepNeutronMass(c("HKFL", "ADCH"), "C13", c(0.2, 0.3))
Simple calculator of peptide precursor mass by binomial NP
calPepPrecursorMass(AAstrs, Atom, Probs)calPepPrecursorMass(AAstrs, Atom, Probs)
AAstrs |
a CharacterVector of peptides |
Atom |
a Character of "C13", "H2", "O18", "N15", or "S34" |
Probs |
a NumericVector with the same length of AAstr for SIP abundances |
a vector of peptide precursor masses
masses <- calPepPrecursorMass(c("HKFL", "ADCH"), "C13", c(0.2, 0.3))masses <- calPepPrecursorMass(c("HKFL", "ADCH"), "C13", c(0.2, 0.3))
denoise one MS2 scan has charge
denoiseOneMS2ScanHasCharge(scanList, window, step, threshold)denoiseOneMS2ScanHasCharge(scanList, window, step, threshold)
scanList |
a list of one MS2 scan has charge |
window |
a float of mz window size for denoise |
step |
a float of mz step for denoise |
threshold |
a float of top N threshold for denoise |
a denoised MS2 scan has charge
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file) plot(getRealScanFromList(ft2[["1346"]])) ms2 <- denoiseOneMS2ScanHasCharge(ft2[["1346"]], 100, 10, 5) plot(getRealScanFromList(ms2))demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file) plot(getRealScanFromList(ft2[["1346"]])) ms2 <- denoiseOneMS2ScanHasCharge(ft2[["1346"]], 100, 10, 5) plot(getRealScanFromList(ms2))
extractPSMfeatures extract featueres of top PSMs from multiple .Spe2Pep.txt files
extractPSMfeatures(Spe2PepFilePath, topN, ftFilepath, ThreadNumber = 3L)extractPSMfeatures(Spe2PepFilePath, topN, ftFilepath, ThreadNumber = 3L)
Spe2PepFilePath |
a full path with .Spe2Pep.txt files in it |
topN |
store top N PSMs of each scan of one .FT2 file |
ftFilepath |
a full path with .FT1 and .FT2 files in it |
ThreadNumber |
read ThreadNumber of FT file at the same time, it will increase ram usage |
Set OpenMP stack size to avoid stack overflow in parallel processing before loading Aerith package: Sys.setenv(OMP_STACKSIZE = "16M") Sys.setenv(OMP_NUM_THREADS = parallel::detectCores())
A named list of data frames, each containing the extracted PSM features from the corresponding .Spe2Pep.txt file.
tmp <- tempdir() target_dir <- file.path(tmp, "target") dir.create(target_dir, showWarnings = FALSE) target_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(target_file, file.path(target_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) ft_dir <- file.path(tmp, "ft") dir.create(ft_dir, showWarnings = FALSE) ft_file <- system.file("extdata", "demo_target_decoy.FT1.rds", package = "Aerith") file_content <- readRDS(ft_file) writeLines(file_content, file.path(ft_dir, "Pan_052322_X13.FT1")) print(list.files(c(ft_dir, target_dir), full.names = TRUE, recursive = TRUE)) psm <- extractPSMfeatures(target_dir, 5, ft_dir, 3)tmp <- tempdir() target_dir <- file.path(tmp, "target") dir.create(target_dir, showWarnings = FALSE) target_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(target_file, file.path(target_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) ft_dir <- file.path(tmp, "ft") dir.create(ft_dir, showWarnings = FALSE) ft_file <- system.file("extdata", "demo_target_decoy.FT1.rds", package = "Aerith") file_content <- readRDS(ft_file) writeLines(file_content, file.path(ft_dir, "Pan_052322_X13.FT1")) print(list.files(c(ft_dir, target_dir), full.names = TRUE, recursive = TRUE)) psm <- extractPSMfeatures(target_dir, 5, ft_dir, 3)
extractPSMfeaturesTargetAndDecoy extract featueres of top PSMs from target and decoy .Spe2Pep.txt files
extractPSMfeaturesTargetAndDecoy( targetPath, decoyPath, topN, ftFilepath, ThreadNumber = 3L )extractPSMfeaturesTargetAndDecoy( targetPath, decoyPath, topN, ftFilepath, ThreadNumber = 3L )
targetPath |
a full path with target .Spe2PepFile.txt files in it |
decoyPath |
a full path with decoy .Spe2PepFile.txt files in it |
topN |
store top N PSMs of each scan of one .FT2 file |
ftFilepath |
a full path with .FT1 and .FT2 files in it |
ThreadNumber |
read ThreadNumber of FT file at the same time, it will increase ram usage |
Set OpenMP stack size to avoid stack overflow in parallel processing before loading Aerith package: Sys.setenv(OMP_STACKSIZE = "16M") Sys.setenv(OMP_NUM_THREADS = parallel::detectCores())
the PSMs in a dataframe in a list
tmp <- tempdir() target_dir <- file.path(tmp, "target") dir.create(target_dir, showWarnings = FALSE) target_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(target_file, file.path(target_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) decoy_dir <- file.path(tmp, "decoy") dir.create(decoy_dir, showWarnings = FALSE) decoy_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(decoy_file, file.path(decoy_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) ft_dir <- file.path(tmp, "ft") dir.create(ft_dir, showWarnings = FALSE) ft_file <- system.file("extdata", "demo_target_decoy.FT1.rds", package = "Aerith") file_content <- readRDS(ft_file) writeLines(file_content, file.path(ft_dir, "Pan_052322_X13.FT1")) print(list.files(c(ft_dir, target_dir, decoy_dir), full.names = TRUE, recursive = TRUE)) psm <- extractPSMfeaturesTargetAndDecoy(target_dir, decoy_dir, 3, ft_dir, 3)tmp <- tempdir() target_dir <- file.path(tmp, "target") dir.create(target_dir, showWarnings = FALSE) target_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(target_file, file.path(target_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) decoy_dir <- file.path(tmp, "decoy") dir.create(decoy_dir, showWarnings = FALSE) decoy_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(decoy_file, file.path(decoy_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) ft_dir <- file.path(tmp, "ft") dir.create(ft_dir, showWarnings = FALSE) ft_file <- system.file("extdata", "demo_target_decoy.FT1.rds", package = "Aerith") file_content <- readRDS(ft_file) writeLines(file_content, file.path(ft_dir, "Pan_052322_X13.FT1")) print(list.files(c(ft_dir, target_dir, decoy_dir), full.names = TRUE, recursive = TRUE)) psm <- extractPSMfeaturesTargetAndDecoy(target_dir, decoy_dir, 3, ft_dir, 3)
extractPSMfeaturesTargetAndDecoytoPercolatorPin extract featueres of top PSMs from target and decoy .Spe2Pep.txt files to pecorlator pin format
extractPSMfeaturesTargetAndDecoytoPercolatorPin( targetPath, decoyPath, topN, ftFilepath, ThreadNumber = 3L, doProteinInference = FALSE, fileName = "a.pin" )extractPSMfeaturesTargetAndDecoytoPercolatorPin( targetPath, decoyPath, topN, ftFilepath, ThreadNumber = 3L, doProteinInference = FALSE, fileName = "a.pin" )
targetPath |
a full path with target .Spe2PepFile.txt files in it |
decoyPath |
a full path with decoy .Spe2PepFile.txt files in it |
topN |
store top N PSMs of each scan of one .FT2 file |
ftFilepath |
a full path with .FT1 and .FT2 files in it |
ThreadNumber |
read ThreadNumber of FT file at the same time, it will increase ram usage |
doProteinInference |
out put protein inference format or only PSM format |
fileName |
output path of the percolator tsv file |
Set OpenMP stack size to avoid stack overflow in parallel processing before loading Aerith package: Sys.setenv(OMP_STACKSIZE = "16M") Sys.setenv(OMP_NUM_THREADS = parallel::detectCores())
NULL (invisibly).
tmp <- tempdir() target_dir <- file.path(tmp, "target") dir.create(target_dir, showWarnings = FALSE) target_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(target_file, file.path(target_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) decoy_dir <- file.path(tmp, "decoy") dir.create(decoy_dir, showWarnings = FALSE) decoy_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(decoy_file, file.path(decoy_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) ft_dir <- file.path(tmp, "ft") dir.create(ft_dir, showWarnings = FALSE) ft_file <- system.file("extdata", "demo_target_decoy.FT1.rds", package = "Aerith") file_content <- readRDS(ft_file) writeLines(file_content, file.path(ft_dir, "Pan_052322_X13.FT1")) pin_path <- file.path(tmp, "a.pin") extractPSMfeaturesTargetAndDecoytoPercolatorPin(target_dir, decoy_dir, 3, ft_dir, 3, FALSE, pin_path) print(list.files(c(ft_dir, target_dir, decoy_dir), full.names = TRUE, recursive = TRUE)) print(file.info(pin_path))tmp <- tempdir() target_dir <- file.path(tmp, "target") dir.create(target_dir, showWarnings = FALSE) target_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(target_file, file.path(target_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) decoy_dir <- file.path(tmp, "decoy") dir.create(decoy_dir, showWarnings = FALSE) decoy_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(decoy_file, file.path(decoy_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) ft_dir <- file.path(tmp, "ft") dir.create(ft_dir, showWarnings = FALSE) ft_file <- system.file("extdata", "demo_target_decoy.FT1.rds", package = "Aerith") file_content <- readRDS(ft_file) writeLines(file_content, file.path(ft_dir, "Pan_052322_X13.FT1")) pin_path <- file.path(tmp, "a.pin") extractPSMfeaturesTargetAndDecoytoPercolatorPin(target_dir, decoy_dir, 3, ft_dir, 3, FALSE, pin_path) print(list.files(c(ft_dir, target_dir, decoy_dir), full.names = TRUE, recursive = TRUE)) print(file.info(pin_path))
generateCFGs
generateCFGs(cfgPath, outPath, element)generateCFGs(cfgPath, outPath, element)
cfgPath |
a full path of .cfg file |
outPath |
a full path for .cfg file output |
element |
a string of element name, "N" for example |
a bool value if generate succeed or not
cfg <- system.file("extdata", "SiprosConfig.cfg", package = "Aerith") tmp <- tempdir() tmp <- file.path(tmp, "configs") generateCFGs(cfg, tmp, "N") list.files(tmp, full.names = TRUE)cfg <- system.file("extdata", "SiprosConfig.cfg", package = "Aerith") tmp <- tempdir() tmp <- file.path(tmp, "configs") generateCFGs(cfg, tmp, "N") list.files(tmp, full.names = TRUE)
generateOneCFG
generateOneCFG(cfgPath, outPath, element, pct, center, width)generateOneCFG(cfgPath, outPath, element, pct, center, width)
cfgPath |
a full path of .cfg file |
outPath |
a full path for .cfg file output |
element |
a string of element name, "N" for example |
pct |
a integer of element SIP abundance |
center |
a integer of mass window center |
width |
a integer of mass half window width |
a bool value if generate succeed or not
cfg <- system.file("extdata", "SiprosConfig.cfg", package = "Aerith") tmp <- tempdir() tmp <- file.path(tmp, "configs") generateOneCFG(cfg, tmp, "N", 50, 0, 2) list.files(tmp, full.names = TRUE)cfg <- system.file("extdata", "SiprosConfig.cfg", package = "Aerith") tmp <- tempdir() tmp <- file.path(tmp, "configs") generateOneCFG(cfg, tmp, "N", 50, 0, 2) list.files(tmp, full.names = TRUE)
getFilterThreshold
getFilterThreshold(workingPath, OverallThreshold)getFilterThreshold(workingPath, OverallThreshold)
workingPath |
a full path with .sip files in it |
OverallThreshold |
FDR thredhold of peptides |
a dataframe about filter threshold and FDR results
demo_dir <- system.file("extdata", package = "Aerith") getFilterThreshold(demo_dir, 0.01)demo_dir <- system.file("extdata", package = "Aerith") getFilterThreshold(demo_dir, 0.01)
getFilterThresholdTopPSMs get filter threshold of top PSMs of each scan from multiple .sip file
getFilterThresholdTopPSMs(workingPath, OverallThreshold, topN)getFilterThresholdTopPSMs(workingPath, OverallThreshold, topN)
workingPath |
a full path with .sip files in it |
OverallThreshold |
FDR thredhold of peptides |
topN |
store top N PSMs of each scan of one .FT file |
a dataframe about filter threshold and FDR results
demo_dir <- system.file("extdata", package = "Aerith") re <- getFilterThresholdTopPSMs(demo_dir, 0.01, 3) re$threshold head(re$topPSMs)demo_dir <- system.file("extdata", package = "Aerith") re <- getFilterThresholdTopPSMs(demo_dir, 0.01, 3) re$threshold head(re$topPSMs)
getFilterThresholdTopPSMsSpe2Pep get filter threshold of top PSMs of each scan from multiple .sip file
getFilterThresholdTopPSMsSpe2Pep( workingPath, OverallThreshold, topN, decoyPrefix )getFilterThresholdTopPSMsSpe2Pep( workingPath, OverallThreshold, topN, decoyPrefix )
workingPath |
a full path with .Spe2Pep files in it |
OverallThreshold |
FDR thredhold of peptides |
topN |
store top N PSMs of each scan of one .FT file |
decoyPrefix |
the prefix of decoy sequence |
a dataframe about filter threshold and FDR results,
rows of "
tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) a <- getFilterThresholdTopPSMsSpe2Pep(sip_dir, 1, 3, "Decoy_") a$thresholdtmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) a <- getFilterThresholdTopPSMsSpe2Pep(sip_dir, 1, 3, "Decoy_") a$threshold
add MZ to spectra data.frame
getMZ(spectra, charges = c(1, 2))getMZ(spectra, charges = c(1, 2))
spectra |
a dataframe of spectra |
charges |
ion charges |
a dataframe of spectra
spectra <- precursor_peak_calculator("KHRIP") spectra <- getMZ(spectra, 1:2)spectra <- precursor_peak_calculator("KHRIP") spectra <- getMZ(spectra, 1:2)
Get AAspectra object of precursor from AA sequence with natural SIP abundance
getPrecursorSpectra(AAstr, charges = c(1, 2))getPrecursorSpectra(AAstr, charges = c(1, 2))
AAstr |
Amino acid string |
charges |
Integer vector of charges. Default is 1:2 |
AAspectra object
getPrecursorSpectra("KHRIP", 1:2)getPrecursorSpectra("KHRIP", 1:2)
Convert one scan with charges=1 normalized by highest peak in scans list of ft file to AAspectra class
getRealScan(scanNumber, ft)getRealScan(scanNumber, ft)
scanNumber |
ScanNumber of one scan |
ft |
Scans list of ft file |
AAspectra object
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRealScan(1388, a) plot(b)demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRealScan(1388, a) plot(b)
Convert one scan in list format to AAspectra class
getRealScanFromList(scan)getRealScanFromList(scan)
scan |
one scan in list format |
AAspectra object
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRealScanFromList(a[[1]]) plot(b)demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRealScanFromList(a[[1]]) plot(b)
Get real scans from a scans list of one FT file with charges converted to 1 and intensities normalized by the highest peak.
getRealScans(ft, scanNumbers)getRealScans(ft, scanNumbers)
ft |
A list of scans from one FT file. |
scanNumbers |
An integer vector of scan numbers of PSMs. |
A list of AAspectra objects representing the real scans.
scanNumbers <- c("2596", "8182") demo_file <- system.file("extdata", "X13_4068_2596_8182.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file) realScans <- getRealScans(ft2, scanNumbers)scanNumbers <- c("2596", "8182") demo_file <- system.file("extdata", "X13_4068_2596_8182.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file) realScans <- getRealScans(ft2, scanNumbers)
get real scans with real charges and raw intensities from scans list of one ft file
getRealScansWithCharges(ft, scanNumbers)getRealScansWithCharges(ft, scanNumbers)
ft |
Scans list of one ft file |
scanNumbers |
Integer vector of scan number of PSMs |
List of AAspectra objects of real scans
scanNumbers <- c("2596", "8182") demo_file <- system.file("extdata", "X13_4068_2596_8182.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file) realScans <- getRealScansWithCharges(ft2, scanNumbers)scanNumbers <- c("2596", "8182") demo_file <- system.file("extdata", "X13_4068_2596_8182.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file) realScans <- getRealScansWithCharges(ft2, scanNumbers)
Convert one scan in scans with real charges and raw intensities from list of scans of ft file to AAspectra class
getRealScanWithCharge(scanNumber, ft)getRealScanWithCharge(scanNumber, ft)
scanNumber |
Integer. The scan number of one scan. |
ft |
List. The list of scans from an ft file. |
AAspectra object containing the scan data.
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRealScanWithCharge(1388, a) head(slot(b, "spectra"))demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRealScanWithCharge(1388, a) head(slot(b, "spectra"))
get retention time and precursor mass from scans list of ft file
getRetentionTimeAndPrecursorInfo(ft)getRetentionTimeAndPrecursorInfo(ft)
ft |
Scans list of ft file |
A data.frame of retention time and precursor mass
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRetentionTimeAndPrecursorInfo(a) rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) a <- readAllScanMS1(demo_file) b <- getRetentionTimeAndPrecursorInfo(a)demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRetentionTimeAndPrecursorInfo(a) rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) a <- readAllScanMS1(demo_file) b <- getRetentionTimeAndPrecursorInfo(a)
Get AAspectra object of B and Y ions from AA sequence with labeled SIP abundance
getSipBYionSpectra( AAstr, Atom = "C13", Prob = 0.0107, charges = 1, precursorCharges = 2 )getSipBYionSpectra( AAstr, Atom = "C13", Prob = 0.0107, charges = 1, precursorCharges = 2 )
AAstr |
Amino acide string |
Atom |
"C13" or "N15". Default is "C13" |
Prob |
C13 or N15's abundance. Default is 0.0107 |
charges |
NumericVector of product ion's charge. Default is 1:2 |
precursorCharges |
NumericVector of precursor's charge. Default is 2 |
AAspectra object
# add precursor a <- getSipBYionSpectra("KHRIPCDRK", "C13", 0.05, 1:2, 2) tail(slot(a, "spectra")) # not add precursor a <- getSipBYionSpectra("KHRIPCDRK", "C13", 0.05, 1:2, 0) tail(slot(a, "spectra"))# add precursor a <- getSipBYionSpectra("KHRIPCDRK", "C13", 0.05, 1:2, 2) tail(slot(a, "spectra")) # not add precursor a <- getSipBYionSpectra("KHRIPCDRK", "C13", 0.05, 1:2, 0) tail(slot(a, "spectra"))
Get AAspectra object of precursor from AA sequence with labeled SIP abundance
getSipPrecursorSpectra(AAstr, Atom = "C13", Prob = 0.0107, charges = c(1, 2))getSipPrecursorSpectra(AAstr, Atom = "C13", Prob = 0.0107, charges = c(1, 2))
AAstr |
Amino acide string |
Atom |
"C13" or "N15". Default is "C13" |
Prob |
C13 or N15's abundance. Default is 0.0107 |
charges |
Integer vector of charges. Default is 1:2 |
AAspectra object
getSipPrecursorSpectra("KHRIPCDRK", "C13", 0.05, 1:3)getSipPrecursorSpectra("KHRIPCDRK", "C13", 0.05, 1:3)
TIC: total ion chromatogram.
getTIC(ft)getTIC(ft)
ft |
Scans list of ft file |
A data.frame of TIC, relative TIC and retention time
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getTIC(a)demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getTIC(a)
getUnfilteredPeptides
getUnfilteredPeptides(workingPath)getUnfilteredPeptides(workingPath)
workingPath |
a full path with .sip files in it |
a dataframe of unique peptides and whether it is decoy sequence
demo_dir <- system.file("extdata", package = "Aerith") head(getUnfilteredPeptides(demo_dir))demo_dir <- system.file("extdata", package = "Aerith") head(getUnfilteredPeptides(demo_dir))
getUnfilteredPSMs
getUnfilteredPSMs(sipPath, ftPath, topN)getUnfilteredPSMs(sipPath, ftPath, topN)
sipPath |
a full path with .sip files in it |
ftPath |
a full path with .ft files in it |
topN |
store top N PSMs of each scan of one .FT file |
data.frame of PSMs
demo_dir <- system.file("extdata", package = "Aerith") head(getUnfilteredPSMs(demo_dir, demo_dir, 10))demo_dir <- system.file("extdata", package = "Aerith") head(getUnfilteredPSMs(demo_dir, demo_dir, 10))
S4 plot method producing a ggplot2 spectrum for an AAspectra object.
## S4 method for signature 'AAspectra,missing' plot(x, y, linewidth = 0.1, ...)## S4 method for signature 'AAspectra,missing' plot(x, y, linewidth = 0.1, ...)
x |
AAspectra object. |
y |
(ignored, must be missing) |
linewidth |
Numeric width of MS peaks. Default 0.1. |
... |
Passed on (currently unused). |
A ggplot2 object.
AAspectra
a <- getPrecursorSpectra("KHRIP", 2) plot(a) + ggplot2::scale_x_continuous(breaks = seq(324, 329, by = 0.5)) + ggplot2::geom_linerange(linewidth = 0.2)a <- getPrecursorSpectra("KHRIP", 2) plot(a) + ggplot2::scale_x_continuous(breaks = seq(324, 329, by = 0.5)) + ggplot2::geom_linerange(linewidth = 0.2)
This function reads all filtered PSM files in from output directory of Sipros 5, combines them, filters for labeled PSMs, extracts file names, computes log2 intensities, and generates a hexbin plot faceted by each input file.
plotFilteredPCTIntensitySummary( psms_dir = "psms/", output_file = "decoy_filtered_PCT_and_intensity_summary_by_file.pdf", width = 16, height = 12 )plotFilteredPCTIntensitySummary( psms_dir = "psms/", output_file = "decoy_filtered_PCT_and_intensity_summary_by_file.pdf", width = 16, height = 12 )
psms_dir |
Directory containing filtered PSM files (default: "psms/"). |
output_file |
Output PDF file name for the plot. |
width |
Width of the output PDF (default: 16). |
height |
Height of the output PDF (default: 12). |
A ggplot2 object representing the hexbin plot.
This function plots the molecular isotopes generated by Fast Fourier Transform (FFT).
plotMolecularFFTisotopes( isotope_numbers, charge = 1, minProb = 1e-04, yshift = -1, peakWidth = 0.5, textSize = 15 )plotMolecularFFTisotopes( isotope_numbers, charge = 1, minProb = 1e-04, yshift = -1, peakWidth = 0.5, textSize = 15 )
isotope_numbers |
A data.frame representing the isotope mass and abundance to be plotted. |
charge |
An integer representing the charge. Default is 1. |
minProb |
A numeric value representing the minimum probability. Default is 0.0001. |
yshift |
A numeric value representing the vertical shift applied to the plot for better visualization of the abundance close to 0. Default is -1. |
peakWidth |
A numeric value representing the width of the peaks in the plot. Default is 0.5. |
textSize |
A numeric value representing the size of the text in the plot. |
A ggplot object of molecular isotopes without fine structure by FFT algorithm
isotope_numbers <- cal_isotope_peaks_fft("C6H12O6", N_width = 200, min_abundance = 0.001, C13 = 0.5) plotMolecularFFTisotopes(isotope_numbers)isotope_numbers <- cal_isotope_peaks_fft("C6H12O6", N_width = 200, min_abundance = 0.001, C13 = 0.5) plotMolecularFFTisotopes(isotope_numbers)
This function generates a plot of molecular isotopes based on the provided isotope numbers.
plotMolecularIsotopes( isotope_numbers, charge = 1, minProb = 1e-04, jitterAmount = 0.03, yshift = -1, peakWidth = 0.5, labelN = 35, labelSize = 3, textSize = 15 )plotMolecularIsotopes( isotope_numbers, charge = 1, minProb = 1e-04, jitterAmount = 0.03, yshift = -1, peakWidth = 0.5, labelN = 35, labelSize = 3, textSize = 15 )
isotope_numbers |
A data.frame representing the isotope mass and abundance to be plotted. |
charge |
An integer representing the charge of the molecule. Default is 1. |
minProb |
A numeric value representing the minimum probability threshold for plotting. Default is 0.0001. |
jitterAmount |
A numeric value representing the amount of jitter to be added to the plot for better visualization of adjacent MZ. Default is 0.03. |
yshift |
A numeric value representing the vertical shift applied to the plot for better visualization of the abundance close to 0. Default is -1. |
peakWidth |
A numeric value representing the isotopic peak width in the plot. Default is 0.5. |
labelN |
An integer setting top N peaks to be annotated. Default is 35. |
labelSize |
A numeric value representing the size of the isotopologues labels. Default is 3. |
textSize |
A numeric value representing the size of the text in the plot. Default is 15. |
ggplot A ggplot object of molecular isotopes generated by Montecarlo algorithm.
isotope_numbers <- cal_isotope_numbers_SIP("C6H12O6", num_simulations = 10000, C13 = 0.5) plotMolecularIsotopes(isotope_numbers)isotope_numbers <- cal_isotope_numbers_SIP("C6H12O6", num_simulations = 10000, C13 = 0.5) plotMolecularIsotopes(isotope_numbers)
plot precursor annotation
plotPrecursorAnnotation( observedSpect, pep, charge, Atom, Prob, isoCenter = 0, isoWidth = 0, xwidth = 0, ifRemoveNotFoundIon = FALSE, ifShowPrecursorChargeAnnotation = TRUE, ifShowIsoCenter = TRUE, ifShowIsoWindow = TRUE, ifAdjustSIPabundance = TRUE, breakSize = 1/5, linewidth = 0.3 )plotPrecursorAnnotation( observedSpect, pep, charge, Atom, Prob, isoCenter = 0, isoWidth = 0, xwidth = 0, ifRemoveNotFoundIon = FALSE, ifShowPrecursorChargeAnnotation = TRUE, ifShowIsoCenter = TRUE, ifShowIsoWindow = TRUE, ifAdjustSIPabundance = TRUE, breakSize = 1/5, linewidth = 0.3 )
observedSpect |
AAspectra object of precursor scan |
pep |
peptide sequence |
charge |
precursor charge in consideration |
Atom |
SIP labeled atom "13C" or "15N" for exmaple |
Prob |
its SIP abundance (0.0~1.0) |
isoCenter |
isolation window center. Defaults to the center of
|
isoWidth |
isolation window width. Defaults to the m/z span of
|
xwidth |
x-axis display width around |
ifRemoveNotFoundIon |
set it FALSE as default |
ifShowPrecursorChargeAnnotation |
Logical. If TRUE, show precursor charge annotation labels with ggrepel. Default TRUE. |
ifShowIsoCenter |
Logical. If TRUE, show |
ifShowIsoWindow |
Logical. If TRUE, show grey dashed vertical lines at
isolation window boundaries ( |
ifAdjustSIPabundance |
Logical. If TRUE, estimate and re-fit SIP abundance from initial precursor annotation. Default TRUE. |
breakSize |
Numeric multiplier for isolation window to compute x-axis break step. Default is 1/5. |
linewidth |
Numeric width of peaks. Default 0.3. |
ggplot2 layer
realMZ <- c( 894.9413, 895.4429, 895.9444, 896.3896, 896.4448, 896.9463, 897.3890, 897.8896, 898.3930, 898.4734, 901.8851, 902.4465, 902.9483, 903.4498, 903.9504, 910.8968, 911.4449, 912.3784 ) realIntensity <- c( 16660537.0, 12344664.0, 6128400.5, 1448961.1, 1614148.1, 713238.8, 1999402.4, 1124157.4, 567865.2, 647140.8, 709644.2, 7805729.0, 8421993.0, 3200114.2, 1286055.5, 620246.8, 540861.6, 1079918.5 ) realCharge <- c(2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 2) scan <- list( peaks = data.frame( mz = realMZ, intensity = realIntensity, charge = realCharge ), precursorCharges = 2 ) observedSP <- getRealScanFromList(scan) p <- plotPrecursorAnnotation( observedSpect = observedSP, pep = "GITINTSHVEYDTPTR", charge = 2, Atom = "C13", Prob = 0.01, isoCenter = 902.4471, isoWidth = 5.0, xwidth = 20.0, ifRemoveNotFoundIon = TRUE ) prealMZ <- c( 894.9413, 895.4429, 895.9444, 896.3896, 896.4448, 896.9463, 897.3890, 897.8896, 898.3930, 898.4734, 901.8851, 902.4465, 902.9483, 903.4498, 903.9504, 910.8968, 911.4449, 912.3784 ) realIntensity <- c( 16660537.0, 12344664.0, 6128400.5, 1448961.1, 1614148.1, 713238.8, 1999402.4, 1124157.4, 567865.2, 647140.8, 709644.2, 7805729.0, 8421993.0, 3200114.2, 1286055.5, 620246.8, 540861.6, 1079918.5 ) realCharge <- c(2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 2) scan <- list( peaks = data.frame( mz = realMZ, intensity = realIntensity, charge = realCharge ), precursorCharges = 2 ) observedSP <- getRealScanFromList(scan) p <- plotPrecursorAnnotation( observedSpect = observedSP, pep = "GITINTSHVEYDTPTR", charge = 2, Atom = "C13", Prob = 0.01, isoCenter = 902.4471, isoWidth = 5.0, xwidth = 20.0, ifRemoveNotFoundIon = TRUE ) p
Plot precursor MZ frequency per 5 per minute of MS2
plotPrecursorMzFrequency( info, timeBinWidth = 1, x_breaks = seq(0, 200, by = 10) )plotPrecursorMzFrequency( info, timeBinWidth = 1, x_breaks = seq(0, 200, by = 10) )
info |
A data.frame of retention time and precursor mass |
timeBinWidth |
A numeric value of retention time bin width. Default is 1 |
x_breaks |
A numeric vector of breaks for x axis. Default is seq(0, 200, by = 10) |
A ggplot layer of scan frequency of MS2
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) a <- getRetentionTimeAndPrecursorInfo(a) plotPrecursorMzFrequency(a, timeBinWidth = 0.1, x_breaks = seq(8, 11, by = 0.2))demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) a <- getRetentionTimeAndPrecursorInfo(a) plotPrecursorMzFrequency(a, timeBinWidth = 0.1, x_breaks = seq(8, 11, by = 0.2))
plot the distribution of SIP percent of proteins
plotProSipPct(proPath)plotProSipPct(proPath)
proPath |
a pro.cluster.txt file's path |
a ggplot2 obj
demo_file <- system.file("extdata", "demo.pro.cluster.txt", package = "Aerith") p <- plotProSipPct(demo_file) pdemo_file <- system.file("extdata", "demo.pro.cluster.txt", package = "Aerith") p <- plotProSipPct(demo_file) p
plot PSM annotation
plotPSMannotation( observedSpect, pep, Atom, Prob, charges, isoCenter = 0, isoWidth = 0, ifRemoveNotFoundIon = FALSE )plotPSMannotation( observedSpect, pep, Atom, Prob, charges, isoCenter = 0, isoWidth = 0, ifRemoveNotFoundIon = FALSE )
observedSpect |
AAspectra object of real scan |
pep |
peptide sequence |
Atom |
SIP labeled atom "13C" or "15N" for exmaple |
Prob |
its SIP abundance (0.0~1.0) |
charges |
charges numeric vector for B/Y ions in consideration |
isoCenter |
isolation window center, set it 0 as default if not remove peaks in isolation window |
isoWidth |
isolation window width, set it 0 as default if not remove peaks in isolation window |
ifRemoveNotFoundIon |
set it False as default |
ggplot2 layer
demo_file <- system.file("extdata", "107728.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) a <- getRealScan("107728", a) p <- plotPSMannotation( observedSpect = a, pep = "HSQVFSTAEDNQSAVTIHVLQGER", Atom = "C13", Prob = 0.01, charges = c(2), isoCenter = 886.65, isoWidth = 4.0, ifRemoveNotFoundIon = TRUE ) pdemo_file <- system.file("extdata", "107728.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) a <- getRealScan("107728", a) p <- plotPSMannotation( observedSpect = a, pep = "HSQVFSTAEDNQSAVTIHVLQGER", Atom = "C13", Prob = 0.01, charges = c(2), isoCenter = 886.65, isoWidth = 4.0, ifRemoveNotFoundIon = TRUE ) p
plot PSMs from FT2 files and PSM results
plotPSMs( realScans, charges, Atom = "C13", Probs, BYcharge = c(1, 2), ftFileNames, scanNumbers, pepSeqs, proNames, path = "." )plotPSMs( realScans, charges, Atom = "C13", Probs, BYcharge = c(1, 2), ftFileNames, scanNumbers, pepSeqs, proNames, path = "." )
realScans |
List of AAspectra objects of real scan |
charges |
Integer vector of precursor charge of PSMs |
Atom |
"C13" or "N15". Default is "C13" |
Probs |
C13 or N15's abundance of PSMs |
BYcharge |
Integer vector of B Y ion. Default is 1:2 |
ftFileNames |
Character vector of FT2 file names |
scanNumbers |
Integer vector of scan number of PSMs |
pepSeqs |
Character vector of peptide sequence of PSMs |
proNames |
Character vector of protein name of PSMs |
path |
Output path of pdf. Default is "." |
PDF files saved in the specified path
element <- "C13" demo_file <- system.file("extdata", "demo.psm.txt", package = "Aerith") psm <- readPSMtsv(demo_file) psm <- psm[psm$Filename == "Pan_052322_X13.FT2", ] psm <- psm[psm$ScanNumber %in% c("4068", "2596", "8182"), ] demo_file <- system.file("extdata", "X13_4068_2596_8182.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file) ftFileNames <- psm$Filename scanNumbers <- psm$ScanNumber proNames <- psm$ProteinNames charges <- psm$ParentCharge pep <- psm$OriginalPeptide pep <- stringr::str_sub(pep, 2, -2) pct <- psm$SearchName pct <- as.numeric(stringr::str_sub( stringr::str_split(pct, "_", simplify = TRUE)[, 2], 1, -4 )) / 100 / 1000 realScans <- getRealScans(ft2, scanNumbers) tmp <- tempdir() plotPSMs( realScans, charges, element, pct, BYcharge = 1:2, ftFileNames, scanNumbers, pep, proNames, path = tmp ) list.files(tmp, pattern = ".pdf", full.names = TRUE)element <- "C13" demo_file <- system.file("extdata", "demo.psm.txt", package = "Aerith") psm <- readPSMtsv(demo_file) psm <- psm[psm$Filename == "Pan_052322_X13.FT2", ] psm <- psm[psm$ScanNumber %in% c("4068", "2596", "8182"), ] demo_file <- system.file("extdata", "X13_4068_2596_8182.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file) ftFileNames <- psm$Filename scanNumbers <- psm$ScanNumber proNames <- psm$ProteinNames charges <- psm$ParentCharge pep <- psm$OriginalPeptide pep <- stringr::str_sub(pep, 2, -2) pct <- psm$SearchName pct <- as.numeric(stringr::str_sub( stringr::str_split(pct, "_", simplify = TRUE)[, 2], 1, -4 )) / 100 / 1000 realScans <- getRealScans(ft2, scanNumbers) tmp <- tempdir() plotPSMs( realScans, charges, element, pct, BYcharge = 1:2, ftFileNames, scanNumbers, pep, proNames, path = tmp ) list.files(tmp, pattern = ".pdf", full.names = TRUE)
This function reads a PSM file, processes the SIP percent values, and generates a histogram with a dashed vertical line indicating the median.
plotPSMsipPCT(psmPath)plotPSMsipPCT(psmPath)
psmPath |
A character string specifying the path to the PSM file. |
A ggplot2 object representing the histogram of SIP percent values.
demo_file <- system.file("extdata", "demo.psm.txt", package = "Aerith") p <- plotPSMsipPCT(demo_file) pdemo_file <- system.file("extdata", "demo.psm.txt", package = "Aerith") p <- plotPSMsipPCT(demo_file) p
plot real scan layer under the B Y ion peaks
plotRealScan(spect, linewidth = 0.1)plotRealScan(spect, linewidth = 0.1)
spect |
AAspectra object of real scan |
linewidth |
ggplot2 layer
a <- getSipBYionSpectra("HSQVFSTAEDNQSAVTIHVLQGER", "C13", 0.01, 1:2) p <- plot(a) p <- p + plotSipBYionLabel(a) demo_file <- system.file("extdata", "107728.FT2", package = "Aerith") b <- readAllScanMS2(demo_file) c <- getRealScan(107728, b) p <- p + plotRealScan(c) pa <- getSipBYionSpectra("HSQVFSTAEDNQSAVTIHVLQGER", "C13", 0.01, 1:2) p <- plot(a) p <- p + plotSipBYionLabel(a) demo_file <- system.file("extdata", "107728.FT2", package = "Aerith") b <- readAllScanMS2(demo_file) c <- getRealScan(107728, b) p <- p + plotRealScan(c) p
Plot scan frequency
plotScanFrequency(info, binwidth = 1, breaks = seq(0, 200, by = 10))plotScanFrequency(info, binwidth = 1, breaks = seq(0, 200, by = 10))
info |
A data.frame of retention time and precursor mass |
binwidth |
A numeric value of bin width. Default is 1 |
breaks |
A numeric vector of breaks for x axis. Default is seq(0, 200, by = 10) |
A ggplot of scan frequency per minute
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRetentionTimeAndPrecursorInfo(a) plotScanFrequency(b, binwidth = 0.1, breaks = seq(9, 10, by = 0.2)) rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) a <- readAllScanMS1(demo_file) b <- getRetentionTimeAndPrecursorInfo(a) plotScanFrequency(b, binwidth = 0.1, breaks = seq(9, 10, by = 0.2))demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getRetentionTimeAndPrecursorInfo(a) plotScanFrequency(b, binwidth = 0.1, breaks = seq(9, 10, by = 0.2)) rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) a <- readAllScanMS1(demo_file) b <- getRetentionTimeAndPrecursorInfo(a) plotScanFrequency(b, binwidth = 0.1, breaks = seq(9, 10, by = 0.2))
Plot scan frequency layer of MS2
plotScanFrequencyMS2(info, binwidth = 1)plotScanFrequencyMS2(info, binwidth = 1)
info |
A data.frame of retention time and precursor mass |
binwidth |
A numeric value of bin width. Default is 1 |
A ggplot layer of scan frequency of MS2
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) a <- getRetentionTimeAndPrecursorInfo(a) rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) b <- readAllScanMS1(demo_file) b <- getRetentionTimeAndPrecursorInfo(b) plotScanFrequency(a, binwidth = 0.1, breaks = seq(9, 10, by = 0.2)) + plotScanFrequencyMS2(b, binwidth = 0.1)demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) a <- getRetentionTimeAndPrecursorInfo(a) rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) b <- readAllScanMS1(demo_file) b <- getRetentionTimeAndPrecursorInfo(b) plotScanFrequency(a, binwidth = 0.1, breaks = seq(9, 10, by = 0.2)) + plotScanFrequencyMS2(b, binwidth = 0.1)
plot the score of PSMs at different charge and mass error
plotScoreDistribution(sipFile)plotScoreDistribution(sipFile)
sipFile |
a .sip file's path |
a ggplot2 obj
sipFile <- system.file("extdata", "demo.sip", package = "Aerith") plotScoreDistribution(sipFile)sipFile <- system.file("extdata", "demo.sip", package = "Aerith") plotScoreDistribution(sipFile)
Draw AAspectra MS plot with B Y ion Labels
plotSipBYionLabel(spect)plotSipBYionLabel(spect)
spect |
AAspectra object of B Y ions |
ggplot2 layer
a <- getSipBYionSpectra("KHRIPCDRK", "C13", 0.05, 1:2) p <- plot(a) p + plotSipBYionLabel(a)a <- getSipBYionSpectra("KHRIPCDRK", "C13", 0.05, 1:2) p <- plot(a) p + plotSipBYionLabel(a)
This function reads a SIP filtered PSM file, processes the data, and generates a hexbin plot of log2 precursor intensity vs. MS1 isotopic abundances, faceted by each input file.
plotSIPfilteredPCTIntensityBySample( psm_file = "SIP_filtered_psms.tsv", output_file = "SIP_filtered_PCT_and_intensity_summary_by_sample.pdf", width = 16, height = 12 )plotSIPfilteredPCTIntensityBySample( psm_file = "SIP_filtered_psms.tsv", output_file = "SIP_filtered_PCT_and_intensity_summary_by_sample.pdf", width = 16, height = 12 )
psm_file |
Path to the filtered PSM file (e.g., "SIP_filtered_psms.tsv"). |
output_file |
Output PDF file name for the plot. |
width |
Width of the output PDF (default: 16). |
height |
Height of the output PDF (default: 12). |
A ggplot2 object representing the hexbin plot.
Plot TIC of MS1 or MS2
plotTIC(tic, breaks = seq(0, 200, by = 10))plotTIC(tic, breaks = seq(0, 200, by = 10))
tic |
A data.frame of TIC and retention time |
breaks |
A vector of breaks for x axis |
a ggplot2 object
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getTIC(a) plotTIC(b, seq(9, 10, by = 0.2))demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") a <- readAllScanMS2(demo_file) b <- getTIC(a) plotTIC(b, seq(9, 10, by = 0.2))
This function calculates the isotopic distribution of a given amino acid string and returns a DataFrame containing the mass and probability of each isotope.
precursor_peak_calculator(AAstr)precursor_peak_calculator(AAstr)
AAstr |
A string representing the amino acid sequence. |
A DataFrame with two columns: "Mass" containing the mass of each isotope and "Prob" containing the probability of each isotope.
a <- precursor_peak_calculator("PEPTIDE")a <- precursor_peak_calculator("PEPTIDE")
This function calculates the isotopic distribution of a given amino acid string with a user-defined isotopic distribution and returns a DataFrame containing the mass and probability of each isotope.
precursor_peak_calculator_DIY(AAstr, Atom, Prob)precursor_peak_calculator_DIY(AAstr, Atom, Prob)
AAstr |
A string representing the amino acid sequence. |
Atom |
A string representing the isotope ("C13", "N15", "H2", "O18", "S34"). |
Prob |
A double representing the abundance of the specified isotope (0.0 to 1.0). |
A DataFrame with two columns: "Mass" containing the mass of each isotope and "Prob" containing the probability of each isotope.
# Example usage df <- precursor_peak_calculator_DIY("PEPTIDE", "C13", 0.2) df <- precursor_peak_calculator_DIY("PEPTIDE", "N15", 0.5)# Example usage df <- precursor_peak_calculator_DIY("PEPTIDE", "C13", 0.2) df <- precursor_peak_calculator_DIY("PEPTIDE", "N15", 0.5)
Simple peak calculator of user defined isotopic distribution of one peptide by averagine
precursor_peak_calculator_DIY_averagine(AAstrs, Atom, Prob)precursor_peak_calculator_DIY_averagine(AAstrs, Atom, Prob)
AAstrs |
a CharacterVector of peptides |
Atom |
a CharacterVector C13 or N15 |
Prob |
a NumericVector for its abundance |
a list of DataFrames of spectra
demoSpectra <- precursor_peak_calculator_DIY_averagine(c("PEPTIDE", "ACDEFGHIK"), "C13", 0.25) demoSpectra[[1]]demoSpectra <- precursor_peak_calculator_DIY_averagine(c("PEPTIDE", "ACDEFGHIK"), "C13", 0.25) demoSpectra[[1]]
rankify numeric vector via ftFileWriter
rankyfify(a)rankyfify(a)
a |
A numeric vector whose values will be rank-transformed. |
A numeric vector containing the ranks of the input values.
demo_vec <- c(12.5, 3.2, 7.7, 3.2) rankyfify(demo_vec)demo_vec <- c(12.5, 3.2, 7.7, 3.2) rankyfify(demo_vec)
read MS1 scans with scanNumber as index
readAllScanMS1(ftFile)readAllScanMS1(ftFile)
ftFile |
a ft1 file's full path |
a list of MS1 scans with names of scan number
rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) ft1 <- readAllScanMS1(demo_file)rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) ft1 <- readAllScanMS1(demo_file)
read MS2 scans with scanNumber as index
readAllScanMS2(ftFile)readAllScanMS2(ftFile)
ftFile |
a ft2 file's full path |
a list of MS2 scans with names of scan number
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file)demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readAllScanMS2(demo_file)
Aggregate the top-ranked peptide-spectrum matches (PSMs) from each scan across all .sip files found in a directory.
readFilesScansTopPSMs(workingPath, topN)readFilesScansTopPSMs(workingPath, topN)
workingPath |
Character vector of length one giving the directory that contains |
topN |
Integer specifying how many top-ranked PSMs per scan to retain for each |
This helper constructs an internal sipFileReader, loads every .sip file located in the supplied path, and extracts the best topN PSMs per scan. The result is returned as a single data.frame with file identifiers, scan numbers, charge states, mass measurements, scores, peptide assignments, and protein annotations.
An R data.frame with one row per retained PSM and the columns fileNames, scanNumbers, parentCharges, measuredParentMasses, calculatedParentMasses, searchNames, scores, identifiedPeptides, originalPeptides, and proteinNames.
demo_dir <- system.file("extdata", package = "Aerith") re <- readFilesScansTopPSMs(demo_dir, 10) head(re)demo_dir <- system.file("extdata", package = "Aerith") re <- readFilesScansTopPSMs(demo_dir, 10) head(re)
readFilesScansTopPSMsFromOneFT2 read each scan's top PSMs from multiple .sip files of one .FT2 file
readFilesScansTopPSMsFromOneFT2(workingPath, pattern, topN)readFilesScansTopPSMsFromOneFT2(workingPath, pattern, topN)
workingPath |
a full path with .sip files in it |
pattern |
a regex pattern of the .FT2 file |
topN |
store top N PSMs of each scan of one .FT2 file |
a dataframe of top N PSMs
demo_dir <- system.file("extdata", package = "Aerith") re <- readFilesScansTopPSMsFromOneFT2(demo_dir, ".*demo.*", 3) head(re)demo_dir <- system.file("extdata", package = "Aerith") re <- readFilesScansTopPSMsFromOneFT2(demo_dir, ".*demo.*", 3) head(re)
read FT file header
readFTheader(ftFile)readFTheader(ftFile)
ftFile |
a ft1 file's full path |
a list of ft file header
rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) header <- readFTheader(demo_file)rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) header <- readFTheader(demo_file)
Read spectra from .mgf file
readMgf(mgf)readMgf(mgf)
mgf |
A .mgf file's path |
A list of spectra with names of scan number
demo_file <- system.file("extdata", "demo.mgf", package = "Aerith") a <- readMgf(demo_file) scan <- getRealScanFromList(a[["2648"]]) plot(scan)demo_file <- system.file("extdata", "demo.mgf", package = "Aerith") a <- readMgf(demo_file) scan <- getRealScanFromList(a[["2648"]]) plot(scan)
Read MS1 spectra from .mzML file
readMzmlMS1(ms)readMzmlMS1(ms)
ms |
A .mzML files's path |
A list of MS1 scans with names of scan number
# mzR can be installed from bioconductor # library(mzR) demo_file <- system.file("extdata", "demo.mzML", package = "Aerith") a <- readMzmlMS1(demo_file)# mzR can be installed from bioconductor # library(mzR) demo_file <- system.file("extdata", "demo.mzML", package = "Aerith") a <- readMzmlMS1(demo_file)
Read MS2 spectra from .mzML file
readMzmlMS2(ms)readMzmlMS2(ms)
ms |
A .mzML files's path |
A list of MS2 scans with names of scan number
# mzR can be installed from bioconductor # library(mzR) demo_file <- system.file("extdata", "demo.mzML", package = "Aerith") a <- readMzmlMS2(demo_file)# mzR can be installed from bioconductor # library(mzR) demo_file <- system.file("extdata", "demo.mzML", package = "Aerith") a <- readMzmlMS2(demo_file)
readOneScanMS1
readOneScanMS1(ftFile, scanNumber)readOneScanMS1(ftFile, scanNumber)
ftFile |
a ft1 file's full path |
scanNumber |
the scan at scanNumber |
a list of MS1 scan
rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) ft1 <- readOneScanMS1(demo_file, 1588)rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) ft1 <- readOneScanMS1(demo_file, 1588)
readOneScanMS2
readOneScanMS2(ftFile, scanNumber)readOneScanMS2(ftFile, scanNumber)
ftFile |
a ft2 file's full path |
scanNumber |
the scan at scanNumber |
a list of MS2 scan
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readOneScanMS2(demo_file, 1633)demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readOneScanMS2(demo_file, 1633)
Read PSM table from .pepXML file
readPepXMLtable(pepXML)readPepXMLtable(pepXML)
pepXML |
A .pepXML files's path |
A dataframe of psm table
# mzR can be installed from bioconductor # library(mzR) demo_file <- system.file("extdata", "demo.pepXML", package = "Aerith") a <- readPepXMLtable(demo_file)# mzR can be installed from bioconductor # library(mzR) demo_file <- system.file("extdata", "demo.pepXML", package = "Aerith") a <- readPepXMLtable(demo_file)
This function reads a Peptide-Spectrum Match (PSM) file in TSV (Tab-Separated Values) format.
readPSMtsv(tsv)readPSMtsv(tsv)
tsv |
A character string specifying the path to the PSM TSV file. |
A data frame containing the data from the PSM TSV file.
demo_file <- system.file("extdata", "demo.psm.txt", package = "Aerith") a <- readPSMtsv(demo_file)demo_file <- system.file("extdata", "demo.psm.txt", package = "Aerith") a <- readPSMtsv(demo_file)
read MS1 scans with scanNumber as index in a range
readScansMS1(ftFile, startScanNumber, endScanNumber)readScansMS1(ftFile, startScanNumber, endScanNumber)
ftFile |
a ft1 file's full path |
startScanNumber |
read scans starting from this scanNumber |
endScanNumber |
read scans ending at this scanNumber |
a list of MS1 scans with names of scan number
rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) ft1 <- readScansMS1(demo_file, 1398, 1503)rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) ft1 <- readScansMS1(demo_file, 1398, 1503)
read MS1 scans with scanNumber as index in a vector
readScansMS1Vector(ftFile, scanNumbersVector)readScansMS1Vector(ftFile, scanNumbersVector)
ftFile |
a ft1 file's full path |
scanNumbersVector |
a NumericVector of scan numbers |
A named list of MS1 scans with names of scan number. The names of the list correspond to the scan numbers.
rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) ft1 <- readScansMS1Vector(demo_file, c(1398, 1503, 1508))rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) ft1 <- readScansMS1Vector(demo_file, c(1398, 1503, 1508))
read MS2 scans with scanNumber as index in a range
readScansMS2(ftFile, startScanNumber, endScanNumber)readScansMS2(ftFile, startScanNumber, endScanNumber)
ftFile |
a ft2 file's full path |
startScanNumber |
read scans starting from this scanNumber |
endScanNumber |
read scans ending at this scanNumber |
a list of MS2 scans with names of scan number
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readScansMS2(demo_file, 1350, 1355)demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readScansMS2(demo_file, 1350, 1355)
read MS2 scans with scanNumber as index in a vector
readScansMS2Vector(ftFile, scanNumbersVector)readScansMS2Vector(ftFile, scanNumbersVector)
ftFile |
a ft2 file's full path |
scanNumbersVector |
read scans starting of these scanNumbers |
a list of MS2 scans with names of scan number
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readScansMS2Vector(demo_file, c(1350, 1355, 1359))demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") ft2 <- readScansMS2Vector(demo_file, c(1350, 1355, 1359))
Read a single .sip file and convert its peptide-spectrum matches (PSMs) into an R list.
readSip(sipFile)readSip(sipFile)
sipFile |
A character vector of length one containing the full path to a .sip file. |
The reader parses the provided .sip file and returns metadata together with a data.frame of PSM-level attributes.
An R list with file-level metadata (fileName, scanType, searchName, scoringFunction) and a PSM data frame containing scan numbers, charges, masses, scores, ranks, peptides, and protein names.
demo_file <- system.file("extdata", "demo.sip", package = "Aerith") re <- readSip(demo_file) head(re$PSM)demo_file <- system.file("extdata", "demo.sip", package = "Aerith") re <- readSip(demo_file) head(re$PSM)
Read every .sip file found in the provided directory and transform each file's peptide-spectrum matches into an R list entry.
readSips(workingPath)readSips(workingPath)
workingPath |
Character vector of length one giving the directory that contains |
This function constructs a sipFileReader for the supplied folder, loads all .sip files, and for each file returns a list containing metadata and a data.frame of peptide-spectrum matches (PSMs). The resulting object is an R list whose elements correspond to individual input files.
An R list; each element represents one .sip file and provides file-level descriptors (fileName, scanType, searchName, scoringFunction) together with a PSM data frame holding scan numbers, precursor charges, observed/calculated masses, scores, ranks, peptide sequences, and protein assignments.
demo_dir <- system.file("extdata", package = "Aerith") re <- readSips(demo_dir) head(re[[1]]$PSM)demo_dir <- system.file("extdata", package = "Aerith") re <- readSips(demo_dir) head(re[[1]]$PSM)
readSpe2Pep
readSpe2Pep(Spe2PepFile)readSpe2Pep(Spe2PepFile)
Spe2PepFile |
a .Spe2PepFile file's full path |
the PSMs in a dataframe in a list
target_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") psm <- readSpe2Pep(target_file) psm <- psm$PSMtarget_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") psm <- readSpe2Pep(target_file) psm <- psm$PSM
readSpe2PepFilesScansTopPSMs read each scan's top PSMs from multiple .Spe2Pep.txt files
readSpe2PepFilesScansTopPSMs(workingPath, topN = 5L)readSpe2PepFilesScansTopPSMs(workingPath, topN = 5L)
workingPath |
a full path with .Spe2Pep.txt files in it |
topN |
store top N PSMs of each scan of one .FT2 file |
the PSMs in a dataframe in a list
tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) psm <- readSpe2PepFilesScansTopPSMs(sip_dir, 3)tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) psm <- readSpe2PepFilesScansTopPSMs(sip_dir, 3)
readSpe2PepFilesScansTopPSMsFromEachFT2Parallel read each scan's top PSMs from multiple .Spe2PepFile.txt files of each .FT2 file
readSpe2PepFilesScansTopPSMsFromEachFT2Parallel(workingPath, topN = 5L)readSpe2PepFilesScansTopPSMsFromEachFT2Parallel(workingPath, topN = 5L)
workingPath |
a full path with .Spe2PepFile.txt files in it |
topN |
store top N PSMs of each scan of one .FT2 file |
a dataframe of top N PSMs
tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) top3 <- readSpe2PepFilesScansTopPSMsFromEachFT2Parallel(sip_dir, 3)tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) top3 <- readSpe2PepFilesScansTopPSMsFromEachFT2Parallel(sip_dir, 3)
readSpe2PepFilesScansTopPSMsFromEachFT2TargetAndDecoyParalle read each scan's top PSMs from multiple .Spe2PepFile.txt files of each .FT2 file
readSpe2PepFilesScansTopPSMsFromEachFT2TargetAndDecoyParallel( targetPath, decoyPath, topN = 5L )readSpe2PepFilesScansTopPSMsFromEachFT2TargetAndDecoyParallel( targetPath, decoyPath, topN = 5L )
targetPath |
a full path with target .Spe2PepFile.txt files in it |
decoyPath |
a full path with decoy .Spe2PepFile.txt files in it |
topN |
store top N PSMs of each scan of one .FT2 file |
a dataframe of top N PSMs
tmp <- tempdir() target_dir <- file.path(tmp, "target") dir.create(target_dir, showWarnings = FALSE) target_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(target_file, file.path(target_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) decoy_dir <- file.path(tmp, "decoy") dir.create(decoy_dir, showWarnings = FALSE) decoy_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(decoy_file, file.path(decoy_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) list.files(target_dir, full.names = TRUE) list.files(decoy_dir, full.names = TRUE) top3 <- readSpe2PepFilesScansTopPSMsFromEachFT2TargetAndDecoyParallel(target_dir, decoy_dir, 3)tmp <- tempdir() target_dir <- file.path(tmp, "target") dir.create(target_dir, showWarnings = FALSE) target_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(target_file, file.path(target_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) decoy_dir <- file.path(tmp, "decoy") dir.create(decoy_dir, showWarnings = FALSE) decoy_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(decoy_file, file.path(decoy_dir, "Pan_052322_X13.SIP_C13_050_000Pct.Spe2Pep.txt")) list.files(target_dir, full.names = TRUE) list.files(decoy_dir, full.names = TRUE) top3 <- readSpe2PepFilesScansTopPSMsFromEachFT2TargetAndDecoyParallel(target_dir, decoy_dir, 3)
readSpe2PepFilesScansTopPSMsFromOneFT2 read each scan's top PSMs from multiple .Spe2PepFile.txt files of one .FT2 file
readSpe2PepFilesScansTopPSMsFromOneFT2(workingPath, pattern, topN = 5L)readSpe2PepFilesScansTopPSMsFromOneFT2(workingPath, pattern, topN = 5L)
workingPath |
a full path with .Spe2PepFile.txt files in it |
pattern |
a regex pattern of the .FT2 file |
topN |
store top N PSMs of each scan of one .FT2 file |
a dataframe of top N PSMs
tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) top3 <- readSpe2PepFilesScansTopPSMsFromOneFT2(sip_dir, ".*X13.*", 3)tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) top3 <- readSpe2PepFilesScansTopPSMsFromOneFT2(sip_dir, ".*X13.*", 3)
readSpe2Peps
readSpe2Peps(workingPath)readSpe2Peps(workingPath)
workingPath |
a full path with .Spe2Pep.txt files in it |
the PSMs dataframes in lists
tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) psm <- readSpe2Peps(sip_dir) psm <- psm[[1]]$PSMtmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) list.files(sip_dir, full.names = TRUE) psm <- readSpe2Peps(sip_dir) psm <- psm[[1]]$PSM
Simple residue peak calculator of user defined isotopic distribution of one residue
residue_peak_calculator_DIY(residue, Atom, Prob)residue_peak_calculator_DIY(residue, Atom, Prob)
residue |
residue name |
Atom |
isotopes of "C13", "N15", "H2", "O18", "S34" |
Prob |
its SIP abundance (0.0~1.0) |
A DataFrame with two columns: "Mass" containing the mass of each isotope and "Prob" containing the probability of each isotope.
df <- residue_peak_calculator_DIY("A", "C13", 0.2)df <- residue_peak_calculator_DIY("A", "C13", 0.2)
scoreIntensity
scoreIntensity(observed, realIntensity, expectedIntensity, Atom, Prob)scoreIntensity(observed, realIntensity, expectedIntensity, Atom, Prob)
observed |
this peak is observed or not |
realIntensity |
real intensity in MS2 scan |
expectedIntensity |
expected intensity |
Atom |
"C13" or "N15" |
Prob |
its SIP abundance (0.0~1.0) |
a score of this intensity match
scoreIntensity(TRUE, 1200.0, 1180.0, "C13", 0.02)scoreIntensity(TRUE, 1200.0, 1180.0, "C13", 0.02)
scoreIntensityByCrossEntropy
scoreIntensityByCE(expectedIntensity, observedIntensity)scoreIntensityByCE(expectedIntensity, observedIntensity)
expectedIntensity |
expected intensityreal |
observedIntensity |
observed intensity in MS2 scan |
numeric, a score of this intensity match
scoreIntensityByCE(c(10.0, 20.0, 30.0), c(9.5, 21.0, 28.0))scoreIntensityByCE(c(10.0, 20.0, 30.0), c(9.5, 21.0, 28.0))
scorePSM
scorePSM(realMZ, realIntensity, realCharge, parentCharge, pepSeq, Atom, Prob)scorePSM(realMZ, realIntensity, realCharge, parentCharge, pepSeq, Atom, Prob)
realMZ |
mz vector in MS2 scan |
realIntensity |
intensity vector in MS2 scan |
realCharge |
charge vector in MS2 scan |
parentCharge |
int parent charge of MS2 scan |
pepSeq |
a string of peptide |
Atom |
"C13" or "N15" |
Prob |
its SIP abundance (0.0~1.0) |
a score of this PSM
demo_file <- system.file("extdata", "107728.FT2", package = "Aerith") scan1 <- readOneScanMS2(ftFile = demo_file, 107728) score <- scorePSM(scan1$peaks$mz, scan1$peaks$intensity, scan1$peaks$charge, 2, "[HSQVFSTAEDNQSAVTIHVLQGER]", "C13", 0.0107)demo_file <- system.file("extdata", "107728.FT2", package = "Aerith") scan1 <- readOneScanMS2(ftFile = demo_file, 107728) score <- scorePSM(scan1$peaks$mz, scan1$peaks$intensity, scan1$peaks$charge, 2, "[HSQVFSTAEDNQSAVTIHVLQGER]", "C13", 0.0107)
scorePSMsimple Score a PSM without isotopic envelope shape modeling
scorePSMsimple( realMZ, realIntensity, realCharge, parentCharge, pepSeq, Atom, Prob )scorePSMsimple( realMZ, realIntensity, realCharge, parentCharge, pepSeq, Atom, Prob )
realMZ |
mz vector in MS2 scan |
realIntensity |
intensity vector in MS2 scan |
realCharge |
charge vector in MS2 scan |
parentCharge |
precursor charge, 2 for example |
pepSeq |
a string of peptide |
Atom |
"C13" or "N15" |
Prob |
its SIP abundance (0.0~1.0) |
a score of this PSM
demo_file <- system.file("extdata", "107728.FT2", package = "Aerith") scan1 <- readOneScanMS2(ftFile = demo_file, scanNumber = 107728) score <- scorePSMsimple( scan1$peaks$mz, scan1$peaks$intensity, scan1$peaks$charge, 2, "[HSQVFSTAEDNQSAVTIHVLQGER]", "C13", 0.0107 )demo_file <- system.file("extdata", "107728.FT2", package = "Aerith") scan1 <- readOneScanMS2(ftFile = demo_file, scanNumber = 107728) score <- scorePSMsimple( scan1$peaks$mz, scan1$peaks$intensity, scan1$peaks$charge, 2, "[HSQVFSTAEDNQSAVTIHVLQGER]", "C13", 0.0107 )
This function reads a PSM file and computes summary statistics for the SIP percent values, including the total count, average, median, Median Absolute Deviation (MAD), standard deviation, estimated FDR, the number of labeled PSMs, and the median SIP percent for the labeled PSMs.
summaryPSMsipPCT(psmPath, SIPthreshold = 5, chargeThreshold = 3)summaryPSMsipPCT(psmPath, SIPthreshold = 5, chargeThreshold = 3)
psmPath |
A character string specifying the path to the PSM file. |
SIPthreshold |
Numeric value representing the SIP threshold (default is 5). |
chargeThreshold |
Numeric value representing the parent charge threshold (default is 3). |
A data frame containing summary statistics of the SIP percent values.
demo_file <- system.file("extdata", "demo.psm.txt", package = "Aerith") summaryStats <- summaryPSMsipPCT(demo_file) print(summaryStats)demo_file <- system.file("extdata", "demo.psm.txt", package = "Aerith") summaryStats <- summaryPSMsipPCT(demo_file) print(summaryStats)
write all MS1 scans has charge
writeAllScanMS1(header, scansList, ftFile)writeAllScanMS1(header, scansList, ftFile)
header |
a list of FT file header |
scansList |
a list of scans for output |
ftFile |
a ft1 file's output path |
TRUE if the file was written successfully, FALSE otherwise
rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) header <- readFTheader(demo_file) ft1 <- readAllScanMS1(demo_file) tmp <- tempdir() writeAllScanMS1(header, ft1[1:10], file.path(tmp, "demo10.FT1")) list.files(tmp, pattern = "demo10.FT1", full.names = TRUE)rds <- system.file("extdata", "demo.FT1.rds", package = "Aerith") demo_file <- tempfile(fileext = ".FT1") writeLines(readRDS(rds), demo_file) header <- readFTheader(demo_file) ft1 <- readAllScanMS1(demo_file) tmp <- tempdir() writeAllScanMS1(header, ft1[1:10], file.path(tmp, "demo10.FT1")) list.files(tmp, pattern = "demo10.FT1", full.names = TRUE)
write all MS2 scans has charge
writeAllScanMS2(header, scansList, ftFile)writeAllScanMS2(header, scansList, ftFile)
header |
a list of FT file header |
scansList |
a list of scans for output |
ftFile |
a ft2 file's output path |
TRUE if the file was written successfully, FALSE otherwise
demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") header <- readFTheader(demo_file) ft2 <- readAllScanMS2(demo_file) tmp <- tempdir() writeAllScanMS2(header,ft2[1:10],file.path(tmp, "demo10.FT2")) list.files(tmp, pattern = "demo10.FT2", full.names = TRUE)demo_file <- system.file("extdata", "demo.FT2", package = "Aerith") header <- readFTheader(demo_file) ft2 <- readAllScanMS2(demo_file) tmp <- tempdir() writeAllScanMS2(header,ft2[1:10],file.path(tmp, "demo10.FT2")) list.files(tmp, pattern = "demo10.FT2", full.names = TRUE)
writeSpe2PepFilesScansTopPSMsFromEachFT2Parallel read each scan's top PSMs from multiple .Spe2PepFile.txt files of each .FT2 file and write them to one tsv file
writeSpe2PepFilesScansTopPSMsFromEachFT2Parallel( workingPath, topN = 5L, fileName = "a.tsv" )writeSpe2PepFilesScansTopPSMsFromEachFT2Parallel( workingPath, topN = 5L, fileName = "a.tsv" )
workingPath |
a full path with .Spe2PepFile.txt files in it |
topN |
store top N PSMs of each scan of one .FT2 file |
fileName |
the output path |
nothing but write a tsv of top N PSMs
tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) writeSpe2PepFilesScansTopPSMsFromEachFT2Parallel(sip_dir, 3, file.path(sip_dir, "top3.tsv")) list.files(sip_dir, full.names = TRUE) print(file.info(file.path(sip_dir, "top3.tsv")))tmp <- tempdir() sip_dir <- file.path(tmp, "sip") dir.create(sip_dir) demo_file <- system.file("extdata", "demo_target.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000target.Spe2Pep.txt")) demo_file <- system.file("extdata", "demo_decoy.Spe2Pep.txt", package = "Aerith") file.copy(demo_file, file.path(sip_dir, "Pan_052322_X13.SIP_C13_050_000decoy.Spe2Pep.txt")) writeSpe2PepFilesScansTopPSMsFromEachFT2Parallel(sip_dir, 3, file.path(sip_dir, "top3.tsv")) list.files(sip_dir, full.names = TRUE) print(file.info(file.path(sip_dir, "top3.tsv")))