DavisLaboratory / msImpute

Methods for label-free mass spectrometry proteomics
14 stars 0 forks source link

Doubt about input in mspip - FNN::get.knnx #6

Closed EidrianGM closed 6 months ago

EidrianGM commented 6 months ago

In lines 20 to 38 of function mspip

lc_ms_anchors <- c("Raw.file.id", "Charge", "m.z", "Mass", 
    "Intensity", "Retention.time")
attr_msms <- c(lc_ms_anchors[grep("Raw.file", lc_ms_anchors, 
    invert = TRUE)])
attr_pasef <- c(lc_ms_anchors[grep("Raw.file", lc_ms_anchors, 
    invert = TRUE)], c("Min.frame.index", "Max.frame.index", 
    "Ion.mobility.index", "Ion.mobility.index.length", "Ion.mobility.index.length..FWHM."))
anchors <- attr_msms
if (tims_ms) 
    anchors <- attr_pasef
evidence <- evidence[complete.cases(evidence[, lc_ms_anchors]), 
  ]
allPeptides <- allPeptides[complete.cases(allPeptides[, 
   lc_ms_anchors]), ]
dists <- FNN::get.knnx(allPeptides[, lc_ms_anchors], evidence[, 
    lc_ms_anchors], k = 1)
identified_peptides <- allPeptides[dists$nn.index, tolower(colnames(allPeptides)) %in% 
                                   tolower(c("Raw.file.id", anchors))]
identified_peptides$PeptideID <- evidence$PeptideID                                   

The input of FNN::get.knnx, allPeptides[, lc_ms_anchors] and evidence[, lc_ms_anchors] should have the same dimensions? or What is more should the rows of each matrix be referred to the same peptide?

soroorh commented 6 months ago

Hey, they should just have the columns. the number of rows can be different.