0
$\begingroup$

With the library lipidr lipidomics data has been normalized using the function normalize_pqn(), and I need to get the normalized data to perform further statistical analysis without using lipidr library, but I am not able to get that data.

The function normalize_pqn() code is:

function (data, measure = "Area", exclude = "blank", 
    log = TRUE) 
{
    data <- .prenormalize_check(data, measure, exclude)
    m <- assay(data, measure)
    factor_n <- apply(m/rowMeans(m, na.rm = TRUE), 2, median, 
        na.rm = TRUE)
    normalized_m <- apply(m, 1, function(x) x/factor_n) %>% t()
    rownames(normalized_m) <- rownames(m)
    assay(data, measure) <- normalized_m
    data <- set_normalized(data, measure, TRUE)
    return(.log_data(data, measure, log))
}

The object lipidomics experiment object has the following structure:

Formal class 'LipidomicsExperiment' [package "lipidr"] with 5 slots
  ..@ colData        :Formal class 'DFrame' [package "S4Vectors"] with 6 slots
  .. .. ..@ rownames       : chr [1:10] "S1" "S2" "S3" "S4" ...
  .. .. ..@ nrows          : int 10
  .. .. ..@ listData       :List of 2
  .. .. .. ..$ Type   : chr [1:10] "EXO" "EXO" "EXO" "EXO" ...
  .. .. .. ..$ Patient: int [1:10] 1 2 3 4 5 1 2 3 4 5
  .. .. ..@ elementType    : chr "ANY"
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ assays         :Formal class 'SimpleAssays' [package "SummarizedExperiment"] with 1 slot
  .. .. ..@ data:Formal class 'SimpleList' [package "S4Vectors"] with 4 slots
  .. .. .. .. ..@ listData       :List of 1
  .. .. .. .. .. ..$ Area: num [1:1110, 1:10] 0 10.4 0 11.4 0 ...
  .. .. .. .. .. .. ..- attr(*, "dimnames")=List of 2
  .. .. .. .. .. .. .. ..$ : chr [1:1110] "1" "2" "3" "4" ...
  .. .. .. .. .. .. .. ..$ : chr [1:10] "S1" "S2" "S3" "S4" ...
  .. .. .. .. ..@ elementType    : chr "ANY"
  .. .. .. .. ..@ elementMetadata:Formal class 'DFrame' [package "S4Vectors"] with 6 slots
  .. .. .. .. .. .. ..@ rownames       : NULL
  .. .. .. .. .. .. ..@ nrows          : int 1
  .. .. .. .. .. .. ..@ listData       :List of 2
  .. .. .. .. .. .. .. ..$ logged    : logi TRUE
  .. .. .. .. .. .. .. ..$ normalized: logi TRUE
  .. .. .. .. .. .. ..@ elementType    : chr "ANY"
  .. .. .. .. .. .. ..@ elementMetadata: NULL
  .. .. .. .. .. .. ..@ metadata       : list()
  .. .. .. .. ..@ metadata       : list()
  ..@ NAMES          : chr [1:1110] "1" "2" "3" "4" ...
  ..@ elementMetadata:Formal class 'DFrame' [package "S4Vectors"] with 6 slots
  .. .. ..@ rownames       : NULL
  .. .. ..@ nrows          : int 1110
  .. .. ..@ listData       :List of 22
  .. .. .. ..$ filename   : chr [1:1110] "dataframe" "dataframe" "dataframe" "dataframe" ...
  .. .. .. ..$ Molecule   : chr [1:1110] "3-Hydroxymethylglutaric acid" "Maltulose" "trans-2-Hexenedioic acid" "L-Histidine" ...
  .. .. .. ..$ clean_name : chr [1:1110] "acid 3-Hydroxymethylglutaric" "Maltulose" "trans-2-Hexenedioic acid" "L-Histidine" ...
  .. .. .. ..$ ambig      : logi [1:1110] FALSE FALSE FALSE FALSE FALSE FALSE ...
  .. .. .. ..$ not_matched: logi [1:1110] TRUE TRUE TRUE TRUE TRUE TRUE ...
  .. .. .. ..$ istd       : logi [1:1110] FALSE FALSE FALSE FALSE FALSE FALSE ...
  .. .. .. ..$ class_stub : chr [1:1110] NA NA NA NA ...
  .. .. .. ..$ chain1     : chr [1:1110] NA NA NA NA ...
  .. .. .. ..$ l_1        : int [1:1110] NA NA NA NA NA NA NA NA NA NA ...
  .. .. .. ..$ s_1        : int [1:1110] NA NA NA NA NA NA NA NA NA NA ...
  .. .. .. ..$ chain2     : chr [1:1110] NA NA NA NA ...
  .. .. .. ..$ l_2        : int [1:1110] NA NA NA NA NA NA NA NA NA NA ...
  .. .. .. ..$ s_2        : int [1:1110] NA NA NA NA NA NA NA NA NA NA ...
  .. .. .. ..$ chain3     : chr [1:1110] NA NA NA NA ...
  .. .. .. ..$ l_3        : int [1:1110] NA NA NA NA NA NA NA NA NA NA ...
  .. .. .. ..$ s_3        : int [1:1110] NA NA NA NA NA NA NA NA NA NA ...
  .. .. .. ..$ chain4     : chr [1:1110] NA NA NA NA ...
  .. .. .. ..$ l_4        : logi [1:1110] NA NA NA NA NA NA ...
  .. .. .. ..$ s_4        : logi [1:1110] NA NA NA NA NA NA ...
  .. .. .. ..$ total_cl   : int [1:1110] NA NA NA NA NA NA NA NA NA NA ...
  .. .. .. ..$ total_cs   : int [1:1110] NA NA NA NA NA NA NA NA NA NA ...
  .. .. .. ..$ Class      : chr [1:1110] NA NA NA NA ...
  .. .. ..@ elementType    : chr "ANY"
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ metadata       :List of 2
  .. ..$ summarized: logi FALSE
  .. ..$ dimnames  : chr [1:2] "TransitionId" "Sample"

When I use the function assay() I get the data but not the normalize data.

Thank you in advance!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.