prnSig: Significance tests of peptide/protein log2FC

pepSigR Documentation

Significance tests of peptide/protein log2FC

Description

pepSig performs significance tests against peptide log2FC.

prnSig performs significance tests against protein log2FC.

Usage

pepSig(
  scale_log2r = TRUE,
  impute_na = FALSE,
  complete_cases = FALSE,
  rm_allna = FALSE,
  method = c("limma", "lm"),
  padj_method = "BH",
  method_replace_na = c("none", "min"),
  var_cutoff = 0.001,
  pval_cutoff = 1,
  logFC_cutoff = log2(1),
  df = NULL,
  filepath = NULL,
  filename = NULL,
  ...
)

prnSig(
  scale_log2r = TRUE,
  impute_na = FALSE,
  complete_cases = FALSE,
  rm_allna = FALSE,
  method = c("limma", "lm"),
  padj_method = "BH",
  method_replace_na = c("none", "min"),
  var_cutoff = 0.001,
  pval_cutoff = 1,
  logFC_cutoff = log2(1),
  df = NULL,
  filepath = NULL,
  filename = NULL,
  ...
)

Arguments

scale_log2r

Logical; if TRUE, adjusts log2FC to the same scale of standard deviation across all samples. The default is TRUE. At scale_log2r = NA, the raw log2FC without normalization will be used.

impute_na

Logical; if TRUE, data with the imputation of missing values will be used. The default is FALSE.

complete_cases

Logical; if TRUE, only cases that are complete with no missing values will be used. The default is FALSE.

rm_allna

Logical; if TRUE, removes data rows that are exclusively NA across ratio columns of log2_R126 etc. The setting also applies to log2_R000 in LFQ.

method

Character string; the method of linear modeling. The default is limma. At method = lm, the lm() in base R will be used for models without random effects and the lmer will be used for models with random effects.

padj_method

Character string; the method of multiple-test corrections for uses with p.adjust. The default is "BH". See ?p.adjust.methods for additional choices.

method_replace_na

The method to replace NA values by rows. The default is none by doing nothing. At method_replace_na = min, the row minimums will be used. The argument is only a device to assess pVals, e.g., by handling the circumstance of all NA values under one group and non-trivial values under another. The setting of min might be useful at the experimenters' discretion of ascribing NA values to the lack of signals. The argument has no effects with impute_na = TRUE.

var_cutoff

Numeric; the cut-off in the variances of log2FC. Entries with variances smaller than the threshold will be excluded from linear modeling. The default is 1E-3.

pval_cutoff

Numeric; the cut-off in significance pVal. Entries with pVals smaller than the threshold will be excluded from multiple test corrections. The default is at 1 to include all entries.

logFC_cutoff

Numeric; the cut-off in log2FC. Entries with absolute log2FC smaller than the threshold will be removed from multiple test corrections. The default is at log2(1) to include all entries.

df

The name of a primary data file. By default, it will be determined automatically after matching the types of data and analysis with an id among c("pep_seq", "pep_seq_mod", "prot_acc", "gene"). A primary file contains normalized peptide or protein data and is among c("Peptide.txt", "Peptide_pVal.txt", "Peptide_impNA_pVal.txt", "Protein.txt", "Protein_pVal.txt", "protein_impNA_pVal.txt"). For analyses require the fields of significance p-values, the df will be one of c("Peptide_pVal.txt", "Peptide_impNA_pVal.txt", "Protein_pVal.txt", "protein_impNA_pVal.txt").

filepath

A file path to output results. By default, it will be determined automatically by the name of the calling function and the value of id in the call.

filename

A file name to output results. The default is Peptide_pVals.txt for peptides and Protein_pVals for proteins.

...

User-defined formulas for linear modeling. The syntax starts with a tilde, followed by the name of an available column key in expt_smry.xlsx and square brackets. The contrast groups are then quoted with one to multiple contrast groups separated by commas. The default column key is Term in expt_smry.xlsx:
~ Term["A - C", "B - C"].

Additive random effects are indicated by + (1|col_key_1) + (1|col_key_2)... Currently only a syntax of single contrast are supported for uses with random effects:
~ Term["A - C"] + (1|col_key_1) + (1|col_key_2)

filter_: Logical expression(s) for the row filtration against data in a primary file of Peptide[_impNA].txt or Protein[_impNA].txt. See also normPSM for the format of filter_ statements.

Details

In general, special characters of + or - should be avoided from contrast terms. Occasionally, such as in biological studies, it may be convenient to use A+B to denote a condition of combined treatment of A and B . In the case, one can put the term(s) containing + or - into a pair of pointy brackets. The syntax in the following hypothetical example will compare the effects of A, B, A+B and the average of A and B to control C:

prnSig(fml = ~ Term["A - C", "B - C", "<A + B> - C", "(A + B)/2 - C"])

Note that <A + B> stands for one sample and (A + B) has two samples in it.

Value

The primary output is .../Peptide/Model/Peptide_pVals.txt for peptide data or .../Protein/Model/Protein_pVals.txt for protein data. At impute_na = TRUE, the corresponding outputs are Peptide_impNA_pvals.txt or Protein_impNA_pvals.txt.

