trackplot 0.6.6__tar.gz → 0.7.1__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.
Files changed (53) hide show
  1. {trackplot-0.6.6/trackplot.egg-info → trackplot-0.7.1}/PKG-INFO +62 -27
  2. {trackplot-0.6.6 → trackplot-0.7.1}/README.md +61 -26
  3. {trackplot-0.6.6 → trackplot-0.7.1}/pyproject.toml +1 -1
  4. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/Readder.py +15 -5
  5. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/Transcript.py +5 -1
  6. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/cli.py +20 -0
  7. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/conf/ui.py +24 -0
  8. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/Annotation.py +154 -73
  9. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/Bam.py +1 -0
  10. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/plot/core.py +10 -0
  11. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/plot/render.py +98 -19
  12. {trackplot-0.6.6 → trackplot-0.7.1/trackplot.egg-info}/PKG-INFO +62 -27
  13. {trackplot-0.6.6 → trackplot-0.7.1}/LICENSE +0 -0
  14. {trackplot-0.6.6 → trackplot-0.7.1}/setup.cfg +0 -0
  15. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/__init__.py +0 -0
  16. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/anno/AxLabel.py +0 -0
  17. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/anno/__init__.py +0 -0
  18. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/anno/theme.py +0 -0
  19. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/CoordinateMap.py +0 -0
  20. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/GenomicLoci.py +0 -0
  21. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/Junction.py +0 -0
  22. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/Protein.py +0 -0
  23. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/ReadDepth.py +0 -0
  24. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/Stroke.py +0 -0
  25. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/__init__.py +0 -0
  26. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/base/pyUniprot.py +0 -0
  27. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/conf/DomainSetting.py +0 -0
  28. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/conf/__init__.py +0 -0
  29. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/conf/config.py +0 -0
  30. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/conf/drawing.py +0 -0
  31. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/ATAC.py +0 -0
  32. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/BedGraph.py +0 -0
  33. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/Bigwig.py +0 -0
  34. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/Depth.py +0 -0
  35. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/Fasta.py +0 -0
  36. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/File.py +0 -0
  37. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/HiCMatrixTrack.py +0 -0
  38. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/Junction.py +0 -0
  39. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/Motif.py +0 -0
  40. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/ReadSegments.py +0 -0
  41. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/file/__init__.py +0 -0
  42. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/plot/__init__.py +0 -0
  43. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/plot/coord.py +0 -0
  44. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/plot/info.py +0 -0
  45. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/plot/limits.py +0 -0
  46. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/plot/utils.py +0 -0
  47. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/plot_func.py +0 -0
  48. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot/server.py +0 -0
  49. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot.egg-info/SOURCES.txt +0 -0
  50. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot.egg-info/dependency_links.txt +0 -0
  51. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot.egg-info/entry_points.txt +0 -0
  52. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot.egg-info/requires.txt +0 -0
  53. {trackplot-0.6.6 → trackplot-0.7.1}/trackplot.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trackplot
3
- Version: 0.6.6
3
+ Version: 0.7.1
4
4
  Summary: The trackplot is a tool for visualizing various next-generation sequencing (NGS) data, including DNA-seq, RNA-seq, single-cell RNA-seq and full-length sequencing datasets. https://sashimi.readthedocs.io/
5
5
  Author-email: ygidtu <ygidtu@gmail.com>
6
6
  License-Expression: BSD-3-Clause
@@ -30,9 +30,9 @@ Dynamic: license-file
30
30
 
