Skip to content

Commit

Permalink
update default locations for igv.jar, regions.bed, output dir
Browse files Browse the repository at this point in the history
  • Loading branch information
stevekm committed Nov 11, 2020
1 parent 8372ef5 commit f446d17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ docker-build:
docker build -t "stevekm/igv-snapshot-automator" .

# run the script on the test data inside the docker container
# uses default paths for regions.bed and igv.jar
docker-test:
docker run --rm -ti -v $PWD:/data/ "stevekm/igv-snapshot-automator" bash -c 'make_IGV_snapshots.py /IGV-snapshot-automator/test_data/test_alignments.bam -o /data/snapshots -r /IGV-snapshot-automator/regions.bed -bin /IGV-snapshot-automator/igv.jar'
docker run --rm -ti -v $$PWD:/host/ "stevekm/igv-snapshot-automator" bash -c 'make_IGV_snapshots.py /IGV-snapshot-automator/test_data/test_alignments.bam -o /host/snapshots'


# build the Singularity container using Docker
Expand All @@ -41,6 +42,7 @@ singularity-shell:
/host/make_IGV_snapshots.sif

# run the script on the test data inside the Singularity container using Docker
# uses default paths for regions.bed and igv.jar
singularity-test:
docker run \
--privileged \
Expand All @@ -50,4 +52,4 @@ singularity-test:
run \
-B /host:/host \
/host/make_IGV_snapshots.sif \
bash -c 'make_IGV_snapshots.py /IGV-snapshot-automator/test_data/test_alignments.bam -o /host/snapshots -r /IGV-snapshot-automator/regions.bed -bin /IGV-snapshot-automator/igv.jar'
bash -c 'make_IGV_snapshots.py /IGV-snapshot-automator/test_data/test_alignments.bam -o /host/snapshots'
12 changes: 8 additions & 4 deletions make_IGV_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
import subprocess as sp
import argparse

THIS_DIR = os.path.dirname(os.path.realpath(__file__))
default_igv_jar = os.path.join(THIS_DIR, 'igv.jar')
default_output_dir = os.path.join(THIS_DIR, "IGV_Snapshots")
default_regions_bed = os.path.join(THIS_DIR, 'regions.bed')
# ~~~~ CUSTOM FUNCTIONS ~~~~~~ #
def file_exists(myfile, kill = False):
'''
Expand Down Expand Up @@ -296,16 +300,16 @@ def run():
# ~~~~ GET SCRIPT ARGS ~~~~~~ #
parser = argparse.ArgumentParser(description='IGV snapshot automator')
# required positional args
parser.add_argument("input_files", nargs='+', help="pathes to the files to create snapshots from e.g. .bam, .bigwig, etc.") # , nargs='?'
parser.add_argument("input_files", nargs='+', help="paths to the files to create snapshots from e.g. .bam, .bigwig, etc.") # , nargs='?'

# required flags
parser.add_argument("-r", default = 'regions.bed', type = str, dest = 'region_file', metavar = 'regions', help="BED file with regions to create snapshots over")
parser.add_argument("-r", default = default_regions_bed, type = str, dest = 'region_file', metavar = 'regions', help="BED file with regions to create snapshots over")

# optional flags
parser.add_argument("-g", default = 'hg19', type = str, dest = 'genome', metavar = 'genome', help="Name of the reference genome, Defaults to hg19")
parser.add_argument("-ht", default = '500', type = str, dest = 'image_height', metavar = 'image height', help="Height for the IGV tracks")
parser.add_argument("-o", default = 'IGV_Snapshots', type = str, dest = 'outdir', metavar = 'output directory', help="Output directory for snapshots")
parser.add_argument("-bin", default = "igv.jar", type = str, dest = 'igv_jar_bin', metavar = 'IGV bin path', help="Path to the IGV jar binary to run")
parser.add_argument("-o", default = default_output_dir, type = str, dest = 'outdir', metavar = 'output directory', help="Output directory for snapshots")
parser.add_argument("-bin", default = default_igv_jar, type = str, dest = 'igv_jar_bin', metavar = 'IGV bin path', help="Path to the IGV jar binary to run")
parser.add_argument("-mem", default = "4000", type = str, dest = 'igv_mem', metavar = 'IGV memory (MB)', help="Amount of memory to allocate to IGV, in Megabytes (MB)")
parser.add_argument("-nosnap", default = False, action='store_true', dest = 'no_snap', help="Don't make snapshots, only write batchscript and exit")
parser.add_argument("-suffix", default = None, dest = 'suffix', help="Filename suffix to place before '.png' in the snapshots")
Expand Down

0 comments on commit f446d17

Please sign in to comment.