Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PlottingOnGenome
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zimmermann-Kogadeeva Group
PlottingOnGenome
Commits
53c9f6ff
Commit
53c9f6ff
authored
2 weeks ago
by
Bartosz Jan Bartmanski
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev'
parents
c86234c4
38a092b1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plotting_on_genome/insert.py
+19
-11
19 additions, 11 deletions
src/plotting_on_genome/insert.py
with
19 additions
and
11 deletions
src/plotting_on_genome/insert.py
+
19
−
11
View file @
53c9f6ff
...
...
@@ -5,6 +5,7 @@ from dna_features_viewer import (
GraphicFeature
,
GraphicRecord
,
)
from
matplotlib.colorbar
import
ColorbarBase
from
matplotlib.colors
import
LinearSegmentedColormap
from
.helper
import
shift_feature
...
...
@@ -116,12 +117,7 @@ class Insert(object):
)
def
_get_graphic_records_insert
(
self
,
buffer
,
col1
,
col2
,
feature_types
=
None
,
colorbar
=
False
,
self
,
buffer
,
col1
,
col2
,
feature_types
=
None
,
cmap
=
None
):
genes
=
self
.
get_genes
(
buffer
)
if
feature_types
is
None
:
...
...
@@ -148,8 +144,7 @@ class Insert(object):
# Create graphic objects for all the genes and CDSes using
# dna_features_viewer.BiopythonTranslator()
if
colorbar
:
cmap
=
LinearSegmentedColormap
.
from_list
(
"
custom
"
,
[
col1
,
col2
])
if
cmap
is
not
None
:
for
i
,
gene
in
enumerate
(
genes
):
genes
[
i
].
qualifiers
[
"
color
"
]
=
cmap
(
self
.
_get_gene_coverage
(
gene
))
...
...
@@ -169,8 +164,8 @@ class Insert(object):
def
plot
(
self
,
buffer
=
4000
,
col1
=
"
#
8DDEF7
"
,
col2
=
"
#
CFFCCC
"
,
col1
=
"
#
ebf3ed
"
,
col2
=
"
#
2e8b57
"
,
feature_types
=
None
,
colorbar
=
False
,
axs
=
None
,
...
...
@@ -178,8 +173,12 @@ class Insert(object):
**
kwargs
,
):
cmap
=
None
if
colorbar
:
cmap
=
LinearSegmentedColormap
.
from_list
(
"
custom
"
,
[
col1
,
col2
])
seqs
,
hits
=
self
.
_get_graphic_records_insert
(
buffer
,
col1
,
col2
,
feature_types
,
c
olorbar
buffer
,
col1
,
col2
,
feature_types
,
c
map
)
if
"
figsize
"
not
in
kwargs
:
kwargs
[
"
figsize
"
]
=
(
10
,
8
)
...
...
@@ -188,12 +187,21 @@ class Insert(object):
# Default values for figure size and create the figure
if
axs
is
None
:
fig
,
axs
=
plt
.
subplots
(
2
,
1
,
**
kwargs
)
else
:
fig
=
axs
[
0
].
get_figure
()
assert
len
(
axs
)
==
2
# Create a new graphic object for query sequence
_
=
seqs
.
plot
(
ax
=
axs
[
0
])
_
=
hits
.
plot
(
ax
=
axs
[
1
])
if
colorbar
:
ax_cb
=
fig
.
add_axes
([
0.9
,
0.1
,
0.02
,
0.8
])
fig
.
subplots_adjust
(
left
=
0.1
,
right
=
0.85
)
ColorbarBase
(
ax_cb
,
cmap
=
cmap
,
orientation
=
"
vertical
"
,
label
=
"
gene coverage
"
)
fig_axvline
(
axs
,
self
.
start
)
fig_axvline
(
axs
,
self
.
end
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment