Commit 7045c58c authored by Saman Sarraf's avatar Saman Sarraf
Browse files

added no display functionality to suppress the figures

parent 85431f30
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -533,7 +533,7 @@ class CommunityDetection:
            print(comments + " Silhouette Score is : " + str(s_s))
        return s_s

    def modality_optimizer(self, modality_list):
    def modality_optimizer(self, modality_list, display_figures=True):
        self.comment = self.comment
        possible_combinations = comb_mod(modality_list)
        self.data_opt = []
@@ -567,7 +567,7 @@ class CommunityDetection:
            preprocessed_data_opt = pd.concat([preprocessed_data_opt, self.data_struct_norm[mod_label]], axis=1)

        snf_groups_opt_temporary = self.similarity_network_fusion(self.number_cluster, prep_data=self.data_opt,
                                                                  display=True, print_flag=False,
                                                                  display=display_figures, print_flag=False,
                                                                  plot_pref="Optimized_")
        snf_groups_opt = []
        for qq in tuple_helper_:
+68 −29
Original line number Diff line number Diff line
@@ -72,26 +72,29 @@ MINT is designed for scalable and interpretable community detection, with applic
  python main.py --json ../SNF.json
  ```
### Command Line Arguments for MINT

| Short Argument | Long Argument     | Description                                                                                                          |
|----------------|----------------|-------------|
| `-j`  | `--json`         | JSON Configuration from JSON file |
|----------------|-------------------|----------------------------------------------------------------------------------------------------------------------|
| `-j`           | `--json`          | JSON configuration file                                                                                              |
| `-nm`          | `--numbermodal`   | Number of modalities                                                                                                 |
| `-ns`          | `--numbersubj`    | Number of subjects (consistent across modalities)                                                                    |
| `-f`  | `--filetype`     | Type of files (either csv or excel) |
| `-f`           | `--filetype`      | Type of files (`csv` or `excel`)                                                                                     |
| `-cp`          | `--csvpath`       | List of CSV files (one per modality), comma-separated                                                                |
| `-ep` | `--excelpath`    | List of Excel files (one per modality) OR one Excel file with data in multiple sheets |
| `-ep`          | `--excelpath`     | List of Excel files (one per modality) OR one Excel file with multiple sheets                                        |
| `-sn`          | `--sheetname`     | List of sheet names (comma-separated, one sheet per modality)                                                        |
| `-cl`          | `--colnames`      | List of columns to include (optional, defaults to all columns)                                                       |
| `-nr`          | `--norm`          | List of modalities (by index) requiring normalization                                                                |
| `-nt` | `--normtype`     | Normalization method (either minmax or max) |
| `-nt`          | `--normtype`      | Normalization method (`minmax` or `max`)                                                                             |
| `-m`           | `--method`        | Community detection method: `snf` (Similarity Network Fusion) or `gl` (Generalized Louvain)                          |
| `-sf`          | `--snfpath`       | Path to store SNF results (CSV)                                                                                      |
| `-gp`          | `--glpath`        | Path to store GenLouvain results (CSV)                                                                               |
| `-nc`          | `--numbercluster` | Number of clusters for SNF                                                                                           |
| `-v`           | `--verbose`       | Display figures (True/False)                                                                                         |
| `-co`          | `--featcoef`      | Coefficient for top feature selection                                                                                |
| `-cv` | `--crossvaltype` | Cross Validation Method (default = 4)<br> 1 = all subjects<br>2 = centroid<br>3 = centroid replacement<br>4 = k-fold |
| `-cv`          | `--crossvaltype`  | Cross validation method (default = 4).<br>1 = all subjects<br>2 = centroid<br>3 = centroid replacement<br>4 = k-fold |
| `-lf`          | `--listfeat`      | List of user-defined features (overrides feature ranking algorithms)                                                 |
| `-nd`          | `--no-display`    | Suppress figure display while still generating and saving figures                                                    |


NB: The table above helps you understand the features available in MINT; however, you can also use the JSON templates provided with the toolbox and run the analysis using the JSON option, instead of specifying all arguments directly on the command line.

@@ -132,7 +135,8 @@ The following is an example of a JSON configuration file with parameters set. To
    "OUTLIER": false,
    "OUTLIERPARAMS": [3, "median"],
    "QUALITYCONTORL":true,
    "OPTIMIZATION":"all"}
    "OPTIMIZATION":"all",
    "NO_DISPLAY": false}
  ```

### Input Data Format
@@ -155,19 +159,54 @@ Assuming all three steps including SNF/GL, cross validation and optimization are
  <img src="examples/SNF_image.png" width="45%" />
</p>

### Display Control

MINT supports running analyses in **headless mode**, where figures are generated and saved but not displayed on screen.

This is useful when running analyses:

- on remote servers
- on HPC clusters
- in automated pipelines
- during large batch experiments

Figure display can be disabled in two ways.

**Command line**

```bash
python main.py --json config.json --no-display
```

or

```bash
python main.py -j config.json -nd
```

**JSON configuration**

```json
{
  "NO_DISPLAY": true
}
```

When `NO_DISPLAY` is enabled, MINT switches Matplotlib to a non-interactive backend so figures are generated and saved but no GUI windows appear.
## Citation

If you use MINT in your research, please cite:

```bibtex
@article{yourpaper2024,
  author = {Your Name et al.},
  title = {MINT: A Multimodal Community Detection Toolbox},
  journal = {Journal Name},
  year = {2024},
  volume = {X},
  pages = {XX-XX},
  doi = {DOI_LINK}
@article{sarraf2025multilayer,
  title={Multilayer integration of networks toolbox (MINT)},
  author={Sarraf, Saman and Avelar-Pereira, B{\'a}rbara and Hosseini, SM Hadi and Alzheimer’s Disease Neuroimaging Initiative},
  journal={Communications Biology},
  volume={8},
  number={1},
  pages={894},
  year={2025},
  publisher={Nature Publishing Group UK London}
}
```
## Contact
+36 B (4.09 KiB)

File changed.

No diff preview for this file type.

+2 −1
Original line number Diff line number Diff line
@@ -27,7 +27,8 @@ def json_empty(json_name):
                 'NORMROW': False,
                 'OUTLIER': False,
                 'OUTLIERPARAMS': [3, 'median'],
                 'QC': True}
                 'QC': True,
                 'NO_DISPLAY': False}

    json_object = json.dumps(json_file, indent=4)

Loading