Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
QuaC
Manage
Activity
Members
Labels
Plan
Issues
15
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
center-for-computational-genomics-and-data-science
public
QuaC
Commits
1ddb554e
Commit
1ddb554e
authored
3 years ago
by
Manavalan Gajapathy
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: changes mosdepth's javascript path
parent
aef2903b
No related branches found
No related tags found
1 merge request
!2
QC under one umbrella (well mostly) under QuaC
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mosdepth/v0.3.1/plot-dist.py
+40
-23
40 additions, 23 deletions
src/mosdepth/v0.3.1/plot-dist.py
with
40 additions
and
23 deletions
src/mosdepth/v0.3.1/plot-dist.py
+
40
−
23
View file @
1ddb554e
...
...
@@ -19,9 +19,12 @@ def main():
for
chrom
,
data
in
it
.
groupby
(
gen
,
itemgetter
(
0
)):
if
chrom
.
startswith
(
"
GL
"
):
continue
if
"
Un
"
in
chrom
:
continue
if
"
random
"
in
chrom
or
"
HLA
"
in
chrom
:
continue
if
chrom
.
endswith
(
"
alt
"
):
continue
if
"
Un
"
in
chrom
:
continue
if
"
random
"
in
chrom
or
"
HLA
"
in
chrom
:
continue
if
chrom
.
endswith
(
"
alt
"
):
continue
chroms
[
chrom
]
=
True
xs
,
ys
=
[],
[]
v50
=
0
...
...
@@ -45,16 +48,19 @@ def main():
xs
=
xs
[::
2
]
ys
=
ys
[::
2
]
traces
[
chrom
].
append
({
'
x
'
:
[
round
(
x
,
3
)
for
x
in
xs
],
'
y
'
:
[
round
(
y
,
3
)
for
y
in
ys
],
'
mode
'
:
'
lines
'
,
'
name
'
:
sample
+
(
"
(%.1f)
"
%
float
(
v50
))
})
traces
[
chrom
].
append
(
{
"
x
"
:
[
round
(
x
,
3
)
for
x
in
xs
],
"
y
"
:
[
round
(
y
,
3
)
for
y
in
ys
],
"
mode
"
:
"
lines
"
,
"
name
"
:
sample
+
(
"
(%.1f)
"
%
float
(
v50
)),
}
)
# reasoning for js path change - https://github.com/brentp/mosdepth/issues/137
tmpl
=
"""
<html>
<head>
<script src=
"
https://cdn.plot.ly/plotly-
latest
.min.js
"
></script>
<script src=
"
https://cdn.plot.ly/plotly-
1.44.0
.min.js
"
></script>
<style>
div {
width: 800px;
...
...
@@ -88,13 +94,23 @@ def main():
tmpl
=
string
.
Template
(
tmpl
)
try
:
with
open
(
args
.
output
,
"
w
"
)
as
html
:
divs
=
"
\n
"
.
join
(
"
<{div}>{chrom}</{div}><div id=
'
plot-div-{chrom}
'
></div><hr/>
"
.
format
(
chrom
=
c
,
div
=
"
h2
"
if
c
==
"
total
"
else
"
b
"
)
for
c
in
chroms
)
html
.
write
(
tmpl
.
substitute
(
showlegend
=
"
true
"
if
len
(
sys
.
argv
[
1
:])
<
20
else
"
false
"
,
plot_divs
=
divs
))
divs
=
"
\n
"
.
join
(
"
<{div}>{chrom}</{div}><div id=
'
plot-div-{chrom}
'
></div><hr/>
"
.
format
(
chrom
=
c
,
div
=
"
h2
"
if
c
==
"
total
"
else
"
b
"
)
for
c
in
chroms
)
html
.
write
(
tmpl
.
substitute
(
showlegend
=
"
true
"
if
len
(
sys
.
argv
[
1
:])
<
20
else
"
false
"
,
plot_divs
=
divs
)
)
for
chrom
in
chroms
:
html
.
write
(
string
.
Template
(
chr_tmpl
).
substitute
(
chrom
=
chrom
,
data
=
json
.
dumps
(
traces
[
chrom
])))
html
.
write
(
string
.
Template
(
chr_tmpl
).
substitute
(
chrom
=
chrom
,
data
=
json
.
dumps
(
traces
[
chrom
])
)
)
html
.
write
(
footer
)
except
FileNotFoundError
:
sys
.
exit
(
"
ERROR: failed creating output file, does the path exist?
"
)
...
...
@@ -102,14 +118,15 @@ def main():
def
get_args
():
parser
=
ArgumentParser
(
description
=
"
Creates html plots from mosdepth results.
"
)
parser
.
add_argument
(
"
-o
"
,
"
--output
"
,
default
=
"
dist.html
"
,
help
=
"
path and name of output file. Directories must exist.
"
)
parser
.
add_argument
(
"
input
"
,
nargs
=
'
+
'
,
help
=
"
the dist file(s) to use for plotting
"
)
parser
.
add_argument
(
"
-o
"
,
"
--output
"
,
default
=
"
dist.html
"
,
help
=
"
path and name of output file. Directories must exist.
"
,
)
parser
.
add_argument
(
"
input
"
,
nargs
=
"
+
"
,
help
=
"
the dist file(s) to use for plotting
"
)
return
parser
.
parse_args
()
if
__name__
==
'
__main__
'
:
if
__name__
==
"
__main__
"
:
main
()
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