<p>Running an IGV batch script helps increase the number of reads per image, compared with <code>File | Save image</code>, but it does not solve the issue by itself. </p>

<p>To run a script, first make a script file like so with 1 command per line:</p>

<pre><code>snapshotDirectory ./
goto chr2:28582094-28582790
maxPanelHeight 10000
snapshot chr2_28582094_28582790.png
</code></pre>

<p>Run the script using <code>Tools | Run batch script</code> menu. The importat trick is the <code>maxPanelHeight 10000</code> which is what makes this include more reads than the default snapshot. </p>

<p>You can also convert this into a little shell script:</p>

<pre><code>#!/bin/bash
mkdir -p /tmp/igv
sleep 2
echo "snapshotDirectory /tmp/igv"
sleep 2
goto chr2:28582094-28582790
sleep 2
echo "maxPanelHeight 10000"
echo "snapshot chr2_28582094_28582790.png"
</code></pre>

<p>Then, just open IGV, load the relevant BAM file and run the script like this to connect to IGV via telnet (<a href="http://plindenbaum.blogspot.com/2011/07/controlling-igv-through-port-my.html" rel="nofollow noreferrer">credit to Pierre Lindenbaum</a>):</p>

<pre><code>sh foo.sh |  telnet 127.0.0.1 60151
</code></pre>

CC BY-SA 4.0
2019-11-04T16:44:41.763Z
2019-11-04T16:51:47.083Z
2019-11-04T16:51:47.083Z
Timur Shtatland
<p>The <a href="http://software.broadinstitute.org/software/igv/" rel="nofollow noreferrer">IGV browser</a> lets you export an alignment as an image (File => Save Image). However, this image only contains those reads that fit in the viewing window:</p>

<p><a href="https://i.sstatic.net/s5Ma9.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/s5Ma9.png" alt="IGV screenshot"></a></p>

<p>As you can see in the image above by looking at the scroll bar on the right, this is only a small subset of aligned reads. Is there any way to export an image of the aligned reads that includes <em>all</em> reads and not only those currently shown in the window?</p>

CC BY-SA 4.0
2019-11-04T16:23:06.987Z
Running an IGV batch script helps increase the number of reads per image, compared with `File | Save image`, but it does **not** solve the issue. To run a script, first make a script file like so with 1 command per line: ```snapshotDirectory ./
goto chr2:28582094-28582790
snapshot chr2_28582094_28582790.png
goto chr4:8203487-8203815
snapshot chr4_8203487_8203815.png``` Run the script using `Tools | Run batch script` menu.
Timur Shtatland
CC BY-SA 4.0
2019-11-04T16:23:35.927Z
@TimurShtatland sorry, I have no idea what that is supposed to mean. That looks like a set of scripting commands and I have a vague recollection of having seen something like that for IGV in the past. Could you please post an answer explaining what you are suggesting?
terdon
CC BY-SA 4.0
2019-11-04T16:27:00.177Z
Oops, pasted the wrong thing. Fixed this. IMO, this is not an answer, but might help partially.
Timur Shtatland
CC BY-SA 4.0
2019-11-04T16:30:29.487Z
@TimurShtatland yes, thanks. I'd posted my comment before your edit :). If the scripting approach does give more reads, then it's at least a partial solution and deserves an answer. Could you flesh your comment into an answer? If you'd rather not, I can post one as soon as I've tested it, but you deserve the rep.
terdon
CC BY-SA 4.0
2019-11-04T16:38:58.810Z
@TimurShtatland well, this is embarrassing. Your comment made me find an old script I had which does exactly this! I had completely forgotten! Please post an answer, you should get the credit, and then I'll just edit it to add what I did to get everything (essentially, you can set `maxPanelHeight` to get more reads).
terdon
CC BY-SA 4.0
2019-11-04T16:46:22.203Z
Thank you, done. Please feel free to edit. I don't deserve the full credit obviously, so I owe you half. :)
Timur Shtatland
CC BY-SA 4.0
2019-11-04T16:52:33.610Z
@TimurShtatland thanks, but that's fine. The credit belongs to Pierre whose post I'd managed to find last time I needed this and then promptly forgot about until your comment reminded me :). And I already have all the editing privileges rep can buy here, so you need it more!
terdon
CC BY-SA 4.0
2019-11-04T16:56:09.927Z
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/100681/discussion-between-timur-shtatland-and-terdon).
Timur Shtatland
<sam><ngs><visualization><igv>
How can I export a full alignment from IGV as an image?
# How can I export a full alignment from IGV as an image?

