How To Extract Graphs In Batch In Igv?
3
2
Entering edit mode
10.3 years ago
biolab ★ 1.4k

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!

igv • 3.7k views
ADD COMMENT
3
Entering edit mode
10.3 years ago
Pavel Senin ★ 1.9k

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("127.0.0.1", 60151);
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

// Clear Screen
out.println("new");
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...
out.println(paramStr);
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
socket.close();

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/IGV.java b/src/org/broad/igv/ui/IGV.java
index 8a8b6f0..3334e5e 100644
--- a/src/org/broad/igv/ui/IGV.java
+++ b/src/org/broad/igv/ui/IGV.java
@@ -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 COMMENT
0
Entering edit mode

Thank you very much! It is really helpful!

ADD REPLY
0
Entering edit mode

you are welcome!

ADD REPLY
2
Entering edit mode
10.3 years ago

See my blog post: "Controlling IGV through a Port: my notebook." http://plindenbaum.blogspot.fr/2011/07/controlling-igv-through-port-my.html

ADD COMMENT
1
Entering edit mode
10.3 years ago

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 COMMENT

Login before adding your answer.

Traffic: 3131 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6