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
3602a940
Commit
3602a940
authored
3 weeks ago
by
Bartosz Bartmanski
Browse files
Options
Downloads
Patches
Plain Diff
Added a bit more information in the output tables of InsertsDict class and streamlit app.
parent
ee445b70
No related branches found
Branches containing commit
Tags
0.3.4
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plotting_on_genome/inserts_dict.py
+3
-1
3 additions, 1 deletion
src/plotting_on_genome/inserts_dict.py
streamlit_app.py
+38
-32
38 additions, 32 deletions
streamlit_app.py
with
41 additions
and
33 deletions
src/plotting_on_genome/inserts_dict.py
+
3
−
1
View file @
3602a940
...
...
@@ -321,6 +321,7 @@ class InsertsDict(object):
x
.
strand
,
len
(
x
),
x
.
coverage
,
x
.
matched
,
)
for
x
in
self
.
get
(
insert_type
=
insert_type
,
filter_threshold
=
filter_threshold
...
...
@@ -328,13 +329,14 @@ class InsertsDict(object):
],
columns
=
(
"
seq_id
"
,
"
NCBI_accession_number
"
,
"
hit_id
"
,
"
insert_idx
"
,
"
insert_start
"
,
"
insert_end
"
,
"
insert_strand
"
,
"
insert_length
"
,
"
insert_coverage
"
,
"
insert_matched
"
,
),
)
...
...
This diff is collapsed.
Click to expand it.
streamlit_app.py
+
38
−
32
View file @
3602a940
...
...
@@ -14,9 +14,6 @@ import plotting_on_genome as pog
if
"
stage
"
not
in
st
.
session_state
:
st
.
session_state
.
stage
=
0
if
"
insert_type
"
not
in
st
.
session_state
:
st
.
session_state
.
insert_type
=
"
both
"
if
"
workdir
"
not
in
st
.
session_state
:
st
.
session_state
.
workdir
=
None
...
...
@@ -112,10 +109,6 @@ def get_main_inputs():
fwd_suf
=
st
.
text_input
(
"
Forward suffix:
"
,
"
_F
"
,
key
=
"
fwd_suf
"
)
rev_suf
=
st
.
text_input
(
"
Reverse suffix:
"
,
"
_R
"
,
key
=
"
rev_suf
"
)
st
.
session_state
.
insert_type
=
st
.
selectbox
(
"
insert types:
"
,
[
"
both
"
,
"
matched
"
,
"
unmatched
"
]
)
if
args
.
workdir
:
st
.
session_state
.
workdir
=
st
.
text_input
(
"
workdir
"
,
"
Output
"
)
...
...
@@ -142,7 +135,7 @@ def convert_df(df, **kwargs):
def
show_results
():
inserts_all
=
st
.
session_state
.
pipeline
insert_type
=
st
.
se
ssion_state
.
i
nsert
_
type
insert_type
=
st
.
se
lectbox
(
"
I
nsert
type
:
"
,
[
"
both
"
,
"
matched
"
,
"
unmatched
"
])
filter_threshold
=
st
.
slider
(
"
Filter threshold:
"
,
0.0
,
1.0
,
0.7
)
...
...
@@ -155,32 +148,40 @@ def show_results():
)
params
=
dict
(
insert_type
=
insert_type
,
filter_threshold
=
filter_threshold
)
df_inserts
=
inserts_all
.
to_dataframe
(
**
params
)
df_genes
=
inserts_all
.
genes_to_dataframe
(
**
params
,
buffer
=
buffer
)
if
inserts_all
is
not
None
:
st
.
download_button
(
label
=
"
Download all inserts as CSV
"
,
data
=
df_inserts
.
pipe
(
convert_df
,
index
=
False
),
file_name
=
"
inserts.csv
"
,
mime
=
"
text/csv
"
,
use_container_width
=
True
,
)
df_inserts
=
inserts_all
.
to_dataframe
(
**
params
)
df_genes
=
inserts_all
.
genes_to_dataframe
(
**
params
,
buffer
=
buffer
)
st
.
download_button
(
label
=
"
Download all genes as CSV
"
,
data
=
df_genes
.
pipe
(
convert_df
,
index
=
False
),
file_name
=
"
genes.csv
"
,
mime
=
"
text/csv
"
,
use_
cont
ainer_width
=
True
,
)
counts
=
df_inserts
.
groupby
(
"
insert_matched
"
).
insert_matched
.
count
().
to_dict
()
counts
=
{
val
:
counts
[
val
]
if
val
in
counts
else
0
for
val
in
(
True
,
False
)}
st
.
write
(
f
"
Number of inserts:
\n
"
f
"
- matched:
{
counts
[
True
]
}
\n
"
f
"
- unmatched:
{
co
u
nt
s
[
False
]
}
"
)
option
=
st
.
selectbox
(
"
plot type:
"
,
[
"
plot inserts
"
,
"
plot genome
"
,
"
plot insert dists
"
],
None
,
)
st
.
download_button
(
label
=
"
Download all inserts as CSV
"
,
data
=
df_inserts
.
pipe
(
convert_df
,
index
=
False
),
file_name
=
"
inserts.csv
"
,
mime
=
"
text/csv
"
,
use_container_width
=
True
,
)
if
inserts_all
is
not
None
:
st
.
download_button
(
label
=
"
Download all genes as CSV
"
,
data
=
df_genes
.
pipe
(
convert_df
,
index
=
False
),
file_name
=
"
genes.csv
"
,
mime
=
"
text/csv
"
,
use_container_width
=
True
,
)
option
=
st
.
selectbox
(
"
plot type:
"
,
[
"
plot inserts
"
,
"
plot genome
"
,
"
plot insert dists
"
],
None
,
)
if
option
==
"
plot inserts
"
:
...
...
@@ -202,6 +203,11 @@ def show_results():
st
.
write
(
df_genes
.
query
(
"
seq_id == @seq_id
"
))
for
insert
in
inserts
:
st
.
write
(
f
"
Insert
{
insert
.
idx
}
:
"
f
"
coverage =
{
insert
.
coverage
:
.
2
f
}
,
"
f
"
matched =
{
insert
.
matched
}
"
)
fig
,
axs
=
plt
.
subplots
(
2
,
1
,
figsize
=
(
10
,
6
),
height_ratios
=
[
3
,
5
])
fig
.
suptitle
(
f
"
Insert
{
insert
.
idx
}
"
)
axs
=
insert
.
plot
(
...
...
@@ -217,11 +223,11 @@ def show_results():
elif
option
==
"
plot genome
"
:
st
.
write
(
df_inserts
)
labels
=
st
.
toggle
(
"
Labels
"
)
insert_idxs
=
None
if
st
.
toggle
(
"
Plot inserts
"
,
True
)
else
[]
st
.
write
(
df_inserts
)
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
10
,
10
*
(
1
+
2
*
labels
)))
ax
=
inserts_all
.
plot
(
insert_idxs
,
show_labels
=
labels
,
ax
=
ax
,
**
params
)
st
.
pyplot
(
fig
,
use_container_width
=
True
)
...
...
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