| 1 |
#!/bin/bash |
| 2 |
# Create a data volume from the reference genome image and run star index from |
| 3 |
# starbase image. |
| 4 |
# |
| 5 |
# Note: If using Docker, don't forget to increase the memory allocation to |
| 6 |
# more than 16 GB for this command. |
| 7 |
# |
| 8 |
# Note: I find it most convenient to save the final image to a tar file that |
| 9 |
# I can then copy to the HPC environment, rather than having to build the |
| 10 |
# index twice. It's also nice to have a backup in case Docker or your computer |
| 11 |
# crashes. |
| 12 |
|
| 13 |
THREADS=$1 |
| 14 |
GENCODE_VERSION=26 |
| 15 |
INDEX_CMD="STAR --runMode genomeGenerate --runThreadN ${THREADS} \ |
| 16 |
--genomeDir /index-build \ |
| 17 |
--genomeFastaFiles /index-build/hg38.fa \ |
| 18 |
--sjdbGTFfile /data/annotations/hg38/gencode.v${GENCODE_VERSION}.annotation.gtf \ |
| 19 |
--sjdbOverhang 75 --limitGenomeGenerateRAM 16000000000" |
| 20 |
|
| 21 |
docker create \ |
| 22 |
-v /data/reference/hg38 \ |
| 23 |
-v /data/annotations/hg38 \ |
| 24 |
--name hg38 jdidion/hg38_reference \ |
| 25 |
&& mkdir -p index \ |
| 26 |
&& docker run --rm \ |
| 27 |
-v $(pwd)/index:/index-build --volumes-from hg38 \ |
| 28 |
jdidion/starbase bash -c \ |
| 29 |
"cp /data/reference/hg38/hg38.fa /index-build && \ |
| 30 |
${INDEX_CMD}" \ |
| 31 |
&& docker build -f Dockerfile -t jdidion/star_hg38index . \ |
| 32 |
&& docker rm -v hg38 \ |
| 33 |
&& rm -Rf index |