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

spatCellCellcom does not allow verbose='none' if do_parallel=TRUE #949

Closed
rbutleriii opened this issue May 3, 2024 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@rbutleriii
Copy link

I noticed in my output that spatCellCellcom still delivers the "simulation #" output even if you set verbose='none'. Looking at the function, it seems a quick fix:

  ## parallel option ##
  if(do_parallel == TRUE) {

    savelist = lapply_flex(X = 1:nrow(combn_DT), future.seed=TRUE, cores = cores, fun = function(row) {

      cell_type_1 = combn_DT[row][['V1']]
      cell_type_2 = combn_DT[row][['V2']]

      specific_scores = specificCellCellcommunicationScores(gobject = gobject,
                                                            feat_type = feat_type,
                                                            spat_unit = spat_unit,
                                                            cluster_column = cluster_column,
                                                            random_iter = random_iter,
                                                            cell_type_1 = cell_type_1,
                                                            cell_type_2 = cell_type_2,
                                                            feat_set_1 = feat_set_1,
                                                            feat_set_2 = feat_set_2,
                                                            spatial_network_name = spatial_network_name,
                                                            log2FC_addendum = log2FC_addendum,
                                                            min_observations = min_observations,
                                                            detailed = detailed,
                                                            adjust_method = adjust_method,
                                                            adjust_target = adjust_target,
                                                            set_seed = set_seed,
                                                            seed_number = seed_number) # no verbose passed

    })


  } else {

    ## for loop over all combinations ##
    savelist = list()
    countdown = nrow(combn_DT)

    for(row in 1:nrow(combn_DT)) {

      cell_type_1 = combn_DT[row][['V1']]
      cell_type_2 = combn_DT[row][['V2']]

      # <----------------------------------------------------- this all only exists in else
      if(verbose == 'a little' | verbose == 'a lot') cat('\n\n PROCESS nr ', countdown,': ', cell_type_1, ' and ', cell_type_2, '\n\n')

      if(verbose %in% c('a little', 'none')) { 
        specific_verbose = F
      } else {
        specific_verbose = T
      }
      # <----------------------------------------------------

      specific_scores = specificCellCellcommunicationScores(gobject = gobject,
                                                            feat_type = feat_type,
                                                            spat_unit = spat_unit,
                                                            cluster_column = cluster_column,
                                                            random_iter = random_iter,
                                                            cell_type_1 = cell_type_1,
                                                            cell_type_2 = cell_type_2,
                                                            feat_set_1 = feat_set_1,
                                                            feat_set_2 = feat_set_2,
                                                            spatial_network_name = spatial_network_name,
                                                            log2FC_addendum = log2FC_addendum,
                                                            min_observations = min_observations,
                                                            detailed = detailed,
                                                            adjust_method = adjust_method,
                                                            adjust_target = adjust_target,
                                                            set_seed = set_seed,
                                                            seed_number = seed_number,
                                                            verbose = specific_verbose)
      savelist[[row]] = specific_scores
      countdown = countdown - 1
    }

  }
@rbutleriii rbutleriii added the bug Something isn't working label May 3, 2024
@jiajic jiajic self-assigned this May 23, 2024
@jiajic jiajic mentioned this issue Jul 31, 2024
@jiajic jiajic closed this as completed in 64586f9 Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants