• Stars
    star
    122
  • Rank 292,031 (Top 6 %)
  • Language
    Jupyter Notebook
  • License
    Other
  • Created over 5 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ML4H

ML4H is a toolkit for machine learning on clinical data of all kinds including genetics, labs, imaging, clinical notes, and more. The diverse data modalities of biomedicine offer different perspectives on the underlying challenge of understanding human health. For this reason, ML4H is built on a foundation of multimodal multitask modeling, hoping to leverage all available data to help power research and inform clinical care. Our tools help apply clinical research standards to ML models by carefully considering bias and longitudinal outcomes. Our project grew out of efforts at the Broad Institute to make it easy to work with the UK Biobank on the Google Cloud Platform and has since expanded to include proprietary data from academic medical centers. To put cutting-edge AI and ML to use making the world healthier, we're fostering interdisciplinary collaborations across industry and academia. We'd love to work with you too!

ML4H is best described with Five Verbs: Ingest, Tensorize, TensorMap, Model, Evaluate

  • Ingest: collect files onto one system
  • Tensorize: write raw files (XML, DICOM, NIFTI, PNG) into HD5 files
  • TensorMap: tag data (typically from an HD5) with an interpretation and a method for generation
  • ModelFactory: connect TensorMaps with a trainable neural network architecture loss function, and optimization strategy
  • Evaluate: generate plots that enable domain-driven inspection of models and results

Getting Started

Advanced Topics:

  • Tensorizing Data (going from raw data to arrays suitable for modeling, in ml4h/tensorize/README.md, TENSORIZE.md )

Setting up your local environment

Clone the repo to your home directory:

cd ~ \
git clone https://github.com/broadinstitute/ml4h.git

Run the CPU docker (this step does not work on Apple silicon). The first time you do this the docker will need to download which takes awhile:

docker run -v ${HOME}:/home/ -it ghcr.io/broadinstitute/ml4h:tf2.9-latest-cpu

Then once inside the docker try to run the tests (again, not on Apple silicon):

python -m pytest /home/ml4h/tests/test_recipes.py

If the tests pass (ignoring warnings) you're off to the races! Next connect to some tensorized data, or checkout the introductory Jupyter notebooks.

Setting up your cloud environment (optional; currently only GCP is supported)

Make sure you have installed the Google Cloud SDK (gcloud). With Homebrew, you can use

brew cask install google-cloud-sdk

Make sure you have configured your development environment. In particular, you will probably have to complete the steps to prepare the Google Cloud CLI and enable the required Google services.

Setting up a remote VM

To create a VM without a GPU run:

./scripts/vm_launch/launch_instance.sh ${USER}-cpu

With GPU (not recommended unless you need something beefy and expensive)

./scripts/vm_launch/launch_dl_instance.sh ${USER}-gpu

This will take a few moments to run, after which you will have a VM in the cloud. Remember to shut it off from the command line or console when you are not using it!

Now ssh onto your instance (replace with proper machine name and project name, note that you can also use regular old ssh if you have the external IP provided by the script or if you login from the GCP console)

gcloud --project your-gcp-project compute ssh ${USER}-gpu --zone us-central1-a

Next, clone this repo on your instance (you should copy your github key over to the VM, and/or if you have Two-Factor authentication setup you need to generate an SSH key on your VM and add it to your github settings as described here):

git clone [email protected]:broadinstitute/ml4h.git

Because we don't know everyone's username, you need to run one more script to make sure that you are added as a docker user and that you have permission to pull down our docker instances from GCP's gcr.io. Run this while you're logged into your VM:

./ml4h/scripts/vm_launch/run_once.sh

Note that you may see warnings like below, but these are expected:

WARNING: Unable to execute `docker version`: exit status 1
This is expected if `docker` is not installed, or if `dockerd` cannot be reached...
Configuring docker-credential-gcr as a registry-specific credential helper. This is only supported by Docker client versions 1.13+
/home/username/.docker/config.json configured to use this credential helper for GCR registries

