Biostar Beta. Not for public use.
Question: How To Extract Graphs In Batch In Igv?
Entering edit mode

Dear all,

I am using IGV to view our sequencing results. I need to take deeper views on ~ 200 positons. How to generate the track graphs for these 200 positions in batch in IGV? Thank you very much for your suggestions!

ADD COMMENTlink 6.2 years ago biolab ♦ 1.1k • updated 6.2 years ago Pierre Lindenbaum 120k
Entering edit mode

It is possible, you will need to run IGV and a java code which will make IGV to show a location and to write a screenshot into a file through an API.

// connect to IGV
Socket socket = new Socket("", 60151);
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

// Clear Screen
String response = in.readLine();
System.out.println("reset status: " + response);

// Load the cow genome
out.println("genome bosTau6");
response = in.readLine();
System.out.println("load genome status: " + response);

// load all the needed tracks
// paramStr = "load " + PREFIX + gtfName + COMMA + PREFIX + alignmentName...
response = in.readLine();
System.out.println("load GTF and alignment status: " + response);

// move a viewport to the location
// private static final String REGION_OF_INTEREST = "chr3:120,307,601-120,340,000"
out.println("goto " + REGION_OF_INTEREST);
response = in.readLine();
System.out.println("Goto status: " + response);

// here you could load another track too
out.println("expand regions.gff");

// set a folder for a snapshot
// private static final String SNAPSHOT_FOLDER = "/media/project2";
out.println("snapshotDirectory " + SNAPSHOT_FOLDER);
response = in.readLine();
System.out.println("set snapshot folder status: " + response);

// write it down
out.println("snapshot " + snapshotFName);
response = in.readLine();
System.out.println("write snapshot status: " + response);

// close the socket communications

while doing bunches of screenshots, I faced another issue - IGV displays tracks as _expanded_ by default, whether I needed those _squished_ , you can fix that easily by adding a single line to the code

diff --git a/src/org/broad/igv/ui/ b/src/org/broad/igv/ui/
index 8a8b6f0..3334e5e 100644
--- a/src/org/broad/igv/ui/
+++ b/src/org/broad/igv/ui/
@@ -1594,7 +1594,9 @@ public class IGV {
                 track.setAttributeValue("NAME", track.getName());
                 track.setAttributeValue("DATA FILE", fn);
                 track.setAttributeValue("DATA TYPE", track.getTrackType().toString());
+                track.setDisplayMode(Track.DisplayMode.SQUISHED);
                 if (track instanceof TrackGroupEventListener) {
                     addGroupEventListener((TrackGroupEventListener) track);
ADD COMMENTlink 6.2 years ago Pavel Senin ♦ 1.9k
Entering edit mode

Thank you very much! It is really helpful!

ADD REPLYlink 6.2 years ago
♦ 1.1k
Entering edit mode

you are welcome!

ADD REPLYlink 6.2 years ago
Pavel Senin
♦ 1.9k
Entering edit mode

See my blog post: "Controlling IGV through a Port: my notebook."

ADD COMMENTlink 6.2 years ago Pierre Lindenbaum 120k
Entering edit mode

If you are an R/bioconductor user, the SRAdb package offers some simple functionality that uses IGV's port interface, including scrolling and screen capture, all programmatically.

ADD COMMENTlink 6.2 years ago Sean Davis 25k

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.0