Skip to content

Instantly share code, notes, and snippets.

@dfjenkins3
Last active March 2, 2023 07:09
Show Gist options
  • Select an option

  • Save dfjenkins3/5c6dc1e55e78fa17b931 to your computer and use it in GitHub Desktop.

Select an option

Save dfjenkins3/5c6dc1e55e78fa17b931 to your computer and use it in GitHub Desktop.

Revisions

  1. dfjenkins3 revised this gist Aug 25, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -148,4 +148,6 @@ snapshot bam3.BRCA1.png

    ## Additional Information

    Additional information about IGV batch scripts can be found [here](https://www.broadinstitute.org/igv/batch), and a list of commands that you can use in the batch file are [here](https://www.broadinstitute.org/software/igv/PortCommands).
    Additional information can be found on the [IGV website](https://www.broadinstitute.org/igv/batch)

    If you want to modify the screenshot in a way that is not available using the bedToIgv tool, a list of available commands can be found [here](https://www.broadinstitute.org/software/igv/PortCommands). These commands can be added directly to the IGV batch script.
  2. dfjenkins3 revised this gist Aug 25, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -122,7 +122,7 @@ It is possible to load a saved IGV session, although in the past I have found th

    ## Run Batch Script

    Run the batch script to start saving the screenshots.
    Once you have the window in the desired form, you can run the batch script. Under the "Tools" menu select "Run Batch Script..."

    ![run batch script](https://i.imgur.com/2bdFvPR.png "Run Batch Script")

  3. dfjenkins3 revised this gist Aug 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -143,7 +143,7 @@ snapshot bam2.BRCA1.png
    new
    load /path/to/bam3/bam3.bam
    goto chr17:41194312-41279500
    snapshot bam2.BRCA1.png
    snapshot bam3.BRCA1.png
    ```

    ## Additional Information
  4. dfjenkins3 revised this gist Aug 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -137,7 +137,7 @@ load /path/to/bam1/bam1.bam
    goto chr17:41194312-41279500
    snapshot bam1.BRCA1.png
    new
    load /path/to/bam3/bam2.bam
    load /path/to/bam2/bam2.bam
    goto chr17:41194312-41279500
    snapshot bam2.BRCA1.png
    new
  5. dfjenkins3 revised this gist Aug 21, 2015. 1 changed file with 22 additions and 1 deletion.
    23 changes: 22 additions & 1 deletion IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,8 @@ IGV provides functionality that allows a user to create a script to take screens
    5. [Load IGV Session](#load-igv-session)
    6. [Optional: Save IGV Session](#optional-save-igv-session)
    7. [Run Batch Script](#run-batch-script)
    8. [Additional Information](#additional-information)
    8. [Screenshots Across Multiple BAM Files](#screenshots-across-multiple-bam-files)
    9. [Additional Information](#additional-information)

    ## Requirements

    @@ -125,6 +126,26 @@ Run the batch script to start saving the screenshots.

    ![run batch script](https://i.imgur.com/2bdFvPR.png "Run Batch Script")

    ## Screenshots Across Multiple BAM Files

    It is also possible to take screenshots across several files by loading them sequentially in the batch file, but `bedToIgv` does not support this. In this case the IGV batch script should be created directly. The following example takes a screenshot of the BRCA1 region across three bam files:

    ```
    new
    snapshotDirectory /path/to/screenshot/directory
    load /path/to/bam1/bam1.bam
    goto chr17:41194312-41279500
    snapshot bam1.BRCA1.png
    new
    load /path/to/bam3/bam2.bam
    goto chr17:41194312-41279500
    snapshot bam2.BRCA1.png
    new
    load /path/to/bam3/bam3.bam
    goto chr17:41194312-41279500
    snapshot bam2.BRCA1.png
    ```

    ## Additional Information

    Additional information about IGV batch scripts can be found [here](https://www.broadinstitute.org/igv/batch), and a list of commands that you can use in the batch file are [here](https://www.broadinstitute.org/software/igv/PortCommands).
  6. dfjenkins3 revised this gist Aug 20, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@ IGV provides functionality that allows a user to create a script to take screens
    5. [Load IGV Session](#load-igv-session)
    6. [Optional: Save IGV Session](#optional-save-igv-session)
    7. [Run Batch Script](#run-batch-script)
    8. [Additional Information](#additional-information)

    ## Requirements

  7. dfjenkins3 revised this gist Aug 20, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -123,3 +123,7 @@ It is possible to load a saved IGV session, although in the past I have found th
    Run the batch script to start saving the screenshots.

    ![run batch script](https://i.imgur.com/2bdFvPR.png "Run Batch Script")

    ## Additional Information

    Additional information about IGV batch scripts can be found [here](https://www.broadinstitute.org/igv/batch), and a list of commands that you can use in the batch file are [here](https://www.broadinstitute.org/software/igv/PortCommands).
  8. dfjenkins3 revised this gist Aug 20, 2015. 3 changed files with 21 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -89,9 +89,9 @@ Notes:
    __Example__:

    ```
    [dfj@helium]~/>bedToIgv -path /users/dfj/igv_screenshots/example -slop 100 -i example.bed > example.batch
    [dfj@helium]~/>bedToIgv -path ./examples -slop 100 -i example.bed > example.batch
    [dfj@helium]~/>cat example.batch
    snapshotDirectory /users/dfj/igv_screenshots/example
    snapshotDirectory ./examples
    goto chr1:25158588-25161609
    snapshot chr1_25158688_25161509_slop100.png
    goto chr1:26489713-26490238
    13 changes: 13 additions & 0 deletions example.batch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    snapshotDirectory ./examples
    goto chr1:25158588-25161609
    snapshot chr1_25158688_25161509_slop100.png
    goto chr1:26489713-26490238
    snapshot chr1_26489813_26490138_slop100.png
    goto chr1:27935252-27935613
    snapshot chr1_27935352_27935513_slop100.png
    goto chr1:28247700-28248208
    snapshot chr1_28247800_28248108_slop100.png
    goto chr1:31574966-31577431
    snapshot chr1_31575066_31577331_slop100.png
    goto chr1:35101322-35112076
    snapshot chr1_35101422_35111976_slop100.png
    6 changes: 6 additions & 0 deletions example.bed
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    chr1 25158688 25161509
    chr1 26489813 26490138
    chr1 27935352 27935513
    chr1 28247800 28248108
    chr1 31575066 31577331
    chr1 35101422 35111976
  9. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -70,7 +70,7 @@ Options:
    -clps Collapse the aligned reads prior to taking a snapshot.
    Default is to no collapse.
    -name Use the "name" field (column 4) for each image's filename.
    -name Use the "name" field (column 4) for each images filename.
    Default is to use the "chr:start-pos.ext".
    -slop Number of flanking base pairs on the left & right of the image.
  10. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -83,7 +83,7 @@ Options:
    Notes:
    (1) The resulting script is meant to be run from within IGV.
    (2) Unless you use the -sess option, it is assumed that prior to
    running the script, you've loaded the proper genome and tracks.
    running the script, youve loaded the proper genome and tracks.
    ```

    __Example__:
    @@ -108,12 +108,18 @@ snapshot chr1_35101422_35111976_slop100.png

    ## Load IGV Session

    The IGV batch script is run within IGV. Load the bam, vcf, and BED files that you want to visualize.

    ![example session](https://i.imgur.com/aD7swR1.png "Example Session")

    ## Optional: Save IGV Session

    It is possible to load a saved IGV session, although in the past I have found this to sometimes behave erratically. This is useful if you are interested in creating screenshots from multiple bam files in the same script.

    ![save session](https://i.imgur.com/XD9aDAb.png "Save Session")

    ## Run Batch Script

    Run the batch script to start saving the screenshots.

    ![run batch script](https://i.imgur.com/2bdFvPR.png "Run Batch Script")
  11. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,8 @@ IGV provides functionality that allows a user to create a script to take screens
    3. [Create BED File](#create-bed-file)
    4. [bedToIgv](#bedtoigv)
    5. [Load IGV Session](#load-igv-session)
    6. [Run Batch Script](#run-batch-script)
    6. [Optional: Save IGV Session](#optional-save-igv-session)
    7. [Run Batch Script](#run-batch-script)

    ## Requirements

    @@ -107,10 +108,12 @@ snapshot chr1_35101422_35111976_slop100.png

    ## Load IGV Session

    ## Run Batch Script
    ![example session](https://i.imgur.com/aD7swR1.png "Example Session")

    ![run batch script](https://i.imgur.com/2bdFvPR.png "Run Batch Script")
    ## Optional: Save IGV Session

    ![save session](https://i.imgur.com/XD9aDAb.png "Save Session")

    ![example session](https://i.imgur.com/aD7swR1.png "Example Session")
    ## Run Batch Script

    ![run batch script](https://i.imgur.com/2bdFvPR.png "Run Batch Script")
  12. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,8 @@ chr1 35101422 35111976

    After creating the BED file, the `bedtools igv` (`bedToIgv`) tool can be used to convert the bed file into an IGV batch script. At a minimum, you should supply a BED file to `bedToIgv`, but you may want to specify an output directory (-path), how to sort the screenshot (-sort), or how much padding to add to the records (-slop).

    __Usage__:

    ```
    Tool: bedtools igv (aka bedToIgv)
    Version: v2.21.0
  13. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -41,7 +41,7 @@ chr1 35101422 35111976

    ## bedToIgv

    After creating the BED file, the bedtools igv (bedToIgv) tool can be used to convert the bed file into an IGV batch script. At a minimum, you should supply a BED file to bedToIgv, but you may want to specify an output directory (-path), how to sort the screenshot (-sort), or how much padding to add to the records (-slop).
    After creating the BED file, the `bedtools igv` (`bedToIgv`) tool can be used to convert the bed file into an IGV batch script. At a minimum, you should supply a BED file to `bedToIgv`, but you may want to specify an output directory (-path), how to sort the screenshot (-sort), or how much padding to add to the records (-slop).

    ```
    Tool: bedtools igv (aka bedToIgv)
  14. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 62 additions and 0 deletions.
    62 changes: 62 additions & 0 deletions IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -41,6 +41,68 @@ chr1 35101422 35111976

    ## bedToIgv

    After creating the BED file, the bedtools igv (bedToIgv) tool can be used to convert the bed file into an IGV batch script. At a minimum, you should supply a BED file to bedToIgv, but you may want to specify an output directory (-path), how to sort the screenshot (-sort), or how much padding to add to the records (-slop).

    ```
    Tool: bedtools igv (aka bedToIgv)
    Version: v2.21.0
    Summary: Creates a batch script to create IGV images
    at each interval defined in a BED/GFF/VCF file.
    Usage: bedtools igv [OPTIONS] -i <bed/gff/vcf>
    Options:
    -path The full path to which the IGV snapshots should be written.
    (STRING) Default: ./
    -sess The full path to an existing IGV session file to be
    loaded prior to taking snapshots.
    (STRING) Default is for no session to be loaded.
    -sort The type of BAM sorting you would like to apply to each image.
    Options: base, position, strand, quality, sample, and readGroup
    Default is to apply no sorting at all.
    -clps Collapse the aligned reads prior to taking a snapshot.
    Default is to no collapse.
    -name Use the "name" field (column 4) for each image's filename.
    Default is to use the "chr:start-pos.ext".
    -slop Number of flanking base pairs on the left & right of the image.
    - (INT) Default = 0.
    -img The type of image to be created.
    Options: png, eps, svg
    Default is png.
    Notes:
    (1) The resulting script is meant to be run from within IGV.
    (2) Unless you use the -sess option, it is assumed that prior to
    running the script, you've loaded the proper genome and tracks.
    ```

    __Example__:

    ```
    [dfj@helium]~/>bedToIgv -path /users/dfj/igv_screenshots/example -slop 100 -i example.bed > example.batch
    [dfj@helium]~/>cat example.batch
    snapshotDirectory /users/dfj/igv_screenshots/example
    goto chr1:25158588-25161609
    snapshot chr1_25158688_25161509_slop100.png
    goto chr1:26489713-26490238
    snapshot chr1_26489813_26490138_slop100.png
    goto chr1:27935252-27935613
    snapshot chr1_27935352_27935513_slop100.png
    goto chr1:28247700-28248208
    snapshot chr1_28247800_28248108_slop100.png
    goto chr1:31574966-31577431
    snapshot chr1_31575066_31577331_slop100.png
    goto chr1:35101322-35112076
    snapshot chr1_35101422_35111976_slop100.png
    ```

    ## Load IGV Session

    ## Run Batch Script
  15. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,12 @@ The easiest way to define the regions of interest is to create a [BED](https://g
    __Example__:

    ```
    bed
    chr1 25158688 25161509
    chr1 26489813 26490138
    chr1 27935352 27935513
    chr1 28247800 28248108
    chr1 31575066 31577331
    chr1 35101422 35111976
    ```

    ## bedToIgv
  16. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -26,6 +26,14 @@ IGV provides functionality that allows a user to create a script to take screens

    ## Create BED File

    The easiest way to define the regions of interest is to create a [BED](https://genome.ucsc.edu/FAQ/FAQformat.html#format1) file of the regions. IGV will navigate to the exact coordinates in the bed file. Often you will want to pad the regions for visualization. You can either pad the BED records directly or use the `bedToIgv` script below to pad the records.

    __Example__:

    ```
    bed
    ```

    ## bedToIgv

    ## Load IGV Session
  17. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -33,3 +33,7 @@ IGV provides functionality that allows a user to create a script to take screens
    ## Run Batch Script

    ![run batch script](https://i.imgur.com/2bdFvPR.png "Run Batch Script")

    ![save session](https://i.imgur.com/XD9aDAb.png "Save Session")

    ![example session](https://i.imgur.com/aD7swR1.png "Example Session")
  18. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions IGV_Batch_Screenshots.md
    Original file line number Diff line number Diff line change
    @@ -32,3 +32,4 @@ IGV provides functionality that allows a user to create a script to take screens

    ## Run Batch Script

    ![run batch script](https://i.imgur.com/2bdFvPR.png "Run Batch Script")
  19. dfjenkins3 renamed this gist Aug 19, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  20. dfjenkins3 revised this gist Aug 19, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,8 @@ IGV provides functionality that allows a user to create a script to take screens

    ## Requirements

    1. [bedtools](www.google.com)
    2. [IGV](www.google.com) version 1.5 or higher
    1. [bedtools](https://github.com/arq5x/bedtools2)
    2. [IGV](https://www.broadinstitute.org/software/igv/download) version 1.5 or higher

    ## Workflow

  21. dfjenkins3 created this gist Aug 19, 2015.
    34 changes: 34 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    IGV Batch Screenshots
    =====================

    IGV provides functionality that allows a user to create a script to take screenshots of regions of interest.

    ## Table of Contents

    1. [Requirements](#requirements)
    2. [Workflow](#workflow)
    3. [Create BED File](#create-bed-file)
    4. [bedToIgv](#bedtoigv)
    5. [Load IGV Session](#load-igv-session)
    6. [Run Batch Script](#run-batch-script)

    ## Requirements

    1. [bedtools](www.google.com)
    2. [IGV](www.google.com) version 1.5 or higher

    ## Workflow

    1. Create a bed file of regions of interest
    2. Use `bedToIgv` to convert the bed file into an IGV batch script
    3. Open IGV and load the files that you want to visualize
    4. Run the IGV batch script

    ## Create BED File

    ## bedToIgv

    ## Load IGV Session

    ## Run Batch Script