You need to log out after that (exit) then ssh back in so everything takes effect.

Finish setting up docker, test out a jupyter notebook

Now let's run a Jupyter notebook. On your VM run:

${HOME}/ml4h/scripts/jupyter.sh

Add a -c if you want a CPU version.

This will start a notebook server on your VM. If you a Docker error like

docker: Error response from daemon: driver failed programming external connectivity on endpoint agitated_joliot (1fa914cb1fe9530f6599092c655b7036c2f9c5b362aa0438711cb2c405f3f354): Bind for 0.0.0.0:8888 failed: port is already allocated.

overwrite the default port (8888) like so

${HOME}/ml4h/scripts/jupyter.sh -p 8889

The command also outputs two command lines in red. Copy the line that looks like this:

gcloud compute ssh ${USER}@${USER}-gpu -- -NnT -L 8889:localhost:8889

Open a terminal on your local machine and paste that command.

If you get a public key error run: gcloud compute config-ssh

Now open a browser on your laptop and go to the URL http://localhost:8888

Set up VScode to connect to the GCP VM (which makes your coding much easier)

step 1: install VSdoe

step 2:config the ssh key gcloud compute config-ssh --project "broad-ml4cvd"

Step 3: install remote-SSH extension in VS Code

Step 4: connect to the VM by pressing F1 and type "Remote-SSH: Connect to Host..." and select the VM you want to connect to (eg dianbo-dl.us-central1-abroad-ml4cvd)

Step 5: open the folder you want to work on in the VM, type in your Broad password, and you are good to go!

Contributing code

Want to contribute code to this project? Please see CONTRIBUTING for developer setup and other details.

Citation

If you use ML4H for research, you can use this citation format:

