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?


2 Answers 2


Partially a shameless plug. See if ASCIIGenome 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 or load BAM(s) and bed file and jump from one bed interval to the next using the next -start command.


I cross-posted this question on the official samtools issue tracker, and finally got a response.

Looking at the code for the HTML view, I see this and this. So maybe try

COLUMNS=200 samtools tview -d H -p CHR:X-Y aln.bam ref.fasta


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.