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

Plot shows only one coldata group on x-axis #42

Open
elcega opened this issue Dec 14, 2020 · 3 comments
Open

Plot shows only one coldata group on x-axis #42

elcega opened this issue Dec 14, 2020 · 3 comments

Comments

@elcega
Copy link

elcega commented Dec 14, 2020

When I run the following code, my x-axis only shows one group instead of the 7 "times" values(stations in my case).

res <- degPatterns(df, metadata = colData(dds), time = "station", minc = 1)
degPlotCluster(res$normalized, "station", lines=FALSE, min_genes = 1)

It runs fine for another column with a different condition of 3 groups (x-axis), however, when trying coldata station column (numbers 1-7) it plots the following.

image

Do you spot anything I might be missing in the code?
df = data.matrix with all selected DEG
coldata = includes a column of station numbers 1-7 for each of the samples

@lpantano
Copy link
Owner

Hi,

hum, normally that happens when colData(dds)['station'] is not a factor. can you check what class(colData(dds)['station']) is giving to you?

@elcega
Copy link
Author

elcega commented Dec 14, 2020

class(colData(dds)['station'])
[1] "DFrame"
attr(,"package")
[1] "S4Vectors"
colData(dds)['station'] = as.factor(colData(dds)['station'])
Error in as.vector(x, mode = "character") : 
  no method for coercing this S4 class to a vector
>

I am running the following code:

res <- degPatterns(df3, metadata = colData(dds), time = "station", minc = 5)
degPlotCluster(res$normalized, "station") 

For which I obtain the following:

Working with 1312 genes.
Working with 1311 genes after filtering: minc > 5
Joining, by = "merge"
Joining, by = "merge"
geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
...

@mbrochut
Copy link

mbrochut commented Jun 1, 2023

I had the same issue and as @lpantano said, the probleme comes from the column used in "time" from the metadata, is not a factor!
If another person find this, you can follow another answer from @lpantano to transform your column into factor: #39 (comment)

Here is the quick solution:
your_metadata$column_used_in_time = as.factor(your_metadata$column_used_in_time)

It should do the trick :)

ps: thank you @lpantano

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

No branches or pull requests

3 participants