{"id":26786819,"url":"https://github.com/marrlab/scifai","last_synced_at":"2026-03-13T21:36:23.011Z","repository":{"id":112117160,"uuid":"525298240","full_name":"marrlab/scifAI","owner":"marrlab","description":"scifAI: An explainable AI python framework for the analysis of multi-channel imaging data","archived":false,"fork":false,"pushed_at":"2023-10-11T06:06:10.000Z","size":5343,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-03T00:23:28.866Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marrlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-16T08:45:48.000Z","updated_at":"2025-02-22T15:46:03.000Z","dependencies_parsed_at":"2025-04-19T19:33:24.591Z","dependency_job_id":"8b0bbbe7-4868-4803-9d33-5500281c1569","html_url":"https://github.com/marrlab/scifAI","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/marrlab/scifAI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2FscifAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2FscifAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2FscifAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2FscifAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marrlab","download_url":"https://codeload.github.com/marrlab/scifAI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2FscifAI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30476424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T20:45:58.186Z","status":"ssl_error","status_checked_at":"2026-03-13T20:45:20.133Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-29T12:16:59.331Z","updated_at":"2026-03-13T21:36:22.994Z","avatar_url":"https://github.com/marrlab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scifAI: An explainable AI python framework for the analysis of multi-channel imaging flow cytometry data\r\n\r\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/898be58197e045a6b35f0407978088c8)](https://www.codacy.com/gh/marrlab/scifAI/dashboard)\r\n\r\nHere, we present `scifAI`, a machine learning framework for the efficient and explainable analysis of high-throughput imaging data based on a modular open-source implementation. The open-source framework was developed in python, leveraging functionality from state-of-the-art modules, such as scikit-learn, SciPy, NumPy and pandas, allowing for smooth integration and extension of existing analysis pipelines. Universally applicable for single-cell imaging projects, the framework provides functionality for import and preprocessing of input data, several feature engineering pipelines including the implementation of a set of biologically motivated features and autoencoder-generated features, as well as methodology for efficient and meaningful feature selection. Moreover, the framework implements several machine learning and deep learning models for training supervised image classification models, e.g. for the prediction of cell configurations such as the immunological synapse. Following the principle of multi-instance learning, the framework also implements functionality to regress a set of selected images, against a downstream continuous readout such as cytokine production. Extensive documentation, as well as example code in the form of Jupyter notebooks is provided.\r\n\r\nNote: this repository only includes the main python package and multiple jupyter notebooks on publicly available datasets. For following on how this package is applied in the main publication, please refer to https://github.com/marrlab/scifAI-notebooks \r\n\r\n## Data structure\r\n\r\nFor using the package, you need to download the data from IDEAS software and save each image (all the channels) as an `.h5` file. The `.h5` file should include at least these keys: `image`, `mask`. In case there is label available, also the `label` should be provided as `str`.\r\n\r\nIn addition, each file should be saved with the object number as the last part in the name. For example, for a random image with object number of 1000 this is the correct name: `random_file_1000.h5`. This is important as you can use the object numbers to come back to files and use the IDEAS software as well.\r\n\r\nApart from each file, we assume that the data comes from different experiments, donors and conditions. For example, in case we have N experiments, M donors and K conditions, the data path folder should look like this:\r\n\r\n```bash\r\ndata_path/Experiment_1/Donor_1/condition_1/*.h5\r\ndata_path/Experiment_1/Donor_1/condition_2/*.h5\r\n.\r\n.\r\n.\r\ndata_path/Experiment_1/Donor_2/condition_1/*.h5\r\ndata_path/Experiment_1/Donor_2/condition_2/*.h5\r\n.\r\n.\r\n.\r\ndata_path/Experiment_N/Donor_M/condition_K/*.h5\r\n```\r\n\r\n## How to install the package\r\n\r\nFor installing the package, you can simply clone the repository and run the following command:\r\n\r\n```bash\r\npip -q install \u003cPATH TO THE FOLDER\u003e\r\n```\r\n\r\nThe installation time is less than a minute if all the requirements exist.\r\n\r\n## How to use the package\r\n\r\nFor the feature extraction, you first need to calcalate the `metadata` dataframe with providing the correct data path. \r\n\r\n```python\r\nimport scifAI\r\n\r\ndata_path = \u003cPATH TO THE DATA FOLDER\u003e\r\nmetadata = scifAI.metadata_generator(data_path)\r\n```\r\n\r\nAfter that, you need to defined the feature union from `sklearn` based on the desired features. For example:\r\n\r\n```python\r\nfrom sklearn.pipeline import  FeatureUnion\r\nfrom scifAI.ml import features\r\n\r\nfeature_union = FeatureUnion([\r\n                                (\"MaskBasedFeatures\", features.MaskBasedFeatures()), \r\n                                (\"GLCMFeatures\", features.GLCMFeatures()),  \r\n                                (\"GradientRMS\", features.GradientRMS()),  \r\n                                (\"BackgroundMean\", features.BackgroundMean()), \r\n                                (\"PercentileFeatures\", features.PercentileFeatures()), \r\n                                (\"CellShape\", features.CellShape()),  \r\n                                (\"Collocalization\", features.Collocalization()),    \r\n                                (\"IntersectionProperties\", features.IntersectionProperties()),\r\n                                (\"CenterOfCellsDistances\", features.CenterOfCellsDistances())\r\n]\r\n)\r\n```\r\n\r\nFinally you can pass the feature union to the `FeatureExtractor` as a `sklearn` pipeline:\r\n\r\n```python\r\nfrom sklearn.pipeline import Pipeline\r\nfrom scifAI.ml import FeatureExtractor \r\n\r\npipeline = Pipeline([(\"features\", feature_union)])\r\n\r\nfeature_extractor = FeatureExtractor(pipeline)\r\nlist_of_features = feature_extractor.extract_features(metadata)\r\n```\r\nThe output of `extract_features` would be a list, where each element is a dictionary of features for every row in the `metadata`. Finally, you can transoform the `list_of_features` to a DataFrame by simply running:\r\n\r\n```python\r\ndf_features = pd.DataFrame(list_of_features)\r\n```\r\n\r\nwhere every row in the `df_features` contains the corresponding features from the same row in `metadata`. \r\n\r\nConsidering that there are many features, we suggest to reduce the features with no variance. In addition, imputing with `0.` is the best option as it follows the biological assumptions for the feature extraction process.\r\n\r\n```python\r\ndf_features = df_features.fillna(0.)\r\ndf_features = df_features.loc[:, df_features.std() \u003e 0.]\r\n```\r\n\r\nFor different examples, you can follow our examples in the [docs](docs) folder.\r\n\r\n## How to cite this work\r\n\r\ncoming soon\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarrlab%2Fscifai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarrlab%2Fscifai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarrlab%2Fscifai/lists"}