See Also

Metadata
load_expts for metadata preparation and a reduced working example in data normalization

Data normalization
normPSM for extended examples in PSM data normalization
PSM2Pep for extended examples in PSM to peptide summarization
mergePep for extended examples in peptide data merging
standPep for extended examples in peptide data normalization
Pep2Prn for extended examples in peptide to protein summarization
standPrn for extended examples in protein data normalization.
purgePSM and purgePep for extended examples in data purging
pepHist and prnHist for extended examples in histogram visualization.
extract_raws and extract_psm_raws for extracting MS file names

Variable arguments of 'filter_...'
contain_str, contain_chars_in, not_contain_str, not_contain_chars_in, start_with_str, end_with_str, start_with_chars_in and ends_with_chars_in for data subsetting by character strings

Missing values
pepImp and prnImp for missing value imputation

Informatics
pepSig and prnSig for significance tests
pepVol and prnVol for volcano plot visualization
prnGSPA for gene set enrichment analysis by protein significance pVals
gspaMap for mapping GSPA to volcano plot visualization
prnGSPAHM for heat map and network visualization of GSPA results
prnGSVA for gene set variance analysis
prnGSEA for data preparation for online GSEA.
pepMDS and prnMDS for MDS visualization
pepPCA and prnPCA for PCA visualization
pepLDA and prnLDA for LDA visualization
pepHM and prnHM for heat map visualization
pepCorr_logFC, prnCorr_logFC, pepCorr_logInt and prnCorr_logInt for correlation plots
anal_prnTrend and plot_prnTrend for trend analysis and visualization
anal_pepNMF, anal_prnNMF, plot_pepNMFCon, plot_prnNMFCon, plot_pepNMFCoef, plot_prnNMFCoef and plot_metaNMF for NMF analysis and visualization

Custom databases
Uni2Entrez for lookups between UniProt accessions and Entrez IDs
Ref2Entrez for lookups among RefSeq accessions, gene names and Entrez IDs
prepGO for gene ontology
prepMSig for molecular signatures
prepString and anal_prnString for STRING-DB

Column keys in PSM, peptide and protein outputs
system.file("extdata", "psm_keys.txt", package = "proteoQ")
system.file("extdata", "peptide_keys.txt", package = "proteoQ")
system.file("extdata", "protein_keys.txt", package = "proteoQ")

Examples


# ===================================
# Significance tests
# ===================================

## !!!require the brief working example in `?load_expts`

## global option
scale_log2r <- TRUE

## peptides (`Term` etc. are user-defined column keys in expt_smry.xlsx)
pepSig(
  impute_na = FALSE, 
  W2_bat = ~ Term["W2.BI.TMT2-W2.BI.TMT1", 
                  "W2.JHU.TMT2-W2.JHU.TMT1", 
                  "W2.PNNL.TMT2-W2.PNNL.TMT1"],
  W2_loc = ~ Term_2["W2.BI-W2.JHU", 
                    "W2.BI-W2.PNNL", 
                    "W2.JHU-W2.PNNL"],
  W16_vs_W2 = ~ Term_3["W16-W2"], 
)

pepVol()

## proteins (formulae matched to `pepSig` by default)
prnSig(impute_na = FALSE)
prnVol()

# note the incongruity in peptide and protein fold changes
# (no measures for peptides but for proteins)

#  sequence |   ref    | sample_1 | sample_2 |  log2FC   
# -------------------------------------------------------
# prnX_pep1 |    0     |   1.15   |    NA    |    NA
# prnX_pep2 |    0     |    NA    |   0.05   |    NA


#  protein  |   ref    | sample_1 | sample_2 |  log2FC   
# -------------------------------------------------------
#   prnX    |    0     |   1.15   |    0.05  |   1.10

## averaged batch effect
# (suggest run both `pepSig` and `prnSig` for consistency)
pepSig(
  impute_na = FALSE,
  W2_loc_2 = ~ Term["(W2.BI.TMT2+W2.BI.TMT1)/2 - (W2.JHU.TMT2+W2.JHU.TMT1)/2"], 
)

prnSig(impute_na = FALSE)

pepVol()
prnVol()

## random effects
# NA imputation (suggested for models with random effects)
pepImp(m = 2, maxit = 2)
prnImp(m = 5, maxit = 5)

# single
pepSig(
  impute_na = TRUE,
  W2_vs_W16_fix = ~ Term_3["W16-W2"],
  W2_vs_W16_mix = ~ Term_3["W16-W2"] + (1|TMT_Set),
)

prnSig(impute_na = TRUE)

pepVol()
prnVol()

# one to multiple (method `lm` for multiple random)
pepSig(
  impute_na = TRUE,
  method = lm,
  W2_vs_W16_fix = ~ Term_3["W16-W2"],
  W2_vs_W16_mix = ~ Term_3["W16-W2"] + (1|TMT_Set),
  W2_vs_W16_mix_2 = ~ Term_3["W16-W2"] + (1|TMT_Set) + (1|Color),
)

prnSig(
  impute_na = TRUE,
  method = lm,
)

pepVol()
prnVol()



qzhang503/proteoQ documentation built on Dec. 14, 2024, 12:27 p.m.