(Asked by: username_0 on 2019-11-04)

The [IGV browser](http://software.broadinstitute.org/software/igv/) lets you export an alignment as an image (File => Save Image). However, this image only contains those reads that fit in the viewing window:

[![IGV screenshot](https://i.sstatic.net/s5Ma9.png)](https://i.sstatic.net/s5Ma9.png)

As you can see in the image above by looking at the scroll bar on the right, this is only a small subset of aligned reads. Is there any way to export an image of the aligned reads that includes *all* reads and not only those currently shown in the window?

**Tags:** sam, ngs, visualization, igv
> **Comments:**
> **username_1**: Running an IGV batch script helps increase the number of reads per image, compared with `File | Save image`, but it does **not** solve the issue. To run a script, first make a script file like so with 1 command per line: ```snapshotDirectory ./ goto chr2:28582094-28582790 snapshot chr2_28582094_28582790.png goto chr4:8203487-8203815 snapshot chr4_8203487_8203815.png``` Run the script using `Tools | Run batch script` menu.  
> **username_0**: @TimurShtatland sorry, I have no idea what that is supposed to mean. That looks like a set of scripting commands and I have a vague recollection of having seen something like that for IGV in the past. Could you please post an answer explaining what you are suggesting?  
> **username_1**: Oops, pasted the wrong thing. Fixed this. IMO, this is not an answer, but might help partially.  
> **username_0**: @TimurShtatland yes, thanks. I'd posted my comment before your edit :). If the scripting approach does give more reads, then it's at least a partial solution and deserves an answer. Could you flesh your comment into an answer? If you'd rather not, I can post one as soon as I've tested it, but you deserve the rep.  
> **username_0**: @TimurShtatland well, this is embarrassing. Your comment made me find an old script I had which does exactly this! I had completely forgotten! Please post an answer, you should get the credit, and then I'll just edit it to add what I did to get everything (essentially, you can set `maxPanelHeight` to get more reads).  
> **username_1**: Thank you, done. Please feel free to edit. I don't deserve the full credit obviously, so I owe you half. :)  
> **username_0**: @TimurShtatland thanks, but that's fine. The credit belongs to Pierre whose post I'd managed to find last time I needed this and then promptly forgot about until your comment reminded me :). And I already have all the editing privileges rep can buy here, so you need it more!  
> **username_1**: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/100681/discussion-between-timur-shtatland-and-terdon).  

---

## 1 answers

### Answer by username_1 on 2019-11-04. Score: 4 | Accepted answer

Running an IGV batch script helps increase the number of reads per image, compared with File | Save image, but it does not solve the issue by itself. 
To run a script, first make a script file like so with 1 command per line:
snapshotDirectory ./
goto chr2:28582094-28582790
maxPanelHeight 10000
snapshot chr2_28582094_28582790.png

Run the script using Tools | Run batch script menu. The importat trick is the maxPanelHeight 10000 which is what makes this include more reads than the default snapshot. 
You can also convert this into a little shell script:
#!/bin/bash
mkdir -p /tmp/igv
sleep 2
echo "snapshotDirectory /tmp/igv"
sleep 2
goto chr2:28582094-28582790
sleep 2
echo "maxPanelHeight 10000"
echo "snapshot chr2_28582094_28582790.png"

Then, just open IGV, load the relevant BAM file and run the script like this to connect to IGV via telnet (credit to Pierre Lindenbaum):
sh foo.sh |  telnet 127.0.0.1 60151


---

