RasmussenLab / MOVE

MOVE (Multi-Omics Variational autoEncoder) for integrating multi-omics data and identifying cross modal associations
https://move-dl.readthedocs.io/
MIT License
64 stars 24 forks source link

Shape of original_input and reconstruction do not match #76

Closed t-soehngen closed 1 year ago

t-soehngen commented 1 year ago

Running MOVE with two continuous datasets works, but adding a third results in the error below (created with the maize dataset: Adding the values of the third file to the second file runs without error.

Error executing job with overrides: ['task.batch_size=10', 'task.model.num_hidden=[500]', 'task.training_loop.num_epochs=40', 'experiment=maize__tune_reconstruction']
Traceback (most recent call last):
  File "C:\Users\t159g\.conda\envs\moveEnv\lib\site-packages\move\__main__.py", line 38, in main
    move.tasks.tune_model(config)
  File "C:\Users\t159g\.conda\envs\moveEnv\lib\site-packages\move\tasks\tune_model.py", line 249, in tune_model
    _tune_reconstruction(task_config)
  File "C:\Users\t159g\.conda\envs\moveEnv\lib\site-packages\move\tasks\tune_model.py", line 230, in _tune_reconstruction
    cosine_sim = calculate_cosine_similarity(con[mask], con_recon)
  File "C:\Users\t159g\.conda\envs\moveEnv\lib\site-packages\move\analysis\metrics.py", line 55, in calculate_cosine_similarity
    raise ValueError(
ValueError: Original input (4251, 716) and reconstruction (4251, 713) shapes do not match.

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

I reproduced the error with the Maize dataset by adding a third dataset constructed with R:

### Testing maize (does not work with maize_rnorm.tsv file)
maize_ids <- read.table('MOVE_tutorial/maize/data/maize_ids.txt')
maize_ids$V2 <- rnorm(nrow(maize_ids),10, 2)
maize_ids$V3 <- rpois(nrow(maize_ids),100)

write.table(maize_ids, 'MOVE_tutorial/maize/data/maize_rnorm.tsv', row.names = F, quote = F, sep = '\t')

#Adding similar values to existing file works
maize_microbiome <- read.table('MOVE_tutorial/maize/data/maize_metadata.tsv')
maize_microbiome$V2 <- rnorm(nrow(maize_microbiome),10, 2)
maize_microbiome$V3 <- rpois(nrow(maize_microbiome),100)

write.table(maize_microbiome , 'MOVE_tutorial/maize/data/maize_metadata2.tsv', quote = F, sep = '\t')
ri-heme commented 1 year ago

Thanks! There was a small bug in the tuning reconstruction task that would produce this error and incorrectly reshape the output whenever there was more than two datasets. The new version should fix this (MOVE v1.4.7).