<p>I cross-posted this question on the <a href="https://github.com/samtools/samtools/issues/994" rel="nofollow noreferrer">official samtools issue tracker</a>, and finally got a response.</p>

<blockquote>
  <p>Looking at the code for the HTML view, I see <a href="https://github.com/samtools/samtools/blob/develop/bam_tview_html.c#L320" rel="nofollow noreferrer">this</a> and <a href="https://github.com/samtools/samtools/blob/develop/bam_tview_html.c#L348-L352" rel="nofollow noreferrer">this</a>.
  So maybe try</p>
  
  <p><code>COLUMNS=200 samtools tview -d H -p CHR:X-Y aln.bam ref.fasta</code></p>
</blockquote>

CC BY-SA 4.0
2019-04-24T14:53:40.727Z
2019-04-24T14:53:40.727Z
Daniel Standage
<p>Partially a shameless plug. See if <a href="https://asciigenome.readthedocs.io/en/latest/description.html" rel="nofollow noreferrer">ASCIIGenome</a> can help you with that. </p>

<p>To review a number of regions that you saved in, say, a bed file, you can either process them in <a href="https://asciigenome.readthedocs.io/en/latest/examples.html#batch-and-non-interactive-mode" rel="nofollow noreferrer">batch</a> or load BAM(s) and bed file and jump from one bed interval to the next using the <a href="https://asciigenome.readthedocs.io/en/latest/commandHelp.html#next" rel="nofollow noreferrer"><code>next -start</code></a> command.</p>

CC BY-SA 4.0
2018-12-21T08:36:49.013Z
2018-12-21T08:36:49.013Z
dariober
<p>I have a large number of loci I would like to examine manually with <code>samtools tview</code>. Rather than typing or copy-n-pasting dozens of coordinates, I was hoping to automate the generation of pileup "images" (text files).</p>

<p>With some experimenting just now, I was happy to learn that if I specify the display option <code>-d H</code> or <code>-d T</code> the output can easily be redirected to a file for later inspection. However, it appears that I cannot control the window captured. Changing the width of the terminal window doesn't change the output, nor does adjusting the <code>-p</code> flag (i.e. <code>-p chr1:501-700</code>). No matter what, <code>tview</code> always reports an 80bp window in text or HTML mode.</p>

<p>Is there any way I can adjust this?</p>

<samtools><read-mapping><visualization>
Control width of samtools tview "snapshot" when redirecting
# Control width of samtools tview "snapshot" when redirecting

(Asked by: username_0 on 2018-12-20)

I have a large number of loci I would like to examine manually with `samtools tview`. Rather than typing or copy-n-pasting dozens of coordinates, I was hoping to automate the generation of pileup "images" (text files).

With some experimenting just now, I was happy to learn that if I specify the display option `-d H` or `-d T` the output can easily be redirected to a file for later inspection. However, it appears that I cannot control the window captured. Changing the width of the terminal window doesn't change the output, nor does adjusting the `-p` flag (i.e. `-p chr1:501-700`). No matter what, `tview` always reports an 80bp window in text or HTML mode.

Is there any way I can adjust this?

**Tags:** samtools, read-mapping, visualization

---

## 2 answers

### Answer by username_0 on 2019-04-24. Score: 1 | Accepted answer

I cross-posted this question on the [official samtools issue tracker](https://github.com/samtools/samtools/issues/994), and finally got a response.

> Looking at the code for the HTML view, I see [this](https://github.com/samtools/samtools/blob/develop/bam_tview_html.c#L320) and [this](https://github.com/samtools/samtools/blob/develop/bam_tview_html.c#L348-L352).
> So maybe try
>
> `COLUMNS=200 samtools tview -d H -p CHR:X-Y aln.bam ref.fasta`


---

### Answer by username_1 on 2018-12-21. Score: 2

Partially a shameless plug. See if [ASCIIGenome](https://asciigenome.readthedocs.io/en/latest/description.html) can help you with that.

To review a number of regions that you saved in, say, a bed file, you can either process them in [batch](https://asciigenome.readthedocs.io/en/latest/examples.html#batch-and-non-interactive-mode) or load BAM(s) and bed file and jump from one bed interval to the next using the [`next -start`](https://asciigenome.readthedocs.io/en/latest/commandHelp.html#next) command.


---

