• Stars
    star
    105
  • Rank 316,791 (Top 7 %)
  • Language
    Jupyter Notebook
  • License
    Other
  • Created about 5 years ago
  • Updated 10 days 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,604
star
2

cromwell

Scientific workflow engine designed for simplicity & scalability. Trivially transition between one off use cases to massive scale production environments
Scala
953
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
923
star
4

keras-rcnn

Keras package for region-based convolutional neural networks (RCNNs)
Python
548
star
5

infercnv

Inferring CNV from Single-Cell RNA-Seq
R
509
star
6

gtex-pipeline

GTEx & TOPMed data production and analysis pipelines
Python
323
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
243
star
10

Tangram

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

ssGSEA2.0

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

ABC-Enhancer-Gene-Prediction

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

warp

WDL Analysis Research Pipelines
WDL
183
star
14

viral-ngs

Viral genomics analysis pipelines
Python
180
star
15

seqr

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

gatk-sv

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

ichorCNA

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

tensorqtl

Ultrafast GPU-enabled QTL mapper
Python
142
star
19

wot

A software package for analyzing snapshots of developmental processes
Jupyter Notebook
130
star
20

long-read-pipelines

Long read production pipelines
Jupyter Notebook
116
star
21

xtermcolor

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

Drop-seq

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

depmap_omics

What you need to process the Quarterly DepMap-Omics releases from Terra
HTML
98
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
87
star
26

gnomad_methods

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

pyro-cov

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

gatk-docs

Documentation archive for GATK tools and workflows
HTML
71
star
29

catch

A package for designing compact and comprehensive capture probe sets.
Python
67
star
30

gnomad-browser

Explore gnomAD datasets on the web
TypeScript
66
star
31

oncotator

Python
64
star
32

gtex-viz

GTEx Visualizations
JavaScript
62
star
33

single_cell_portal_core

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

PhylogicNDT

HTML
57
star
35

docker-terraform

Docker container for running the Terraform application
Shell
56
star
36

cromshell

CLI for interacting with Cromwell servers
Python
53
star
37

2020_scWorkshop

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

viral-pipelines

viral-ngs: complete pipelines
WDL
48
star
39

gnomad_qc

Jupyter Notebook
48
star
40

single_cell_portal

Tutorials, workflows, and convenience scripts for Single Cell Portal
HTML
44
star
41

sam

workbench identity and access management
Scala
41
star
42

gistic2

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

gamgee

A C++14 library for NGS data formats
C++
41
star
44

dsde-deep-learning

DSDE Deep Learning Club
Python
40
star
45

gtex-v8

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

SignatureAnalyzer-GPU

GPU implementation of ARD NMF
Python
37
star
47

wdl-ide

Rich IDE support for Workflow Description Language
Python
36
star
48

Celligner_ms

Code related to the Celligner manuscript
R
36
star
49

cellpainting-gallery

Cell Painting Gallery
35
star
50

cell-health

Predicting Cell Health with Morphological Profiles
HTML
35
star
51

gatk-protected

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

pyqtl

Collection of analysis tools for quantitative trait loci
Python
32
star
53

PANOPLY

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

python-cert_manager

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

StrainGE

strain-level analysis tools
Python
30
star
56

firecloud-orchestration

Scala
29
star
57

gdctools

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

2019_scWorkshop

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

fiss

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

single_cell_analysis

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

deepometry

Image classification for imaging flow cytometry.
Python
25
star
62

firepony

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

adapt

A package for designing activity-informed nucleic acid diagnostics for viruses.
Python
24
star
64

pyfrost

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

str-analysis

Scripts and utilities related to analyzing short tandem repeats (STRs).
Python
23
star
66

rawls

Rawls service for DSDE
Scala
23
star
67

protigy

Proteomics Toolset for Integrative Data Analysis
R
21
star
68

seqr-loading-pipelines

hail-based pipelines for annotating variant callsets and exporting them to elasticsearch
Python
21
star
69

lincs-cell-painting

Processed Cell Painting Data for the LINCS Drug Repurposing Project
Jupyter Notebook
21
star
70

BipolarCell2016

R
21
star
71

cromwell-tools

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

single_cell_classification

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

VariantBam

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

longbow

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

chronos

Modeling of time series data for CRISPR KO experiments
Python
20
star
76

gtex-single-nucleus-reference

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

covid19-testing

COVID-19 Diagnostic Processing Dashboard
HTML
19
star
78

AwesomeGenomics

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

GATK-for-Microbes

WDL
19
star
80

firecloud-ui

FireCloud user interface for web browsers.
Clojure
19
star
81

BARD

BioAssay Research Database
Groovy
19
star
82

flipbook

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

palantir-workflows

Utility workflows for the DSP hydro.gen team (formerly palantir)
WDL
18
star
84

wdltool

Scala
18
star
85

vim-wdl

Vim syntax highlighting for WDL
Vim Script
18
star
86

wordpress-crowd-plugin

Crowd Authentication Plugin for Wordpress
PHP
16
star
87

epi-SHARE-seq-pipeline

Epigenomics Program pipeline to analyze SHARE-seq data.
WDL
14
star
88

mix_seq_ms

Code associated with MIX-seq manuscript
R
14
star
89

widdler

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

SpliceAI-lookup

Website for checking SpliceAI and Pangolin scores:
Python
13
star
91

imaging-platform-pipelines

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

wdl-runner

Easily run WDL workflows on GCP
Python
13
star
93

cms

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

scRNA-Seq

Python
12
star
95

scalable_analytics

Public collaboration of Scalable Single Cell Analytics
Python
12
star
96

sparklespray

Easy batch submission of adhoc jobs onto GCP
HTML
12
star
97

regional_missense_constraint

Code to calculate regional missense constraint
Python
11
star
98

dropviz

Shiny app for visualization, exploration of mouse brain single cell gene expression
R
11
star
99

gnomad_lof

R
11
star
100

hdf5-java-bindings

java bindings for hdf5
Java
11
star