Skip to content

Commit 846c142

Browse files
committed
fix(spectronaut): Enable Fraction column to be processed
1 parent 4221ab4 commit 846c142

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

R/clean_Spectronaut.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
cols = c(protein_col, peptide_col, "FGCharge", "FFrgIon",
3131
f_charge_col, "RFileName", "RCondition", "RReplicate",
32-
"EGQvalue", pg_qval_col, interference_col, exclude_col,
33-
intensity_col)
32+
"RFraction", "EGQvalue", pg_qval_col, interference_col,
33+
exclude_col, intensity_col)
3434
if (calculateAnomalyScores){
3535
cols = c(cols, anomalyModelFeatures)
3636
}
@@ -41,9 +41,10 @@
4141
spec_input,
4242
c(protein_col, peptide_col, "FGCharge", "FFrgIon",
4343
f_charge_col, "RFileName", intensity_col,
44-
"RCondition", "RReplicate"),
44+
"RCondition", "RReplicate", "RFraction"),
4545
c("ProteinName", "PeptideSequence", "PrecursorCharge", "FragmentIon",
46-
"ProductCharge", "Run", "Intensity", "Condition", "BioReplicate"),
46+
"ProductCharge", "Run", "Intensity", "Condition", "BioReplicate",
47+
"Fraction"),
4748
skip_absent = TRUE)
4849

4950
spec_input = .assignSpectronautIsotopeLabelType(

inst/tinytest/test_clean_Spectronaut.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ output = MSstatsConvert:::.cleanRawSpectronaut(msstats_input, intensity = 'FG.MS
99
calculateAnomalyScores = FALSE,
1010
anomalyModelFeatures = c())
1111
expect_true(all(output$Intensity == 100000))
12+
# When R.Fraction is absent, no Fraction column is added (prior behavior)
13+
expect_false("Fraction" %in% colnames(output))
14+
15+
# R.Fraction is transferred and renamed to Fraction when present
16+
spectronaut_frac = data.table::copy(spectronaut_raw)
17+
spectronaut_frac$R.Fraction = 2L
18+
msstats_frac = MSstatsConvert::MSstatsImport(
19+
list(input = spectronaut_frac), "MSstats", "Spectronaut")
20+
output_frac = MSstatsConvert:::.cleanRawSpectronaut(msstats_frac, intensity = 'FG.MS1Quantity',
21+
calculateAnomalyScores = FALSE,
22+
anomalyModelFeatures = c())
23+
expect_true("Fraction" %in% colnames(output_frac))
24+
expect_false("RFraction" %in% colnames(output_frac))
25+
expect_true(all(output_frac$Fraction == 2L))
1226

1327
expect_error(MSstatsConvert:::.cleanRawSpectronaut(msstats_input, intensity = 'invalid',
1428
calculateAnomalyScores = FALSE,

0 commit comments

Comments
 (0)