31
31
  [![PyPI version](https://badge.fury.io/py/trackplot.svg)](https://pypi.org/project/trackplot/)
32
32
  [![PyPI download](https://img.shields.io/pypi/dm/trackplot.svg)](https://pypi.org/project/trackplot/)
33
- [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/trackplot/README.html)
33
+ [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](https://bioconda.github.io/recipes/trackplot/README.html)
34
34
  [![Documentation Status](https://readthedocs.org/projects/trackplot/badge/?version=latest)](https://trackplot.readthedocs.io/en/latest/)
35
- [![License: BSD 3-Clause](https://img.shields.io/badge/License-BSD%20v3-clause.svg)](https://www.gnu.org/licenses/agpl-3.0)
35
+ [![License: BSD 3-Clause](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
36
36
  [![DOI](https://img.shields.io/badge/DOI-10.1101%2F2022.11.02.514803%20-blue)](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1011477)
37
37
 
38
38
  ---
@@ -41,11 +41,11 @@ Dynamic: license-file
41
41
 
42
42
  [Tutorials](https://trackplot.readthedocs.io/en/latest/)
43
43
 
44
- ## what is trackplot
44
+ ## What is trackplot
45
45
 
46
- trackplot is a tool for visualizing various next-generation sequencing (NGS) data, including DNA-seq, RNA-seq, single-cell RNA-seq and full-length sequencing datasets.
46
+ Trackplot is a tool for visualizing various next-generation sequencing (NGS) data, including DNA-seq, RNA-seq, single-cell RNA-seq and full-length sequencing datasets.
47
47
 
48
- ### Features of trackplot
48
+ ### Features
49
49
 
50
50
  1. Support various file formats as input
51
51
  2. Support strand-aware coverage plot
@@ -78,7 +78,7 @@ Trackplot is based on **Python3** `(python_requires='>=3.8')`,
78
78
  and we have simplified the installation process on the main page.
79
79
  For a more comprehensive installation guide, please refer to [this link](./docs/installation.md).
80
80
 
81
- ### For impatient
81
+ ### Quick start
82
82
 
83
83
  ```shell
84
84
  pip install trackplot
@@ -123,15 +123,23 @@ pip install trackplot
123
123
 
124
124
  ---
125
125
 
126
- 2. [AppImage](https://github.com/ygidtu/trackplot/releases) (Linux/WSL x86_64 platform only)
126
+ 2. [AppBundle](https://github.com/xplshn/pelf) (Linux/WSL x86_64 platform only)
127
127
 
128
128
  For a binary version of the tool and more comprehensive information, please visit [this link](./docs/installation.md).
129
129
 
130
130
  ```bash
131
- # example with version v0.3.5, please using your interested version according to your needs
132
- export VERSION=0.3.5
133
- chmod +x trackplot-${VERSION}-x86_64.AppImage
134
- ./trackplot-${VERSION}-x86_64.AppImage --help
131
+ # build the AppBundle from source (version auto-detected from pyproject.toml)
132
+ sh build-appbundle.sh
133
+
134
+ # the output filename and appbundle ID are printed at the end of the script
135
+ # package with pelf (see https://github.com/xplshn/pelf)
136
+ pelf \
137
+ --add-appdir "./trackplot.AppDir" \
138
+ --appbundle-id "$APPBUNDLE_ID" \
139
+ --output-to "$OUTPUT_FILE"
140
+
141
+ chmod +x "$OUTPUT_FILE"
142
+ ./"$OUTPUT_FILE" --help
135
143
  ```
136
144
 
137
145
  ---
@@ -170,20 +178,20 @@ trackplot --help
170
178
  <p>
171
179
 
172
180
 
173
- 1. [AppImage](https://github.com/ygidtu/trackplot/releases) (Linux/WSL x86_64 only)
181
+ 1. AppBundle (Linux/WSL x86_64 only)
182
+
183
+ Build the AppBundle following the [instructions above](#using-trackplot-by-a-command-line), then:
174
184
 
175
185
  ```bash
176
- # example with version v0.3.3, please using your interested version according to your needs
177
- export VERSION=0.3.3
178
- gunzip trackplot-${VERSION}-x86_64.AppImage
179
- chmod +x trackplot-${VERSION}-x86_64.AppImage
180
- ./trackplot-${VERSION}-x86_64.AppImage --help
186
+ # OUTPUT_FILE is printed by build-appbundle.sh
187
+ chmod +x "$OUTPUT_FILE"
188
+ ./"$OUTPUT_FILE" --help
181
189
 
182
190
  # startup webserver
183
- ./trackplot-${VERSION}-x86_64.AppImage --start-server --host 0.0.0.0 --port 5000 --plots ./plots
191
+ ./"$OUTPUT_FILE" --start-server --host 0.0.0.0 --port 5000 --plots ./plots
184
192
  ```
185
-
186
- **Note:** the `--plots` were required while using appimages
193
+
194
+ **Note:** the `--plots` were required while using appbundles
187
195
 
188
196
  ---
189
197
 
@@ -246,7 +254,7 @@ trackplot \
246
254
  -p 4
247
255
  ```
248
256
 
249
- if trackplot was installed by docker, here is the cmd
257
+ If trackplot was installed via docker, here is the cmd:
250
258
 
251
259
  ```bash
252
260
  ## The absolute path is required in Docker env.
@@ -280,17 +288,44 @@ docker run -v $PWD:$PWD -w $PWD --rm ygidtu/trackplot \
280
288
 
281
289
  ```
282
290
 
283
- here is the [output file](https://raw.githubusercontent.com/ygidtu/trackplot/main/example/example.png).
291
+ Here is the [output file](https://raw.githubusercontent.com/ygidtu/trackplot/main/example/example.png).
292
+
293
+
294
+ ## For AI agents (auto-install the trackplot skill)
295
+
296
+ This repo ships a ready-to-use **skill** that teaches an AI coding agent how to
297
+ invoke trackplot. When an agent is asked to create a trackplot/sashimi figure,
298
+ it should install this skill once (path relative to this file):
299
+
300
+ ```bash
301
+ # opencode / Claude Code style: point the skill manager at the bundled skill
302
+ cp -r skills/trackplot ~/.config/opencode/skills/trackplot # or ~/.claude/skills/trackplot
303
+ ```
304
+
305
+ Then the agent reads `skills/trackplot/SKILL.md` (plus
306
+ `skills/trackplot/references/config_files.md` and
307
+ `skills/trackplot/references/python_api.md`) and follows it to:
308
+
309
+ 1. Confirm the input region in `chr:start-end:strand` form and the annotation GTF.
310
+ 2. Build the matching config TSV(s) for the requested track type(s) (see the
311
+ `# filepath category label color` conventions).
312
+ 3. Run `trackplot -e <region> -r <gtf> --density <list.tsv> -o <out>.pdf` (or the
313
+ equivalent Python `Plot(...).set_region(...).add_density(...).plot(...)` chain).
314
+ 4. Verify the output exists; if `pybigwig`/`hicmatrix` are needed for bigWig/HiC,
315
+ install them first.
316
+
317
+ The skill is the single source of truth for trackplot usage; keep it in sync with
318
+ `docs/command.md` and `docs/interactive.md`.
284
319
 
285
320
 
286
321
  ## Questions
287
322
 
288
- Visit [issues](https://github.com/ygidtu/trackplot/issues) or
289
- contact [Yiming Zhang](https://github.com/ygidtu) or
323
+ Visit [issues](https://github.com/ygidtu/trackplot/issues) or
324
+ contact [Yiming Zhang](https://github.com/ygidtu) or
290
325
  [Ran Zhou](https://github.com/zhou-ran)
291
326
 
292
327
  ## Citation
293
328
 
294
- If you use the tool in your publication, please cite by
329
+ If you use trackplot in your publication, please cite:
295
330
 
296
- [Zhang Y, Zhou R, Liu L, et al. Trackplot: A flexible toolkit for combinatorial analysis of genomic data[J]. PLoS computational biology, 2023, 19(9): e1011477.](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1011477)
331
+ Zhang Y, Zhou R, Liu L, et al. Trackplot: A flexible toolkit for combinatorial analysis of genomic data. *PLoS Computational Biology*, 2023, 19(9): e1011477.
@@ -2,9 +2,9 @@
2
2
 
3
3
  [![PyPI version](https://badge.fury.io/py/trackplot.svg)](https://pypi.org/project/trackplot/)
4
4
  [![PyPI download](https://img.shields.io/pypi/dm/trackplot.svg)](https://pypi.org/project/trackplot/)
5
- [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/trackplot/README.html)
5
+ [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](https://bioconda.github.io/recipes/trackplot/README.html)
6
6
  [![Documentation Status](https://readthedocs.org/projects/trackplot/badge/?version=latest)](https://trackplot.readthedocs.io/en/latest/)
7
- [![License: BSD 3-Clause](https://img.shields.io/badge/License-BSD%20v3-clause.svg)](https://www.gnu.org/licenses/agpl-3.0)
7
+ [![License: BSD 3-Clause](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
8
8
  [![DOI](https://img.shields.io/badge/DOI-10.1101%2F2022.11.02.514803%20-blue)](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1011477)
9
9
 
10
10
  ---
@@ -13,11 +13,11 @@
13
13
 
14
14
  [Tutorials](https://trackplot.readthedocs.io/en/latest/)
15
15
 
16
- ## what is trackplot
16
+ ## What is trackplot
17
17
 
18
- trackplot is a tool for visualizing various next-generation sequencing (NGS) data, including DNA-seq, RNA-seq, single-cell RNA-seq and full-length sequencing datasets.
18
+ Trackplot is a tool for visualizing various next-generation sequencing (NGS) data, including DNA-seq, RNA-seq, single-cell RNA-seq and full-length sequencing datasets.
19
19
 
20
- ### Features of trackplot
20
+ ### Features
21
21
 
22
22
  1. Support various file formats as input
23
23
  2. Support strand-aware coverage plot
@@ -50,7 +50,7 @@ Trackplot is based on **Python3** `(python_requires='>=3.8')`,
50
50
  and we have simplified the installation process on the main page.
51
51
  For a more comprehensive installation guide, please refer to [this link](./docs/installation.md).
52
52
 
53
- ### For impatient
53
+ ### Quick start
54
54
 
55
55
  ```shell
56
56
  pip install trackplot
@@ -95,15 +95,23 @@ pip install trackplot
95
95
 
96
96
  ---
97
97
 
98
- 2. [AppImage](https://github.com/ygidtu/trackplot/releases) (Linux/WSL x86_64 platform only)
98
+ 2. [AppBundle](https://github.com/xplshn/pelf) (Linux/WSL x86_64 platform only)
99
99
 
100
100
  For a binary version of the tool and more comprehensive information, please visit [this link](./docs/installation.md).
101
101
 
102
102
  ```bash
103
- # example with version v0.3.5, please using your interested version according to your needs
104
- export VERSION=0.3.5
105
- chmod +x trackplot-${VERSION}-x86_64.AppImage
106
- ./trackplot-${VERSION}-x86_64.AppImage --help
103
+ # build the AppBundle from source (version auto-detected from pyproject.toml)
104
+ sh build-appbundle.sh
105
+
106
+ # the output filename and appbundle ID are printed at the end of the script
107
+ # package with pelf (see https://github.com/xplshn/pelf)
108
+ pelf \
109
+ --add-appdir "./trackplot.AppDir" \
110
+ --appbundle-id "$APPBUNDLE_ID" \
111
+ --output-to "$OUTPUT_FILE"
112
+
113
+ chmod +x "$OUTPUT_FILE"
114
+ ./"$OUTPUT_FILE" --help
107
115
  ```
108
116
 
109
117
  ---
@@ -142,20 +150,20 @@ trackplot --help
142
150
  <p>
143
151
 
144
152
 
145
- 1. [AppImage](https://github.com/ygidtu/trackplot/releases) (Linux/WSL x86_64 only)
153
+ 1. AppBundle (Linux/WSL x86_64 only)
154
+
155
+ Build the AppBundle following the [instructions above](#using-trackplot-by-a-command-line), then:
146
156
 
147
157
  ```bash
148
- # example with version v0.3.3, please using your interested version according to your needs
149
- export VERSION=0.3.3
150
- gunzip trackplot-${VERSION}-x86_64.AppImage
151
- chmod +x trackplot-${VERSION}-x86_64.AppImage
152
- ./trackplot-${VERSION}-x86_64.AppImage --help
158
+ # OUTPUT_FILE is printed by build-appbundle.sh
159
+ chmod +x "$OUTPUT_FILE"
160
+ ./"$OUTPUT_FILE" --help
153
161
 
154
162
  # startup webserver
155
- ./trackplot-${VERSION}-x86_64.AppImage --start-server --host 0.0.0.0 --port 5000 --plots ./plots
163
+ ./"$OUTPUT_FILE" --start-server --host 0.0.0.0 --port 5000 --plots ./plots
156
164
  ```
157
-
158
- **Note:** the `--plots` were required while using appimages
165
+
166
+ **Note:** the `--plots` were required while using appbundles
159
167
 
160
168
  ---
161
169
 
@@ -218,7 +226,7 @@ trackplot \
218
226
  -p 4
219
227
  ```
220
228
 
221
- if trackplot was installed by docker, here is the cmd
229
+ If trackplot was installed via docker, here is the cmd:
222
230
 
223
231
  ```bash
224
232
  ## The absolute path is required in Docker env.
@@ -252,17 +260,44 @@ docker run -v $PWD:$PWD -w $PWD --rm ygidtu/trackplot \
252
260
 
253
261
  ```
254
262
 
255
- here is the [output file](https://raw.githubusercontent.com/ygidtu/trackplot/main/example/example.png).
263
+ Here is the [output file](https://raw.githubusercontent.com/ygidtu/trackplot/main/example/example.png).
264
+
265
+
266
+ ## For AI agents (auto-install the trackplot skill)
267
+
268
+ This repo ships a ready-to-use **skill** that teaches an AI coding agent how to
269
+ invoke trackplot. When an agent is asked to create a trackplot/sashimi figure,
270
+ it should install this skill once (path relative to this file):
271
+
272
+ ```bash
273
+ # opencode / Claude Code style: point the skill manager at the bundled skill
274
+ cp -r skills/trackplot ~/.config/opencode/skills/trackplot # or ~/.claude/skills/trackplot
275
+ ```
276
+
277
+ Then the agent reads `skills/trackplot/SKILL.md` (plus
278
+ `skills/trackplot/references/config_files.md` and
279
+ `skills/trackplot/references/python_api.md`) and follows it to:
280
+
281
+ 1. Confirm the input region in `chr:start-end:strand` form and the annotation GTF.
282
+ 2. Build the matching config TSV(s) for the requested track type(s) (see the
283
+ `# filepath category label color` conventions).
284
+ 3. Run `trackplot -e <region> -r <gtf> --density <list.tsv> -o <out>.pdf` (or the
285
+ equivalent Python `Plot(...).set_region(...).add_density(...).plot(...)` chain).
286
+ 4. Verify the output exists; if `pybigwig`/`hicmatrix` are needed for bigWig/HiC,
287
+ install them first.
288
+
289
+ The skill is the single source of truth for trackplot usage; keep it in sync with
290
+ `docs/command.md` and `docs/interactive.md`.
256
291
 
257
292
 
258
293
  ## Questions
259
294
 
260
- Visit [issues](https://github.com/ygidtu/trackplot/issues) or
261
- contact [Yiming Zhang](https://github.com/ygidtu) or
295
+ Visit [issues](https://github.com/ygidtu/trackplot/issues) or
296
+ contact [Yiming Zhang](https://github.com/ygidtu) or
262
297
  [Ran Zhou](https://github.com/zhou-ran)
263
298
 
264
299
  ## Citation
265
300
 
266
- If you use the tool in your publication, please cite by
301
+ If you use trackplot in your publication, please cite:
267
302
 
268
- [Zhang Y, Zhou R, Liu L, et al. Trackplot: A flexible toolkit for combinatorial analysis of genomic data[J]. PLoS computational biology, 2023, 19(9): e1011477.](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1011477)
303
+ Zhang Y, Zhou R, Liu L, et al. Trackplot: A flexible toolkit for combinatorial analysis of genomic data. *PLoS Computational Biology*, 2023, 19(9): e1011477.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "trackplot"
3
- version = "0.6.6"
3
+ version = "0.7.1"
4
4
  description = "The trackplot is a tool for visualizing various next-generation sequencing (NGS) data, including DNA-seq, RNA-seq, single-cell RNA-seq and full-length sequencing datasets. https://sashimi.readthedocs.io/"
5
5
  authors = [
6
6
  { name = "ygidtu", email = "ygidtu@gmail.com" }
@@ -136,20 +136,30 @@ class Reader(object):
136
136
  yield read, __get_strand__(read, library=library)
137
137
 
138
138
  @classmethod
139
- def read_gtf(cls, path: str, region: GenomicLoci, bed: bool = False):
139
+ def read_gtf(
140
+ cls,
141
+ path: str,
142
+ region: GenomicLoci,
143
+ bed: bool = False,
144
+ fmt: Optional[str] = None,
145
+ ):
146
+ if bed:
147
+ parser = pysam.asBed()
148
+ elif fmt == "gff":
149
+ parser = pysam.asGFF3()
150
+ else:
151
+ parser = pysam.asGTF()
140
152
  with pysam.TabixFile(path) as r:
141
153
  try:
142
154
  iter_ = r.fetch(
143
155
  region.chromosome,
144
156
  region.start,
145
157
  region.end,
146
- parser=pysam.asGTF() if not bed else pysam.asBed(),
158
+ parser=parser,
147
159
  )
148
160
  except ValueError:
149
161
  try:
150
- iter_ = cls.__modify_chrom__(
151
- region, r, parser=pysam.asGTF() if not bed else pysam.asBed()
152
- )
162
+ iter_ = cls.__modify_chrom__(region, r, parser=parser)
153
163
  except ValueError as err:
154
164
  logger.debug("please check the input region and gtf files")
155
165
  logger.error(err)
@@ -7,7 +7,7 @@ Changelog:
7
7
  1. remove attributes
8
8
  """
9
9
 
10
- from typing import List
10
+ from typing import List, Optional
11
11
 
12
12
  from trackplot.base.GenomicLoci import GenomicLoci
13
13
 
@@ -30,6 +30,7 @@ class Transcript(GenomicLoci):
30
30
  "domain_type",
31
31
  "domain_description",
32
32
  "plot_intron",
33
+ "coding_intervals",
33
34
  ]
34
35
 
35
36
  def __init__(
@@ -47,6 +48,7 @@ class Transcript(GenomicLoci):
47
48
  domain_category: str = "",
48
49
  domain_type: str = "",
49
50
  domain_description: str = "",
51
+ coding_intervals: Optional[List] = None,
50
52
  ):
51
53
  """
52
54
  :param chromosome:
@@ -62,6 +64,7 @@ class Transcript(GenomicLoci):
62
64
  :param domain_category: category of domain
63
65
  :param domain_description: description of domain
64
66
  :param domain_type: if category is protein, the type information of the given domain
67
+ :param coding_intervals: list of (start, end) absolute genomic coordinates of the coding region (CDS), used to distinguish UTR from CDS in the annotation plot
65
68
  """
66
69
 
67
70
  super().__init__(chromosome=chromosome, start=start, end=end, strand=strand)
@@ -74,6 +77,7 @@ class Transcript(GenomicLoci):
74
77
  self.domain_category = domain_category
75
78
  self.domain_type = domain_type
76
79
  self.domain_description = domain_description
80
+ self.coding_intervals = coding_intervals if coding_intervals is not None else []
77
81
 
78
82
  @property
79
83
  def exon_list(self):
@@ -489,6 +489,8 @@ def _handle_igv(p, path, kwargs):
489
489
  label=f.label,
490
490
  exon_color=f.color,
491
491
  intron_color=f.color,
492
+ show_utr=kwargs["show_utr"],
493
+ utr_color=kwargs["utr_color"],
492
494
  features=igv_features or None,
493
495
  font_size=kwargs["font_size"],
494
496
  n_y_ticks=kwargs["n_y_ticks"],
@@ -787,6 +789,22 @@ def _add_interval(p, f):
787
789
  help="The scale of exon",
788
790
  show_default=True,
789
791
  )
792
+ @optgroup.option(
793
+ "--show-utr",
794
+ is_flag=True,
795
+ type=click.BOOL,
796
+ show_default=True,
797
+ help="Whether to distinguish untranslated regions (UTR) from coding regions (CDS) "
798
+ "inside exons. Requires a GTF/GFF with CDS features. UTR parts are drawn in "
799
+ "--utr-color while CDS parts keep --ref-color.",
800
+ )
801
+ @optgroup.option(
802
+ "--utr-color",
803
+ type=click.STRING,
804
+ default="#0099CC",
805
+ show_default=True,
806
+ help="The fill color of untranslated regions (UTR) in the annotation and IGV-like tracks.",
807
+ )
790
808
  @optgroup.group("Density plot settings")
791
809
  @optgroup.option(
792
810
  "--density",
@@ -1342,6 +1360,8 @@ def main(**kwargs):
1342
1360
  local_domain=kwargs["local_domain"],
1343
1361
  domain_include=kwargs["domain_include"],
1344
1362
  domain_exclude=kwargs["domain_exclude"],
1363
+ show_utr=kwargs["show_utr"],
1364
+ utr_color=kwargs["utr_color"],
1345
1365
  )
1346
1366
  elif key in _CATEGORY_HANDLERS:
1347
1367
  _CATEGORY_HANDLERS[key](
@@ -305,6 +305,18 @@ __PARAMS__ = {
305
305
  "default": "0.3",
306
306
  "note": "The exon width of current track",
307
307
  },
308
+ {
309
+ "key": "show_utr",
310
+ "annotation": "bool",
311
+ "default": "false",
312
+ "note": "Whether to distinguish untranslated regions (UTR) from coding regions (CDS) inside exons. Requires an annotation with CDS features loaded in the same plot.",
313
+ },
314
+ {
315
+ "key": "utr_color",
316
+ "annotation": "color",
317
+ "default": "#0099CC",
318
+ "note": "The fill color of untranslated regions (UTR) in the IGV-like track.",
319
+ },
308
320
  ],
309
321
  "add_interval": [
310
322
  {
@@ -542,6 +554,18 @@ __PARAMS__ = {
542
554
  "default": "#000000",
543
555
  "note": "The color of exons",
544
556
  },
557
+ {
558
+ "key": "show_utr",
559
+ "annotation": "bool",
560
+ "default": "false",
561
+ "note": "Whether to distinguish untranslated regions (UTR) from coding regions (CDS) inside exons. Requires a GTF/GFF with CDS features; UTR parts are drawn in --utr-color while CDS parts keep the exon color.",
562
+ },
563
+ {
564
+ "key": "utr_color",
565
+ "annotation": "color",
566
+ "default": "#0099CC",
567
+ "note": "The fill color of untranslated regions (UTR) in the annotation track.",
568
+ },
545
569
  {
546
570
  "key": "font_size",
547
571
  "annotation": "int",