Biostar Beta. Not for public use.
Question: How To Extract Graphs In Batch In Igv?
2
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
3
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("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 COMMENTlink 6.2 years ago Pavel Senin ♦ 1.9k
Entering edit mode
0

Thank you very much! It is really helpful!

ADD REPLYlink 6.2 years ago
biolab
♦ 1.1k
Entering edit mode
0

you are welcome!

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

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

ADD COMMENTlink 6.2 years ago Pierre Lindenbaum 120k
1
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