Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patternMarkers 'all' returning empty lists #102

Open
kwoyshner opened this issue May 2, 2024 · 4 comments · May be fixed by #103
Open

patternMarkers 'all' returning empty lists #102

kwoyshner opened this issue May 2, 2024 · 4 comments · May be fixed by #103
Labels

Comments

@kwoyshner
Copy link

Hi! I am trying to obtain patternMarkers from a cogaps result object using the following code:
pMarks <- patternMarkers(NMF, threshold = "all", lp = NA, axis = 1)

It returns values for the scores and ranks how I would expect, but there are no patternMarkers for every pattern -- which seems weird.
image
image

The 'cut' version does return patternMarkers, but the output is formatted slightly differently than that returned by 'all' (each list isn't named by the pattern name), and there is a warning message I haven't seen before when using this function.
image
image

I am using R 4.3.0 and CoGAPS 3.24.0 (installed 5/2/24).
I have never run into this issue before, but I had just reinstalled CoGAPS.

Looking into the patternMarkers code here (lines 480-490):
image
If I print the first few elements of thresholdTest it looks like a named list, but if I print the gene followed by names(gene) for each, the names are NULL
image

I'm not sure if this is happening for anyone else. Please let me know if you need any other details!

@dimalvovs
Copy link
Contributor

related #78

@dimalvovs
Copy link
Contributor

confirmed warning in threshold = "cut"

test_that("patternMarkers work with threshold = 'cut' yields no warning", {
    #set up
    data(GIST)
    res <- CoGAPS(GIST.data_frame, nIterations=1000,
                  seed=1, messages=FALSE)

    test <- patternMarkers(res, threshold = "cut")
    expect_no_warning(length(test$PatternMarkers), 0)
})

@dimalvovs
Copy link
Contributor

confirmed empty markers with threshold = 'all'

test_that("patternMarkers work with threshold = 'all' for general mode", {
    #set up
    data(GIST)
    res <- CoGAPS(GIST.data_frame, nIterations=1000,
                  seed=1, messages=FALSE)

    test <- patternMarkers(res, threshold = "all")
    marker_lengths <- sapply(test$PatternMarkers, length)
    expect_equal(sum(marker_lengths > 0), length(marker_lengths))
})

@dimalvovs dimalvovs added the bug label May 2, 2024
dimalvovs added a commit that referenced this issue May 2, 2024
@dimalvovs dimalvovs linked a pull request May 2, 2024 that will close this issue
@dimalvovs
Copy link
Contributor

dimalvovs commented May 3, 2024

the problem with warnings generated in case of threshold='cut' comes from the non-matching dimensions of As and Ps during the scaling and sweeping . For the testdata trained on nPatterns=7, the dimensions of A and P that are fed into here

As <- sweep(As, 2, pscale, FUN="*")
are:

[1] 1363    7
[1] 9 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants