zunderlab / FLOWMAP

Other
23 stars 8 forks source link

Error rising in FLOWMAPfromDF() #11

Closed kalmSveta closed 3 years ago

kalmSveta commented 3 years ago

Hello!

I am trying to apply FLOWMAP to my CyTOF data, in which I have 3 time points.

I am using the following parameters:

mode = "single"
project.name = 'Car1_regressed_individ_shifts'
time.col.label = 'time_series'
condition.col.label = NULL
clustering.var = panel_order_dots
distance.metric = 'manhattan'
k = 5
minimum = 2
maximum = 5
save.folder = '~/Desktop/CompCancer_data/Natalie2/FLOW_MAP_out/'
name.sort = F
clustering = F
seed.X = 1
savePDFs = T
which.palette <- "bluered"
df <-FLOWMAPR::RestructureDF(data, time.col.label = 'time_series', condition.col.label = NULL)$new.df

and then run:

FLOWMAPR::FLOWMAPfromDF(mode = mode,
                        project.name = project.name,
                        df = df,
                        time.col.label = time.col.label,
                        condition.col.label = condition.col.label,
                        clustering.var = clustering.var,
                        distance.metric = distance.metric,
                        k = k,
                        minimum = minimum,
                        maximum = maximum,
                        save.folder = save.folder,
                        name.sort = name.sort,
                        clustering = clustering,
                        seed.X = seed.X,
                        savePDFs = savePDFs, 
                        which.palette = which.palette)

The programme runs for a while and then ends with an error:

Seed set to 1 
Printing summary for FLOWMAPR run from dataframe. 
file.name 2021-03-04_15.11.47_FLOW-MAPR_run_settings_summary.txt 
check FALSE 
[1] "max_5__k_5_2021-03-04_15.11.47_SingleFLOWMAP_run"
output.folder is max_5__k_5_2021-03-04_15.11.47_SingleFLOWMAP_run 
Printing summary for FLOWMAPR run from dataframe. 
file.name 2021-03-04_15.11.47_FLOW-MAPR_run_settings_summary.txt 
Building first FLOWMAP:
Clusters length:2749
 Clusters length:33
Manhattan distance no longer supported. Using euclinean distance.
[1] "final"
Starting next round, offset = 1
Building FLOWMAP from1to2
Clusters length:5185
 Clusters length:33
