-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from targeted-lipidomics/dev
Release v0.1.0
- Loading branch information
Showing
65 changed files
with
298,443 additions
and
2,245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#' Dataset tissue_MRM_data | ||
#' | ||
#' This is a dataset containing Waters MRM data of SphingoMyelin 16:00 in Guinea pig lung tissue. | ||
#' | ||
#' @name tissue_MRM_data | ||
#' | ||
#' @section tissue_MRM_data.raw/imaging/Analyte 1.txt: | ||
#' | ||
#' This data is used in read_mrm(). | ||
NULL | ||
|
||
|
||
#' Dataset cal_MRM_data | ||
#' | ||
#' This is a dataset containing Waters MRM data of SphingoMyelin 16:00 in Guinea pig lung tissue. | ||
#' | ||
#' @name cal_MRM_data | ||
#' | ||
#' @section cal_MRM_data.raw/imaging/Analyte 1.txt: | ||
#' | ||
#' This data is used in read_mrm(). | ||
NULL | ||
|
||
|
||
#' Dataset ion_library | ||
#' | ||
#' This is a table containing a library of MRM transitions included in targeted MSI experiments. | ||
#' | ||
#' @name ion_library | ||
#' | ||
#' @section ion_library.txt: | ||
#' | ||
#' This data is used in read_mrm(). | ||
NULL | ||
|
||
|
||
#' Dataset cal_rois | ||
#' | ||
#' This is a table containing a logical data about caliobration levels pixels are associated with. | ||
#' | ||
#' @name cal_rois | ||
#' | ||
#' @section cal_rois.csv: | ||
#' | ||
#' This data is used to identify calibration spots. | ||
NULL | ||
|
||
|
||
#' Dataset calibration_metadata | ||
#' | ||
#' This is a table containing information about concentrations in the calibration spots. | ||
#' | ||
#' @name calibration_metadata | ||
#' | ||
#' @section calibration_metadata.csv: | ||
#' | ||
#' This data is used to create calibration curves in create_cal_curve(). | ||
NULL | ||
|
||
|
||
#' Dataset tissue_pixels | ||
#' | ||
#' This is a table containing a logical data about whether pixel is part of a calibration level. | ||
#' | ||
#' @name tissue_pixels | ||
#' | ||
#' @section tissue_pixels.csv: | ||
#' | ||
#' This data is used to identify tissue pixels. | ||
NULL | ||
|
||
|
||
#' Dataset tissue_rois | ||
#' | ||
#' This is a table containing a logical data about which tissue types pixels are associated with. | ||
#' | ||
#' @name tissue_rois | ||
#' | ||
#' @section tissue_rois.csv: | ||
#' | ||
#' This data is used to identify and label tissue types. | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
library(Cardinal) | ||
|
||
setGeneric("setCommonAxis", function(MSIobjects, ...) standardGeneric("setCommonAxis")) | ||
|
||
#' Function to update intensity with concentration values | ||
#' @import Cardinal | ||
#' @include setClasses.R | ||
#' | ||
#' @param MSIobjects List of MSIobjects | ||
#' @param ref_object MSIobject with all transitions of interets included | ||
#' @return List of MSIobjects with common fData and matching spectra | ||
#' | ||
#' @export | ||
setMethod("setCommonAxis", "list", | ||
function(MSIobjects, ref_object){ | ||
|
||
features = lapply( 1:length(MSIobjects), FUN=function(x){ | ||
data.frame(fData(MSIobjects[[x]])) }) | ||
|
||
ref_features = data.frame(fData(ref_object)) | ||
|
||
# Common axis | ||
for(i in 1:length(MSIobjects)){ | ||
|
||
if(all(dim(ref_features) == dim(features[[i]]))){ | ||
if(all(ref_features == features[[i]])) next | ||
} | ||
|
||
feat = features[[i]] | ||
|
||
# Correct fData | ||
feat = merge(x=ref_features, y=feat, by = c("precursor_mz", "product_mz"), | ||
all.x = T, all.y = F, suffixes = c("","_old")) %>% | ||
mutate(name = name_old, analyte = analyte_old) %>% | ||
arrange(mz) | ||
|
||
# Set empty iData | ||
idata = matrix(nrow=nrow(feat), ncol=ncol(MSIobjects[[i]])) | ||
|
||
# Update iData to spectral info corresponding to fData channels | ||
for(mz in (feat %>% subset(!is.na(analyte)))$mz){ | ||
|
||
old_mz = feat$mz_old[which(feat$mz == mz)] | ||
|
||
idata[mz, ] = spectra(MSIobjects[[i]][old_mz,]) | ||
|
||
} | ||
|
||
MSIobjects[[i]] <- MSImagingExperiment(imageData= idata, | ||
featureData= MassDataFrame(mz=as.numeric(feat$mz), | ||
analyte = feat$analyte, | ||
precursor_mz = as.numeric(feat$precursor_mz), | ||
product_mz = as.numeric(feat$product_mz), | ||
name = feat$name), | ||
pixelData=pData(MSIobjects[[i]])) | ||
} | ||
|
||
return(MSIobjects) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.