Giter Site home page Giter Site logo

metabcombiner's People

Contributors

hhabra avatar jonaheaton avatar jwokaty avatar nturaga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

metabcombiner's Issues

difference in labelRows() output between v 1.2.2 and 1.5.2+

Hi,

I've been doing quite a bit of modeling with metabCombiner and noticed that with my recent biocmanager:: update, my old code stopped working.

Before, labelRows(method = "mzrt") worked on my combinedTable() dataframe

Now, i get Error in labelRows(ct_tp, method = "mzrt", delta = c(de1, de2, de3, de4), :
must call calcScores before using this function

The former behavior seems more intuitive to me since I am not using method="scores".

I'm not sure if I should treat my old modeling results as bad or try to replicate them with certain calcScores() parameter values though I don't know what these would be.

Do you have any insight or direction for me on this question?

how to make the example data work

Hi,
I found your package recently and think it looks interesting for our research, while when I tried to run you script, I met a couple of issues. Firstly , while is the file "path_to_data_file.txt"? Unfortunately I did not find it even I installed you packages. Secondly, do you have a full scripts than can fully work for your example data, I found there are many symbols such as "..." in your script that not recognized by R and I could not run these codes for the example data. I would like to see what is the output of your package and whether we can apply to our data and how should we prepare our data format.

Thank you very much in advance.
Best
Tingting

calcScores group number bug

When performing a re-analysis of combined data, group numbers from 1 to nGroups will cause an error due to missing groups. Solution: use unique().

slow table collapsing in write2file() function

Current method for table collapsing in write2file function too slow
lines = apply(cTable, 1, function(row) base::paste(row, collapse = sep))

Faster methods necessary. One possibility:
strsplit(readr::format_delim(cTable, delim = sep), split = "\n")[[1]])

Also, addition of an index column may be useful and necessary.

later dplyr version needed

dplyr::all_of called in metabData(), but this functionality is only available in later versions of dplyr (starting from version 1.0). Update DESCRIPTION to set minimum dplyr to 1.0.

detect regular expressions bug

Program may not recognize literal bracket characters ("(", "[", "{") in column names during fields detection. Solution is to substitute a period character for any of the above characters.

use match() instead of grep() in formCombinedTable()

In the file form.R, the function formCombinedTable() is causing an error for us because it uses grep() to get the indices of matching IDs. The grep is failing because the string for regex pattern gets too big since we have thousands of IDs.

A fix would be to use match() instead, which also avoid another potential source of error -see below. Here are my suggested changes, which seem to work, in the file form.R:

formCombinedTable <- function(object, xset, yset, xreps, yreps){
    xComb <- dplyr::slice(xset, rep(seq(1,n()), times = xreps))
    yComb <- yset[yreps,]
    samps_extras <- unlist(lapply(datasets(object), function(d)
        c(getSamples(object, d), getExtra(object,d))))
    # samps_extras <- rmbrackets(paste(samps_extras, collapse = "|"))            # removed
    # x_sa_ext <- setdiff(grep(samps_extras, rmbrackets(names(xComb))),seq(1,5)) # removed
    x_sa_ext <- na.omit(match(samps_extras, names(xComb)))                       # added
    x_sa_ext <- x_sa_ext[x_sa_ext > 5]                                           # added
    # y_sa_ext <- setdiff(grep(samps_extras, rmbrackets(names(yComb))),seq(1,5)) # removed
    y_sa_ext <- na.omit(match(samps_extras, names(yComb)))                       # added
    y_sa_ext <- y_sa_ext[y_sa_ext > 5]                                           # added
    cTable <- data.frame(idx = xComb[["id"]], idy = yComb[["id"]],
                    mzx = round(xComb[["mz"]],5), mzy = round(yComb[["mz"]],5),
                    rtx = round(xComb[["rt"]],4), rty = round(yComb[["rt"]],4),
                    rtProj = numeric(nrow(xComb)),
                    Qx = round(xComb[["Q"]],4), Qy = round(yComb[["Q"]],4),
                    group = xComb[["group"]],
                    score = rep(1, nrow(xComb)),
                    rankX = as.integer(1), rankY = as.integer(1),
                    adductx = xComb[["adduct"]], adducty = yComb[["adduct"]],
                    xComb[,sort(x_sa_ext)], yComb[,sort(y_sa_ext)],
                    stringsAsFactors = FALSE, check.names = FALSE)
    consec <- lapply(rle(cTable[["group"]])[["lengths"]], function(l) seq(1,l))
    consec <- unlist(consec)
    rowID <- sprintf("%s.%s", cTable[["group"]], consec)
    cTable <- cbind.data.frame(rowID = rowID, cTable)

    return(cTable)
}

The grep() approach will produce unintended matches in cases of varying length IDs where some IDs are substrings of others, for example, if the search pattern has the ID 123 then it will match 1230 1123 and 1231 etc.

Caesar

Group 152 Isomeric pair

A group in the Jen dataset has a first isomer labeled, but the second is labeled "remove"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.