Skip to content

Instantly share code, notes, and snippets.

@vsoch
Last active March 3, 2018 14:27
Show Gist options
  • Save vsoch/7103c9b51b67904d80291ac6c04764a0 to your computer and use it in GitHub Desktop.
Save vsoch/7103c9b51b67904d80291ac6c04764a0 to your computer and use it in GitHub Desktop.
The deep variant (complete) manifest (deep-variant.manifest) and the Singularity recipe generated from it to build a deepvariant Singularity image
[
{
"Id": "sha256:c0acf3d54dce5eabf6ae422593a3d266e1d5d61129d53f32ec943d133b395a6c",
"RepoTags": [
"gcr.io/deepvariant-docker/deepvariant:0.5.0"
],
"RepoDigests": [
"gcr.io/deepvariant-docker/deepvariant@sha256:c95f3eba028ad8e3fe3fb4fd6fcc6ba0cd27ff14139c79bba2a9d4acc5a2591c"
],
"Parent": "",
"Comment": "",
"Created": "2018-01-29T20:37:52.869007338Z",
"Container": "c0ddcb49aa663b7042497275d25c39221db72cffea017c21d45942feadaf052e",
"ContainerConfig": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DV_GPU_BUILD=0"
],
"Cmd": [
"/bin/sh",
"-c",
"BASH_HEADER='#!/bin/bash' && printf \"%s\\n%s\\n\" \"${BASH_HEADER}\" 'python /opt/deepvariant/bin/make_examples.zip \"$@\"' > /opt/deepvariant/bin/make_examples && printf \"%s\\n%s\\n\" \"${BASH_HEADER}\" 'python /opt/deepvariant/bin/call_variants.zip \"$@\"' > /opt/deepvariant/bin/call_variants && printf \"%s\\n%s\\n\" \"${BASH_HEADER}\" 'python /opt/deepvariant/bin/postprocess_variants.zip \"$@\"' > /opt/deepvariant/bin/postprocess_variants && printf \"%s\\n%s\\n\" \"${BASH_HEADER}\" 'python /opt/deepvariant/bin/model_train.zip \"$@\"' > /opt/deepvariant/bin/model_train && printf \"%s\\n%s\\n\" \"${BASH_HEADER}\" 'python /opt/deepvariant/bin/model_eval.zip \"$@\"' > /opt/deepvariant/bin/model_eval && chmod +x /opt/deepvariant/bin/make_examples /opt/deepvariant/bin/call_variants /opt/deepvariant/bin/postprocess_variants /opt/deepvariant/bin/model_train /opt/deepvariant/bin/model_eval"
],
"ArgsEscaped": true,
"Image": "sha256:9d30e8ce67321c61be656426c99dc22c6a8be8f1f03a3adcf8e0dd7d08281ed3",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": null
},
"DockerVersion": "17.06.1-ce",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DV_GPU_BUILD=0"
],
"Cmd": [
"/bin/bash"
],
"ArgsEscaped": true,
"Image": "sha256:9d30e8ce67321c61be656426c99dc22c6a8be8f1f03a3adcf8e0dd7d08281ed3",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 1293568614,
"VirtualSize": 1293568614,
"GraphDriver": {
"Data": null,
"Name": "aufs"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:ff986b10a018b48074e6d3a68b39aad8ccc002cdad912d4148c0f92b3729323e",
"sha256:9c7183e0ea88b265d83708dfe5b9189c4e12f9a1d8c3e5bce7f286417653f9b7",
"sha256:c98ef191df4b42c3fd5155d23385e75ee59707c6a448dfc6c8e4e9c005a3df11",
"sha256:92914665e7f61f8f19b56bf7983a2b3758cb617bef498b37adb80899e8b86e32",
"sha256:6f4ce6b888495c7c9bd4a0ac124b039d986a3b18250fa873d11d13b42f6a79f4",
"sha256:d981835cfeee9f8e1b8e68fde5e29ca342e554f41065429ff993c77c99262121",
"sha256:959f030108b71cedde109ac857d1bb4d760c1e18caa3cdbe89c714e968e759bf",
"sha256:9edfd6bd057d9c5da040a314efd9a7c257ef8158629c5990ea74fc3b745ac051",
"sha256:051edfa0dcb187fa742d00482e05f0c7e32e1b6665fa492a031054abb88e655e",
"sha256:51c8d662a1b2d33f15b969bd7bdd70e5a12130ca7a7793d63c944ed31dd5e169",
"sha256:d3bc210757dacfbe3b2bf90a1938d68df319841d9eef59fa44da3bb64f1bbb26"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
Bootstrap: localimage
From: /home/vanessa/.singularity/shub/deepvariant-docker-deepvariant:0.5.0.simg
# sregistry get gcr.io/deepvariant-docker/deepvariant:0.5.0
# sudo singularity build deepvariant Singularity
%environment
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DV_GPU_BUILD=0
export PATH DV_GPU_BUILD
%apprun download_testdata
mkdir input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/NA12878_S1.chr20.10_10p1mb.bam -P input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/NA12878_S1.chr20.10_10p1mb.bam.bai -P input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/test_nist.b37_chr20_100kbp_at_10mb.bed -P input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/test_nist.b37_chr20_100kbp_at_10mb.vcf.gz -P input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/test_nist.b37_chr20_100kbp_at_10mb.vcf.gz.tbi -P input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/ucsc.hg19.chr20.unittest.fasta -P input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/ucsc.hg19.chr20.unittest.fasta.fai -P input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/ucsc.hg19.chr20.unittest.fasta.gz -P input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/ucsc.hg19.chr20.unittest.fasta.gz.fai -P input
wget https://storage.googleapis.com/deepvariant/quickstart-testdata/ucsc.hg19.chr20.unittest.fasta.gz.gzi -P input
%apprun download_models
mkdir models
wget https://storage.googleapis.com/deepvariant/models/DeepVariant/0.5.0/DeepVariant-inception_v3-0.5.0%2Bcl-182548131.data-wgs_standard/model.ckpt.data-00000-of-00001 -P models
wget https://storage.googleapis.com/deepvariant/models/DeepVariant/0.5.0/DeepVariant-inception_v3-0.5.0%2Bcl-182548131.data-wgs_standard/model.ckpt.index -P models
wget https://storage.googleapis.com/deepvariant/models/DeepVariant/0.5.0/DeepVariant-inception_v3-0.5.0%2Bcl-182548131.data-wgs_standard/model.ckpt.meta -P models
%apprun make_examples
exec /opt/deepvariant/bin/make_examples \
--mode calling \
--ref /dv2/input/ucsc.hg19.chr20.unittest.fasta.gz \
--reads /dv2/input/NA12878_S1.chr20.10_10p1mb.bam \
--examples output.examples.tfrecord \
--regions "chr20:10,000,000-10,010,000"
%apprun call_variants
exec /opt/deepvariant/bin/call_variants \
--outfile call_variants_output.tfrecord \
--examples output.examples.tfrecord \
--checkpoint /dv2/models/model.ckpt
%apprun postprocess_variants
exec /opt/deepvariant/bin/postprocess_variants \
--ref /dv2/input/ucsc.hg19.chr20.unittest.fasta.gz \
--infile call_variants_output.tfrecord \
--outfile output.vcf
%runscript
if [ $# -eq 0 ]; then
echo '''Example Usage:
# download data to input and models
singularity run --app download_testdata deepvariant
singularity run --app download_models deepvariant
# make the examples, mapping inputs
singularity run --bind input:/dv2/input/ --app make_examples deepvariant
# call variants, mapping models
singularity run --bind models:/dv2/models/ --app call_variants deepvariant
# postprocess variants
singularity run --bind input:/dv2/input/ --app postprocess_variants deepvariant
# https://github.com/google/deepvariant/blob/master/docs/deepvariant-docker.md
'''
else
exec "$@"
fi
%post
apt-get install -y wget
# https://github.com/google/deepvariant/blob/r0.5/deepvariant/docker/Dockerfile
BASH_HEADER='#!/bin/bash' && \
printf "%s\n%s\n" \
"${BASH_HEADER}" \
'python /opt/deepvariant/bin/make_examples.zip "$@"' > \
/opt/deepvariant/bin/make_examples && \
printf "%s\n%s\n" \
"${BASH_HEADER}" \
'python /opt/deepvariant/bin/call_variants.zip "$@"' > \
/opt/deepvariant/bin/call_variants && \
printf "%s\n%s\n" \
"${BASH_HEADER}" \
'python /opt/deepvariant/bin/postprocess_variants.zip "$@"' > \
/opt/deepvariant/bin/postprocess_variants && \
printf "%s\n%s\n" \
"${BASH_HEADER}" \
'python /opt/deepvariant/bin/model_train.zip "$@"' > \
/opt/deepvariant/bin/model_train && \
printf "%s\n%s\n" \
"${BASH_HEADER}" \
'python /opt/deepvariant/bin/model_eval.zip "$@"' > \
/opt/deepvariant/bin/model_eval && \
chmod +x /opt/deepvariant/bin/make_examples \
/opt/deepvariant/bin/call_variants \
/opt/deepvariant/bin/postprocess_variants \
/opt/deepvariant/bin/model_train \
/opt/deepvariant/bin/model_eval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment