Count samples/patients per peptide or protein, pivoted wide by group
Source:R/overlap-counters.R
count_uniqueby_ip.RdWraps count_uniqueby() for the common pep_all "how many samples/
patients was this peptide/protein seen in, per group" question: groups by
var within by plus the identity columns appropriate for level, then
pivots so each by level becomes its own n_<var>s.<by level> column.
Arguments
- input
A
pep_all-shaped data frame.- var
Column (tidy-evaluated) to count distinct entries of, e.g.
SampleorPatient.- by
Column (tidy-evaluated) whose levels become the pivoted-wide columns, e.g.
ConditionorSample_type.- level
One of
"Peptide"(groups byAccession,ProteinFirst,GeneFirst,OrganismFirst,Length,Peptide,Sequence) or"Protein"(groups byAccession,ProteinFirst,GeneFirst,OrganismFirstonly —ProteinFirst/GeneFirstare deliberately excluded from the"Peptide"grouping key beyond what's listed because some peptides were assigned to differentProteinFirstvalues across processing runs despite sharingAccession/Sequence).