tview 0.1.dev4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tview-0.1.dev4/.github/workflows/ci.yml +30 -0
- tview-0.1.dev4/.github/workflows/publish.yml +61 -0
- tview-0.1.dev4/.gitignore +207 -0
- tview-0.1.dev4/LICENSE +21 -0
- tview-0.1.dev4/PKG-INFO +293 -0
- tview-0.1.dev4/README.md +260 -0
- tview-0.1.dev4/examples/fasta_env_1-120.png +0 -0
- tview-0.1.dev4/examples/indel_alignment.png +0 -0
- tview-0.1.dev4/examples/indel_sorted.bam +0 -0
- tview-0.1.dev4/examples/indel_sorted.bam.bai +0 -0
- tview-0.1.dev4/examples/indel_test.sam +7 -0
- tview-0.1.dev4/examples/ref.fa +2 -0
- tview-0.1.dev4/examples/ref.fa.fai +1 -0
- tview-0.1.dev4/examples/sample2.sam +4 -0
- tview-0.1.dev4/examples/sample2_sorted.bam +0 -0
- tview-0.1.dev4/examples/sample2_sorted.bam.bai +0 -0
- tview-0.1.dev4/examples/stacked_bam.png +0 -0
- tview-0.1.dev4/pyproject.toml +58 -0
- tview-0.1.dev4/setup.cfg +4 -0
- tview-0.1.dev4/src/tview/__init__.py +27 -0
- tview-0.1.dev4/src/tview/_version.py +34 -0
- tview-0.1.dev4/src/tview/cli.py +61 -0
- tview-0.1.dev4/src/tview/tview.py +352 -0
- tview-0.1.dev4/src/tview.egg-info/PKG-INFO +293 -0
- tview-0.1.dev4/src/tview.egg-info/SOURCES.txt +62 -0
- tview-0.1.dev4/src/tview.egg-info/dependency_links.txt +1 -0
- tview-0.1.dev4/src/tview.egg-info/entry_points.txt +2 -0
- tview-0.1.dev4/src/tview.egg-info/requires.txt +9 -0
- tview-0.1.dev4/src/tview.egg-info/top_level.txt +1 -0
- tview-0.1.dev4/tests/__init__.py +0 -0
- tview-0.1.dev4/tests/conftest.py +35 -0
- tview-0.1.dev4/tests/output/all_gaps.png +0 -0
- tview-0.1.dev4/tests/output/all_matches.png +0 -0
- tview-0.1.dev4/tests/output/cli_columns_1-8.png +0 -0
- tview-0.1.dev4/tests/output/cli_fasta_mode.png +0 -0
- tview-0.1.dev4/tests/output/cli_palette_aa.png +0 -0
- tview-0.1.dev4/tests/output/dense_nt_mismatches.png +0 -0
- tview-0.1.dev4/tests/output/format_test.pdf +0 -0
- tview-0.1.dev4/tests/output/format_test.svg +231 -0
- tview-0.1.dev4/tests/output/hiv_env_realistic.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_001.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_002.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_003.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_004.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_005.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_006.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_007.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_008.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_009.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_aa_010.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_001.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_002.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_003.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_004.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_005.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_006.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_007.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_008.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_009.png +0 -0
- tview-0.1.dev4/tests/output/hypothesis_nt_010.png +0 -0
- tview-0.1.dev4/tests/output/mixed_bam_fasta.png +0 -0
- tview-0.1.dev4/tests/output/stacked_panels.png +0 -0
- tview-0.1.dev4/tests/test_cli.py +96 -0
- tview-0.1.dev4/tests/test_fasta.py +290 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
16
|
+
python-version: ["3.9", "3.14"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install package with dev dependencies
|
|
27
|
+
run: pip install ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: pytest -v
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
tags:
|
|
7
|
+
- 'v*'
|
|
8
|
+
release:
|
|
9
|
+
types: [published]
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
id-token: write # Required for trusted publishing
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
name: Build distribution
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
with:
|
|
23
|
+
fetch-depth: 0
|
|
24
|
+
|
|
25
|
+
- name: Set up Python
|
|
26
|
+
uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.12"
|
|
29
|
+
|
|
30
|
+
- name: Install build dependencies
|
|
31
|
+
run: python -m pip install --upgrade pip build
|
|
32
|
+
|
|
33
|
+
- name: Build sdist and wheel
|
|
34
|
+
run: python -m build
|
|
35
|
+
|
|
36
|
+
- name: Upload artifacts
|
|
37
|
+
uses: actions/upload-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: dist
|
|
40
|
+
path: dist/
|
|
41
|
+
|
|
42
|
+
publish-to-pypi:
|
|
43
|
+
name: Publish to PyPI
|
|
44
|
+
needs: [build]
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
if: always() && needs.build.result == 'success'
|
|
47
|
+
environment:
|
|
48
|
+
name: pypi
|
|
49
|
+
url: https://pypi.org/p/tview
|
|
50
|
+
permissions:
|
|
51
|
+
id-token: write
|
|
52
|
+
|
|
53
|
+
steps:
|
|
54
|
+
- name: Download artifacts
|
|
55
|
+
uses: actions/download-artifact@v4
|
|
56
|
+
with:
|
|
57
|
+
name: dist
|
|
58
|
+
path: dist/
|
|
59
|
+
|
|
60
|
+
- name: Publish to PyPI
|
|
61
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
tview-0.1.dev4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Troy Sincomb
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tview-0.1.dev4/PKG-INFO
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tview
|
|
3
|
+
Version: 0.1.dev4
|
|
4
|
+
Summary: Publication-quality alignment viewer for nucleotide and amino acid sequences
|
|
5
|
+
Author-email: Troy Sincomb <troysincomb@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MurrellGroup/tview
|
|
8
|
+
Project-URL: Repository, https://github.com/MurrellGroup/tview
|
|
9
|
+
Project-URL: Issues, https://github.com/MurrellGroup/tview/issues
|
|
10
|
+
Keywords: bioinformatics,alignment,samtools,tview,visualization,BAM,FASTA
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: matplotlib>=3.5
|
|
27
|
+
Requires-Dist: click>=8.0
|
|
28
|
+
Requires-Dist: pysam>=0.20; sys_platform != "win32"
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
31
|
+
Requires-Dist: hypothesis>=6.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# tview
|
|
35
|
+
|
|
36
|
+
Publication-quality alignment viewer for nucleotide and amino acid sequences. A lightweight alternative to `samtools tview` that produces clean, stable image output.
|
|
37
|
+
|
|
38
|
+
Supports **BAM files** (with reference FASTA), **pre-aligned FASTA** (e.g. MAFFT output), and **stacking** multiple inputs into a single figure.
|
|
39
|
+
|
|
40
|
+

|
|
41
|
+
*BAM mode — SNP (yellow), 3bp deletion, 2bp insertion (purple columns), reverse-strand insertion*
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
*FASTA mode — HIV Env protein alignment (HxB2 reference), amino acid palette*
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
*Stacked mode — two BAM files sharing a reference and region*
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install tview
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Installs `matplotlib`, `click`, and `pysam`.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Quick Start
|
|
62
|
+
|
|
63
|
+
### BAM file
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
tview \
|
|
67
|
+
--bam aligned.bam \
|
|
68
|
+
--ref reference.fa \
|
|
69
|
+
--region chr1:100-200 \
|
|
70
|
+
-o alignment.png
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Aligned FASTA (e.g. MAFFT output)
|
|
74
|
+
|
|
75
|
+
The first sequence in the file is treated as the reference.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
tview \
|
|
79
|
+
--fasta env_protein_aligned.fasta \
|
|
80
|
+
--palette aa \
|
|
81
|
+
-o env_alignment.png
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Subset columns from a FASTA alignment
|
|
85
|
+
|
|
86
|
+
Use `--columns` with 1-based inclusive range to window into long alignments.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
tview \
|
|
90
|
+
--fasta aligned.fasta \
|
|
91
|
+
--columns 1-120 \
|
|
92
|
+
--palette aa \
|
|
93
|
+
-o first_120_cols.png
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Stacking Multiple Panels
|
|
99
|
+
|
|
100
|
+
Each input file becomes a vertically stacked panel separated by a thin line. Panels are labeled on the left with the filename stem.
|
|
101
|
+
|
|
102
|
+
### Multiple BAMs (shared reference and region)
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
tview \
|
|
106
|
+
--bam sample1.bam --bam sample2.bam --bam sample3.bam \
|
|
107
|
+
--ref reference.fa \
|
|
108
|
+
--region chr1:100-200 \
|
|
109
|
+
-o stacked.png
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Multiple FASTAs
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
tview \
|
|
116
|
+
--fasta group1_aligned.fasta --fasta group2_aligned.fasta \
|
|
117
|
+
--palette aa \
|
|
118
|
+
--columns 1-120 \
|
|
119
|
+
-o comparison.png
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Mix BAM and FASTA panels
|
|
123
|
+
|
|
124
|
+
`--ref` and `--region` apply only to BAM panels; `--columns` applies only to FASTA panels.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
tview \
|
|
128
|
+
--bam reads.bam \
|
|
129
|
+
--ref reference.fa \
|
|
130
|
+
--region chr1:100-200 \
|
|
131
|
+
--fasta protein_aligned.fasta \
|
|
132
|
+
--columns 1-120 \
|
|
133
|
+
-o mixed.png
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
BAM panels are rendered first (top), FASTA panels below.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Piping from stdin
|
|
141
|
+
|
|
142
|
+
Pass `-` to read file paths from stdin (one per line). Each path becomes its own panel.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# find → stacked panels
|
|
146
|
+
find ./alignments -name "*.fasta" -type f | \
|
|
147
|
+
tview --fasta - --palette aa --columns 1-120 -o all.png
|
|
148
|
+
|
|
149
|
+
# ls with pattern
|
|
150
|
+
ls samples/*.bam | \
|
|
151
|
+
tview --bam - --ref ref.fa --region chr1:100-200 -o all_samples.png
|
|
152
|
+
|
|
153
|
+
# single file via echo
|
|
154
|
+
echo "my_alignment.fasta" | \
|
|
155
|
+
tview --fasta - --palette aa -o out.png
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Python API
|
|
161
|
+
|
|
162
|
+
The core functions are available as a Python library:
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from tview import fasta_panel, bam_panel, render_panels
|
|
166
|
+
|
|
167
|
+
# FASTA alignment
|
|
168
|
+
panel = fasta_panel("aligned.fasta", col_start=1, col_end=120)
|
|
169
|
+
render_panels([panel], "output.png", palette="aa")
|
|
170
|
+
|
|
171
|
+
# BAM alignment
|
|
172
|
+
panel = bam_panel("sample.bam", "reference.fa", "chr1:100-200")
|
|
173
|
+
render_panels([panel], "output.png")
|
|
174
|
+
|
|
175
|
+
# Stack multiple panels
|
|
176
|
+
panels = [
|
|
177
|
+
bam_panel("sample1.bam", "ref.fa", "chr1:100-200"),
|
|
178
|
+
bam_panel("sample2.bam", "ref.fa", "chr1:100-200"),
|
|
179
|
+
]
|
|
180
|
+
render_panels(panels, "stacked.png", dpi=300, fontsize=7, cell=0.14)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Visual Conventions
|
|
186
|
+
|
|
187
|
+
| Element | Symbol | Style |
|
|
188
|
+
|---------|--------|-------|
|
|
189
|
+
| Match (forward) | `.` | light grey |
|
|
190
|
+
| Match (reverse) | `,` | light grey, reduced opacity |
|
|
191
|
+
| Mismatch | `A` `T` etc. | colored, yellow highlight, bold |
|
|
192
|
+
| Mismatch (reverse) | `a` `t` etc. | lowercase, colored, yellow highlight |
|
|
193
|
+
| Deletion | `-` | grey dash |
|
|
194
|
+
| Insertion | colored bases | purple column shading |
|
|
195
|
+
| Gap (ref in insertion col) | `-` | grey dash |
|
|
196
|
+
| Gap (FASTA alignment) | `-` | grey dash |
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Color Palettes
|
|
201
|
+
|
|
202
|
+
### `--palette nt` (default) — Nucleotides
|
|
203
|
+
|
|
204
|
+
| Base | Color |
|
|
205
|
+
|------|-------|
|
|
206
|
+
| A | green `#4CAF50` |
|
|
207
|
+
| C | blue `#2196F3` |
|
|
208
|
+
| G | orange `#FF9800` |
|
|
209
|
+
| T | red `#F44336` |
|
|
210
|
+
|
|
211
|
+
### `--palette aa` — Amino Acids (Clustal-inspired)
|
|
212
|
+
|
|
213
|
+
| Group | Residues | Color |
|
|
214
|
+
|-------|----------|-------|
|
|
215
|
+
| Hydrophobic | A V L I M F W P | blue `#2196F3` |
|
|
216
|
+
| Positive charge | K R H | red `#F44336` |
|
|
217
|
+
| Negative charge | D E | magenta `#E040FB` |
|
|
218
|
+
| Polar uncharged | S T N Q | green `#4CAF50` |
|
|
219
|
+
| Special | G C Y | orange `#FF9800` |
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Full Argument Reference
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
Usage: tview [OPTIONS]
|
|
227
|
+
|
|
228
|
+
Publication-quality alignment viewer (BAM or FASTA).
|
|
229
|
+
|
|
230
|
+
Options:
|
|
231
|
+
--bam TEXT BAM file(s) — each becomes a panel. Use '-' for stdin.
|
|
232
|
+
--ref PATH Reference FASTA (required for BAM mode).
|
|
233
|
+
--region TEXT Genomic region chr:start-end (required for BAM mode).
|
|
234
|
+
--fasta TEXT Aligned FASTA file(s) — each becomes a panel. Use '-' for stdin.
|
|
235
|
+
--columns TEXT Column range for FASTA, 1-based inclusive (e.g. 1-120).
|
|
236
|
+
-o, --output TEXT Output image path. [default: alignment.png]
|
|
237
|
+
--palette [nt|aa] Color palette. [default: nt]
|
|
238
|
+
--dpi INTEGER Image resolution. [default: 300]
|
|
239
|
+
--fontsize INTEGER Base font size in points. [default: 7]
|
|
240
|
+
--cell FLOAT Cell size in inches. [default: 0.14]
|
|
241
|
+
-h, --help Show this message and exit.
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
| Argument | Description | Default |
|
|
245
|
+
|----------|-------------|---------|
|
|
246
|
+
| `--bam` | BAM file(s), each becomes a panel. Use `-` for stdin. | — |
|
|
247
|
+
| `--ref` | Reference FASTA (required for BAM mode) | — |
|
|
248
|
+
| `--region` | Genomic region `chr:start-end` (required for BAM) | — |
|
|
249
|
+
| `--fasta` | Aligned FASTA file(s), each becomes a panel. Use `-` for stdin. | — |
|
|
250
|
+
| `--columns` | Column range for FASTA, 1-based inclusive (e.g. `1-120`) | full alignment |
|
|
251
|
+
| `-o, --output` | Output image path | `alignment.png` |
|
|
252
|
+
| `--palette` | Color palette: `nt` or `aa` | `nt` |
|
|
253
|
+
| `--dpi` | Image resolution | `300` |
|
|
254
|
+
| `--fontsize` | Base font size in points | `7` |
|
|
255
|
+
| `--cell` | Cell size in inches (controls spacing) | `0.14` |
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Tips for Publication Figures
|
|
260
|
+
|
|
261
|
+
- Use `--dpi 300` (default) for print, `--dpi 150` for drafts.
|
|
262
|
+
- Use `--cell 0.10` for denser layouts with many sequences, `--cell 0.18` for fewer.
|
|
263
|
+
- Use `--fontsize 5` or `6` when displaying wide alignments (>100 columns).
|
|
264
|
+
- The output format is determined by the file extension: `.png`, `.pdf`, `.svg` all work.
|
|
265
|
+
- For Nature-style figures, `.pdf` or `.svg` output preserves vector text.
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# Vector output for publication
|
|
269
|
+
tview \
|
|
270
|
+
--fasta aligned.fasta \
|
|
271
|
+
--palette aa \
|
|
272
|
+
--columns 1-120 \
|
|
273
|
+
--cell 0.12 \
|
|
274
|
+
--fontsize 6 \
|
|
275
|
+
-o figure_2a.pdf
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## FASTA Input Format
|
|
281
|
+
|
|
282
|
+
The FASTA input must be **pre-aligned** (e.g. by MAFFT, MUSCLE, Clustal). The first sequence is used as the reference for comparison. Gap characters (`-`) in the alignment are preserved and rendered as grey dashes.
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
>HxB2_reference
|
|
286
|
+
MRVK---EKYQHLWRWGWRWGTMLLGMLMICS...
|
|
287
|
+
>sample_001
|
|
288
|
+
MRVKGIRKNAQHL----WRGGTLLLGMLMICS...
|
|
289
|
+
>sample_002
|
|
290
|
+
--------------------------MLMICS...
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
The x-axis labels count non-gap positions in the reference sequence (1, 10, 20, ...), so position numbers always correspond to the reference residue numbering regardless of gap columns.
|