Integrative Genomics Viewer (IGV)

repository·main·Indexed 20 days ago

https://github.com/igvteam/igv

A desktop genome visualization tool for Mac, Windows, and Linux that allows users to visualize genomic data and supports remote data access via Amazon S3. The tool includes igvtools for command-line use and integrates with BEDTools for genomic data analysis, including operations like intersect, subtract, closest, window, and coverage.

Tokens
3K
Snippets
10
Records
14
Agent score
73%

What's inside IGV

  1. Use the IGV logging wrapper for Log4J compatibility

    main
    The org.igv.logging package provides wrapper classes around java.util.logging designed to emulate Log4J APIs. This package is intended to facilitate porting code that was previously dependent on Log4J into the IGV environment by providing a compatible logging interface.
  2. Access Amazon S3 data in IGV

    main

    IGV supports loading public data files hosted in Amazon S3 buckets using HTTPS endpoints.

    For authenticated access using s3:// URLs, you have two options:

    1. OAuth via Cognito: Enable OAuth access using the UMCCR contributed AWS configuration option.
    2. AWS Credentials: Set your AWS credentials and region information locally following standard AWS SDK for Java patterns.

    Detailed guides for Cognito setup can be found in the UMCCR documentation for both backend and frontend provisioning.

  3. Use the IGV distribution and launch scripts

    main

    Running ./gradlew createDist generates a distribution directory located at build/IGV-dist. This directory contains igv.jar, required third-party dependencies, and platform-specific launcher scripts. The scripts expect the distribution folder structure to remain intact to function correctly.

    Launching the IGV Desktop Application

    • Linux: Run igv.sh or igv_hidpi.sh
    • macOS: Run igv.command
    • Windows: Run igv.bat (or igv.bat if using the gradlew.bat build process)

    Running igvtools

    To use igvtools from the command line, use the following scripts within the distribution directory:

    • Linux/macOS: igvtools
    • Windows: igvtools.bat

    Refer to igvtools_readme.txt inside the distribution directory for specific command-line usage instructions.

    # Example: Building and then launching on Linux
    ./gradlew createDist
    ./build/IGV-dist/igv.sh
  4. Configure and use BEDTools with IGV

    main

    IGV can leverage BEDTools to perform genomic data analysis on tracks currently in view.

    Requirements:

    1. Separate Installation: BEDTools is not bundled with IGV and must be installed on your system independently.
    2. Permissions: The user account running IGV must have the necessary execution permissions for the BEDTools binaries.

    Once configured, IGV provides access to several BEDTools commands to analyze overlapping or nearby features between tracks.

  5. Build IGV from source

    main

    To build IGV, you must have Java 21 installed (though later versions may work). Builds are executed from the project root and output files to the build subdirectory.

    Prerequisites:

    • Java 21
    • Gradle installed for your platform

    Note for Windows users: Use ./gradlew.bat instead of ./gradlew.

    # Build a distribution directory
    ./gradlew createDist
    
    # Run the test suite
    ./gradlew test
  6. Install and run IGV

    main

    Prerequisites

    • Java 17 or greater is required. You can obtain a free open-source distribution from Adoptium.

    Installation Steps

    1. Download and unzip the IGV distribution file to your preferred directory.
    2. Execute one of the following launcher scripts from your terminal/command line:

    Windows:

    • igv-launcher.bat (Standard GUI launch)
    • igv.bat (For batch jobs)

    Linux and macOS:

    • igv.sh (Standard launch)
    • igv_hidpi.sh (For Linux with HiDPI displays)
    • igv.command (macOS: double-click to start)

    Note: If the script fails to run on Linux/macOS, you may need to make it executable using chmod a+x <script_name>.

    chmod a+x igv.sh
    ./igv.sh
  7. Configure HiDPI scaling for IGV

    main

    To adjust the UI scaling on HiDPI displays, you can modify the scaling factor. While the igv_hidpi.sh script is pre-configured for 2x scaling, it is recommended to use the java_arguments file instead. This allows the standard igv.sh to work correctly on HiDPI screens without needing a specific script.

    Scaling Options

    • The scaling is controlled via the -Dsun.java2d.uiScale parameter.
    • Supported values: Integer values only (e.g., 2, 4).
    • Note: Fractional values are NOT supported.

    Implementation

    Add the following line to your java_arguments file ($HOME/.igv/java_arguments or %USERPROFILE%/.igv/java_arguments):

    -Dsun.java2d.uiScale=4
    -Dsun.java2d.uiScale=4
  8. Increase IGV memory allocation

    main

    By default, IGV launcher scripts are configured to start with 4GB of memory. If you are working with very large datasets, you can increase this limit by creating or editing the java_arguments file.

    Configuration File Locations

    • macOS and Linux: $HOME/.igv/java_arguments
    • Windows: %USERPROFILE%/.igv/java_arguments

    How to use

    1. Create the file if it does not exist.
    2. Add the -Xmx parameter. By default, this line is commented out with a #.
    3. Uncomment the line and set your desired memory (e.g., 8g for 8 GB).

    Example for 8 GB of memory:

    -Xmx8g
    -Xmx8g
  9. Run IGV via direct Java command line (Advanced)

    main

    Running IGV directly via the java command is complex and generally not recommended for most users. Use the provided launcher scripts instead. If you must run it manually, use the following patterns depending on your environment.

    Using system Java (Java 11+ required)

    java --module-path=lib -Xmx4g @igv.args --module=org.igv/org.igv.ui.Main

    Using bundled JDK (e.g., JDK 21)

    If using the JDK included in the IGV package, substitute the java command with the path to the bundled binary:

    ./jdk-21/bin/java --module-path=lib -Xmx4g @igv.args --module=org.igv/org.igv.ui.Main

    Using the java_arguments file with direct command

    To ensure your custom memory and scaling settings in java_arguments are applied when running the direct command, use the @ syntax to point to the file.

    Linux & Mac:

    java --module-path=lib @igv.args @"$HOME/.igv/java_arguments" --module=org.igv/org.igv.ui.Main

    Windows:

    java --module-path=lib @igv.args @"%USERPROFILE%/.igv/java_arguments" --module=org.igv/org.igv.ui.Main
    java --module-path=lib @igv.args @"$HOME/.igv/java_arguments" --module=org.igv/org.igv.ui.Main
  10. Available BEDTools commands in IGV

    main

    IGV provides access to the following BEDTools operations for analyzing data in view:

    • intersect: Identifies regions of overlapping features in two tracks. Note that IGV uses the -split flag, meaning exons are treated as separate features.
    • subtract: Removes regions in one track from another. (e.g., subtracting a gene track from a feature track to find regions NOT in a gene).
    • closest: For each feature in the first track, finds the closest matching feature in the second track (which may be an overlapping feature).
    • window: Similar to intersect, but expands each feature in the first track by a specified number of base pairs (defaulting to 1000 bp) upstream and downstream to detect "near" features in the second track.
    • coverage: Calculates the coverage of track A by track B.
  11. Parse IGV version strings

    main

    The org.igv.ui.Main.Version class allows you to parse and compare IGV version strings that follow Microsoft versioning conventions (e.g., 2.3.27).

    Use Version.getVersion(String versionString) to create a Version instance, and lessThan(Version anotherVersion) to perform comparisons.

    // Example parsing and comparing versions
    Main.Version v1 = Main.Version.getVersion("2.3.27");
    Main.Version v2 = Main.Version.getVersion("2.3.28");
    
    if (v1.lessThan(v2)) {
        // v1 is older than v2
    }
  12. Launch IGV as a standalone application

    main

    Use the org.igv.ui.Main.main(String[] args) method to launch IGV as a standalone application in its own window. This method initializes the environment, sets up the look and feel, and handles command-line arguments.

    public static void main(final String args[])