Manhattan distance no longer supported. Using euclinean distance.
In BaseBuildKNN, offset = 1
In BaseBuildKNN, table.breaks[n + 2] = 5185
[1] "final"
[1] "vert edge rbind"
Error in cbind(knn.indexes[[n]], results$indexes[1:(nrow(results$indexes)/2),  : 
  number of rows of matrices must match (see arg 2)
In addition: Warning messages:
1: In if (density.metric == "radius") { :
  the condition has length > 1 and only the first element will be used
2: In if (density.metric == "kNN") { :
  the condition has length > 1 and only the first element will be used

Could you please help me to solve this issue?

j-wilhelm-utsw commented 3 years ago

I am having the same error while trying to run FLOWMAPfromDF on a timeseries of scRNAseq data. Hopefully this thread can resolve the issue.

smgoggin10 commented 3 years ago

Thanks for posting this issue! I have figured out the cause, and am working on fixing it now. I'll update here when it is fixed, but I just wanted to let you both know that your issues were seen :)

smgoggin10 commented 3 years ago

@j-wilhelm-utsw @kalmSveta
Ok, should be fixed! Let me know if you find it still isn't working for you, or you run into other issues!

j-wilhelm-utsw commented 3 years ago

@smgoggin10

It appears the original error has now been fixed, and the code is proceeding further than before. However, I am now receiving a new error whether I try on my own scRNAseq data or on the "Clover" example dataset. Am I missing an input file or something?

Here are the parameters I set using the example dataframe:

> mode <- "single"
> project.name <- "Striped Single"
> time.col.label <- "Timepoint"
> condition.col.label <- NULL
> clustering.var <- c("marker1","marker2")
> distance.metric <- "manhattan"
> minimum <- 2
> maximum <- 5
> save.folder <- getwd()
> name.sort <- FALSE
> clustering <- FALSE
> seed.X <- 1
> savePDFs <- TRUE
> which.palette <- "bluered"

And Initiate FLOWMAPfromDF, which runs further but returns the following error.

> FLOWMAPR::FLOWMAPfromDF(mode = mode, df = FLOWMAPfromDF.Clover, project.name = project.name,
+                         time.col.label = time.col.label, condition.col.label = condition.col.label,
+                         clustering.var = clustering.var, distance.metric = distance.metric,
+                         minimum = minimum, maximum = maximum,save.folder = save.folder,
+                         name.sort = name.sort, clustering = clustering,seed.X = seed.X, 
+                         savePDFs = savePDFs, which.palette = which.palette)
Seed set to 1 
Mode set to single 
Printing summary for FLOWMAPR run from dataframe. 
file.name 2021-03-08_10.22.49_FLOW-MAPR_run_settings_summary.txt 
check FALSE 
[1] "max_5__k_10_2021-03-08_10.22.49_SingleFLOWMAP_run"
output.folder is max_5__k_10_2021-03-08_10.22.49_SingleFLOWMAP_run 
Printing summary for FLOWMAPR run from dataframe. 
file.name 2021-03-08_10.22.49_FLOW-MAPR_run_settings_summary.txt 
Building first FLOWMAP:
Clusters length:413
 Clusters length:2
Manhattan distance no longer supported. Using euclinean distance.
[1] "final"
Starting next round, offset = 1
Building FLOWMAP from1to2
Clusters length:853
 Clusters length:2
Manhattan distance no longer supported. Using euclinean distance.
In BaseBuildKNN, offset = 1
In BaseBuildKNN, table.breaks[n + 2] = 853
[1] "final"
[1] "vert edge rbind"
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
Starting next round, offset = 414
Building FLOWMAP from2to3
Clusters length:1758
 Clusters length:2
Manhattan distance no longer supported. Using euclinean distance.
In BaseBuildKNN, offset = 414
In BaseBuildKNN, table.breaks[n + 2] = 2171
[1] "final"
[1] "vert edge rbind"
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
Starting next round, offset = 854
Building FLOWMAP from3to4
Clusters length:2615
 Clusters length:2
Manhattan distance no longer supported. Using euclinean distance.
In BaseBuildKNN, offset = 854
In BaseBuildKNN, table.breaks[n + 2] = 3468
[1] "final"
[1] "vert edge rbind"
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
Starting next round, offset = 2172
Building FLOWMAP from4to5
Clusters length:2600
 Clusters length:2
Manhattan distance no longer supported. Using euclinean distance.
In BaseBuildKNN, offset = 2172
In BaseBuildKNN, table.breaks[n + 2] = 4771
[1] "final"
[1] "vert edge rbind"
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
Starting next round, offset = 3469
Building FLOWMAP from5to6
Clusters length:2532
 Clusters length:2
Manhattan distance no longer supported. Using euclinean distance.
In BaseBuildKNN, offset = 3469
In BaseBuildKNN, table.breaks[n + 2] = 6000
[1] "final"
[1] "vert edge rbind"
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
New names:
* NA -> ...1
* NA -> ...2
* NA -> ...3
* NA -> ...4
* NA -> ...5
* ...
Error: Argument 1 must have names.
Run `rlang::last_error()` to see where the error occurred.

If I try to examine where the error occurs, this is what is returned:

> rlang::last_error()
<error/rlang_error>
Argument 1 must have names.
Backtrace:
 1. FLOWMAPR::FLOWMAPfromDF(...)
 2. FLOWMAPR:::BuildFLOWMAPkNN(...)
 3. base::lapply(...)
 4. FLOWMAPR:::FUN(X[[i]], ...)
 5. dplyr::bind_rows(knn.indexes.keep, knn.indexes[[x]][i, keep_ind[[x]][[i]]])
Run `rlang::last_trace()` to see the full context.
> rlang::last_trace()
<error/rlang_error>
Argument 1 must have names.
Backtrace:
    ?
 1. ??FLOWMAPR::FLOWMAPfromDF(...)
 2.   ??FLOWMAPR:::BuildFLOWMAPkNN(...)
 3.     ??base::lapply(...)
 4.       ??FLOWMAPR:::FUN(X[[i]], ...)
 5.         ??dplyr::bind_rows(knn.indexes.keep, knn.indexes[[x]][i, keep_ind[[x]][[i]]])``
smgoggin10 commented 3 years ago

@j-wilhelm-utsw Can you try re-installing now and running again? I think there was a lag for some reason in the recent updates to the codebase being included in package version for installation. The "final fix" changes were pushed and confirmed to work with no errors from source code before I posted above saying it was working. When I installed yesterday however, I was able to replicate this error, which was an error that I had gotten from an intermediate version I had pushed before the "final fix". Now today it seems to be actually installing the correct fixed version. When I just now ran the clover test data as you did above, as well as my real data, it was working with no errors.

j-wilhelm-utsw commented 3 years ago

@smgoggin10 After the re-install, everything is working for me on both clover test data and real data. Thank you for the help!!