@misc{ml4h,
	title = {ml4h},
	copyright = {BSD 3-Clause License, 2021},
	url = {https://github.com/broadinstitute/ml4h},
	author = {{Data Sciences Platform at Broad Institute of MIT and Harvard}},
	abstract = {ML4H is a toolkit for machine learning on clinical data of all kinds including genetics, labs, imaging, clinical notes, and more.},
	urldate = {2021-03-31},
	publisher = {Broad Institute},
	month = mar,
	year = {2021},
	note = {original-date: 2019-04-10}
}

Command line interface

The ml4h package is designed to be accessable through the command line using "recipes". To get started, please see RECIPE_EXAMPLES.

DOI

More Repositories

1

gatk

Official code repository for GATK versions 4 and up
Java
1,691
star
2

cromwell

Scientific workflow engine designed for simplicity & scalability. Trivially transition between one off use cases to massive scale production environments
Scala
990
star
3

picard

A set of command line tools (in Java) for manipulating high-throughput sequencing (HTS) data and formats such as SAM/BAM/CRAM and VCF.
Java
965
star
4

infercnv

Inferring CNV from Single-Cell RNA-Seq
R
558
star
5

keras-rcnn

Keras package for region-based convolutional neural networks (RCNNs)
Python
554
star
6

gtex-pipeline

GTEx & TOPMed data production and analysis pipelines
Python
334
star
7

pilon

Pilon is an automated genome assembly improvement and variant detection tool
Scala
306
star
8

keras-resnet

Keras package for deep residual networks
Python
294
star
9

CellBender

CellBender is a software package for eliminating technical artifacts from high-throughput single-cell RNA sequencing (scRNA-seq) data.
Python
293
star
10

Tangram

Spatial alignment of single cell transcriptomic data.
Jupyter Notebook
249
star
11

ssGSEA2.0

Single sample Gene Set Enrichment analysis (ssGSEA) and PTM Enrichment Analysis (PTM-SEA)
R
237
star
12

ABC-Enhancer-Gene-Prediction

Cell type specific enhancer-gene predictions using ABC model (Fulco, Nasser et al, Nature Genetics 2019)
Python
201
star
13

warp

WDL Analysis Research Pipelines
WDL
200
star
14

viral-ngs

Viral genomics analysis pipelines
Python
180
star
15

seqr

web-based analysis tool for rare disease genomics
Python
176
star
16

gatk-sv

A structural variation pipeline for short-read sequencing
Python
170
star
17

tensorqtl

Ultrafast GPU-enabled QTL mapper
Python
159
star
18

ichorCNA

Estimating tumor fraction in cell-free DNA from ultra-low-pass whole genome sequencing.
R
159
star
19

long-read-pipelines

Long read production pipelines
Jupyter Notebook
140
star
20

wot

A software package for analyzing snapshots of developmental processes
Jupyter Notebook
136
star
21

depmap_omics

What you need to process the Quarterly DepMap-Omics releases from Terra
HTML
110
star
22

xtermcolor

Python library for terminal color support (including 256-color support)
Python
104
star
23

Drop-seq

Java tools for analyzing Drop-seq data
Java
100
star
24

mutect

MuTect -- Accurate and sensitive cancer mutation detection
Java
92
star
25

genomics-in-the-cloud

Source code and related materials for the O'Reilly book
Jupyter Notebook
91
star
26

gnomad_methods

Hail helper functions for the gnomAD project and Translational Genomics Group
Python
89
star
27

pyro-cov

Pyro models of SARS-CoV-2 variants
Jupyter Notebook
77
star
28

catch

A package for designing compact and comprehensive capture probe sets.
Python
74
star
29

gatk-docs

Documentation archive for GATK tools and workflows
HTML
71
star
30

oncotator

Python
67
star
31

gnomad-browser

Explore gnomAD datasets on the web
TypeScript
66
star
32

gtex-viz

GTEx Visualizations
JavaScript
63
star
33

single_cell_portal_core

Rails/Docker application for the Broad Institute's single cell RNA-seq data portal
Ruby
62
star
34

PhylogicNDT

HTML
57
star
35

docker-terraform

Docker container for running the Terraform application
Shell
56
star
36

2020_scWorkshop

Code and data repository for the 2020 physalia course on single cell RNA sequencing.
Shell
56
star
37

cromshell

CLI for interacting with Cromwell servers
Python
53
star
38

cellpainting-gallery

Cell Painting Gallery
52
star
39

viral-pipelines

viral-ngs: complete pipelines
WDL
51
star
40

gnomad_qc

Jupyter Notebook
48
star
41

single_cell_portal

Tutorials, workflows, and convenience scripts for Single Cell Portal
HTML
47
star
42

gistic2

Genomic Identification of Significant Targets in Cancer (GISTIC), version 2
MATLAB
44
star
43

sam

workbench identity and access management
Scala
42
star
44

dsde-deep-learning

DSDE Deep Learning Club
Python
40
star
45

gamgee

A C++14 library for NGS data formats
C++
40
star
46

wdl-ide

Rich IDE support for Workflow Description Language
Python
39
star
47

gtex-v8

Notebooks and scripts for reproducing analyses and figures from the V8 GTEx Consortium paper
Jupyter Notebook
39
star
48

pyqtl

Collection of analysis tools for quantitative trait loci
Python
38
star
49

SignatureAnalyzer-GPU

GPU implementation of ARD NMF
Python
37
star
50

poasta

Fast and exact gap-affine partial order alignment
Rust
37
star
51

Celligner_ms

Code related to the Celligner manuscript
R
36
star
52

cell-health

Predicting Cell Health with Morphological Profiles
HTML
35
star
53

PANOPLY

Repository for the Broad Institute Proteogenomic Data Analysis Center (PGDAC) established by the NIH Clinical Proteomics Tumor Analysis Consortium (CPTAC)
R
33
star
54

gatk-protected

Obsolete/Legacy GATK repository -- go to https://github.com/broadinstitute/gatk instead
Java
33
star
55

StrainGE

strain-level analysis tools
Python
33
star
56

firecloud-orchestration

Scala
31
star
57

gdctools

Python and UNIX CLI utilities to simplify interaction with the NIH/NCI Genomics Data Commons
Python
31
star
58

python-cert_manager

Python interface to the Sectigo Certificate Manager REST API
Python
31
star
59

str-analysis

Scripts and utilities related to analyzing short tandem repeats (STRs).
Python
29
star
60

adapt

A package for designing activity-informed nucleic acid diagnostics for viruses.
Python
29
star
61

2019_scWorkshop

Repo for Physalia course Analysis of Single Cell RNA-Seq data
TeX
29
star
62

chronos

Modeling of time series data for CRISPR KO experiments
Python
28
star
63

fiss

FireCloud Service Selector (FISS) -- Python bindings and CLI for FireCloud execution engine
Python
28
star
64

pyfrost

Python bindings for Bifrost with a NetworkX compatible API
Python
27
star
65

single_cell_analysis

Documents used for workshops on single cell analysis
HTML
26
star
66

deepometry

Image classification for imaging flow cytometry.
Python
26
star
67

lincs-cell-painting

Processed Cell Painting Data for the LINCS Drug Repurposing Project
Jupyter Notebook
25
star
68

rawls

Rawls service for DSDE
Scala
25
star
69

delphy

Fast, scalable, accurate and accessible Bayesian phylogenetics
C++
25
star
70

firepony

Efficient base quality score recalibrator for NGS data
Cuda
24
star
71

protigy

Proteomics Toolset for Integrative Data Analysis
R
22
star
72

GATK-for-Microbes

WDL
22
star
73

seqr-loading-pipelines

hail-based pipelines for annotating variant callsets and exporting them to elasticsearch
Python
22
star
74

BipolarCell2016

R
21
star
75

cromwell-tools

A collection of Python clients and accessory scripts for interacting with the Cromwell
Python
21
star
76

covid19-testing

COVID-19 Diagnostic Processing Dashboard
HTML
20
star
77

single_cell_classification

Methods to use SNPs or gene expression to classify single cell RNAseq to reference profiles
R
20
star
78

VariantBam

Filtering and profiling of next-generational sequencing data using region-specific rules
Makefile
20
star
79

longbow

Annotation and segmentation of MAS-seq data
Python
20
star
80

gtex-single-nucleus-reference

Code repository for the snRNA-seq cross-tissue atlas project
Jupyter Notebook
20
star
81

flipbook

A tool that lets you quickly flip through images in a local directory and record notes or answer questions about each one.
Python
19
star
82

AwesomeGenomics

Cancer Data Science's go to place for excellent genomics tools and packages
19
star
83

firecloud-ui

FireCloud user interface for web browsers.
Clojure
19
star
84

BARD

BioAssay Research Database
Groovy
19
star
85

wdltool

Scala
18
star
86

vim-wdl

Vim syntax highlighting for WDL
Vim Script
18
star
87

SpliceAI-lookup

Website for checking SpliceAI and Pangolin scores:
Python
17
star
88

palantir-workflows

Utility workflows for the DSP hydro.gen team (formerly palantir)
WDL
17
star
89

epi-SHARE-seq-pipeline

Epigenomics Program pipeline to analyze SHARE-seq data.
WDL
16
star
90

wordpress-crowd-plugin

Crowd Authentication Plugin for Wordpress
PHP
16
star
91

mix_seq_ms

Code associated with MIX-seq manuscript
R
14
star
92

imaging-platform-pipelines

Cell Painting and other pipelines from the Imaging Platform
13
star
93

wdl-runner

Easily run WDL workflows on GCP
Python
13
star
94

widdler

A command-line tool for executing, managing, and querying WDL workflows on Cromwell servers.
Python
13
star
95

cms

Composite of Multiple Signals: tests for selection in meiotically recombinant populations
Python
13
star
96

regional_missense_constraint

Code to calculate regional missense constraint
Python
12
star
97

scRNA-Seq

Python
12
star
98

scalable_analytics

Public collaboration of Scalable Single Cell Analytics
Python
12
star
99

ml4ht_data_source

Multimodal data loader compatible with pytorch and tensorflow
Python
12
star
100

gene-hints

Discoverability for gene search 🧬 πŸ”
Python
12
star