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

Error in mixing_proportions[which(rownames(mixing_proportions) %in% SinkNames), : incorrect number of dimensions #50

Open
melissaszy opened this issue Mar 9, 2023 · 12 comments

Comments

@melissaszy
Copy link

melissaszy commented Mar 9, 2023

Hello,

i downloaded the sample dataset and tried the sample code:
library(FEAST)
setwd("C:/Users/feast_trial")
metadata <- Load_metadata(metadata_path = "metadata_example_multi.txt")
otus <- Load_CountMatrix(CountMatrix_path = "otu_example_multi.txt")
FEAST_output <- FEAST(C = otus, metadata = metadata, different_sources_flag = 1, dir_path = "C:/Users/feast_trial", outfile="demo")
PlotSourceContribution(SinkNames = rownames(FEAST_output)[c(5:8)], SourceNames = colnames(FEAST_output), dir_path = "C:/Users/feast_trial", mixing_proportions = FEAST_output, Plot_title = "Test_",Same_sources_flag = 0, N = 4)

my first issue is when i ran the code above to generate FEAST_output.
the tutorial states that: "FEAST will then save the file demo_FEAST.txt - A file containing an S1 by S2 matrix P, where S1 is the number sinks and S2 is the number of sources (including an unknown source). Each row in matrix P sums to 1."
in my directory, i only have "demo_source_contributions_matrix.txt" file generated.

my second issue is with PlotSourceContribution

i got this error message:
"Error in mixing_proportions[which(rownames(mixing_proportions) %in% SinkNames), :
incorrect number of dimensions"

i am using:
R version 4.2.2
FEAST version 0.1.0

May I ask how what is wrong and how i can fix these issues?

Thank you for your time!

@junzhao23y
Copy link

hi! I'm having the same problem as you.
I wonder if you have solved it now?
I'll check and check again in the next few days

@Olivia-hhg
Copy link

Olivia-hhg commented Jul 9, 2023 via email

@Olivia-hhg
Copy link

Olivia-hhg commented Jul 10, 2023 via email

@Olivia-hhg
Copy link

Olivia-hhg commented Jul 10, 2023 via email

@junzhao23y
Copy link

junzhao23y commented Jul 17, 2023 via email

@Panda-smile
Copy link

同学,我也遇到相同问题,你方便给指导下吗?

@Olivia-hhg
Copy link

Olivia-hhg commented Dec 28, 2023 via email

@Panda-smile
Copy link

Panda-smile commented Dec 29, 2023 via email

@Olivia-hhg
Copy link

Olivia-hhg commented Dec 29, 2023 via email

@Panda-smile
Copy link

Panda-smile commented Dec 29, 2023 via email

@NeginValizadegan
Copy link

NeginValizadegan commented May 29, 2024

It seems that the demo input files were fixed but the issues persists. Still there is only one output (demo_source_contributions_matrix.txt) and the plot cannot be created because The FEAST_output is a list so doesn't have row and col names. For plot, changing it from rownames(FEAST_output) and colnames(FEAST_output) to rownames(FEAST_output$data_prop) and colnames(FEAST_output$data_prop) will create a plot. Whether this is the plot it was supposed to create, not sure. But even with demo data, we don't get the main output which is proportions of sink in sources.

@abossers-uu
Copy link

abossers-uu commented Jun 11, 2024

You can circumvent the plotting problem by LOADING the FEAST output matrix and use that as input for the plot.
See example below:

FEAST_output <- FEAST(C = otus, metadata = metadata, different_sources_flag = 1, dir_path = "./Data_files_out",outfile="demo")
K = 2 #number of sinks to plot
FEAST_output.loaded <- read.table("./Data_files_out/demo_source_contributions_matrix.txt",row.names=1 )
PlotSourceContribution(SinkNames = rownames(FEAST_output.loaded)[c(1:K)],
                       SourceNames = colnames(FEAST_output.loaded), dir_path = "./Data_files_out",
                       mixing_proportions = FEAST_output.loaded, Plot_title = "Test_",Same_sources_flag = 0, N = 2)

To create a bit of sensible plot you can use a boxplot:

out2 <- FEAST_output.loaded %>%
  rownames_to_column("Sink") %>%
  pivot_longer( -Sink, names_to="Source", values_to="Fraction", values_drop_na=TRUE ) %>%
  mutate( "Source" = str_replace_all( Source, "ERR\\d+_", "" ) ) %>%
  mutate( "Sink" = str_replace_all( Sink, "_Env_\\d+$", "" ) ) #%>%

ggplot( out2, aes(Source, Fraction, fill=Source) ) + 
  geom_boxplot( coef=NULL, outlier.colour = NA ) + 
  geom_jitter( width=0.1 ) +
  coord_flip()

Which gives me:
image

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

6 participants