Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
binfpy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
opensource
binfpy
Commits
934c2bff
Commit
934c2bff
authored
Jul 30, 2016
by
Mikael Boden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
L3
parent
d56ac8d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
sequence.py
sequence.py
+16
-8
No files found.
sequence.py
View file @
934c2bff
...
...
@@ -643,13 +643,15 @@ class Alignment():
distmat
[
i
,
j
]
=
distmat
[
j
,
i
]
=
dist
return
distmat
def
writeHTML
(
self
,
filename
):
def
writeHTML
(
self
,
filename
=
None
):
""" Generate HTML that displays the alignment in color.
Requires that the alphabet is annotated with the label 'html-color' (see Sequence.annotateSym)
and that each symbol maps to a text string naming the color, e.g. 'blue'
"""
fh
=
open
(
filename
,
'w'
)
fh
.
write
(
'<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
\n
<title>Sequence Alignment</title>
\n
</head><body><pre>
\n
'
)
if
filename
==
None
:
htmlstr
=
'<pre>
\n
'
else
:
htmlstr
=
'<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
\n
<title>Sequence Alignment</title>
\n
</head><body><pre>
\n
'
maxNameLength
=
self
.
getnamelen
()
html
=
''
.
ljust
(
maxNameLength
)
+
' '
for
i
in
range
(
self
.
alignlen
-
1
):
...
...
@@ -658,7 +660,7 @@ class Alignment():
else
:
html
+=
' '
html
+=
'
%
s
\n
'
%
(
self
.
alignlen
)
fh
.
write
(
html
)
htmlstr
+=
html
if
self
.
alignlen
>
10
:
html
=
''
.
ljust
(
maxNameLength
)
+
' '
for
i
in
range
(
self
.
alignlen
-
1
):
...
...
@@ -667,7 +669,7 @@ class Alignment():
else
:
html
+=
' '
html
+=
'
\n
'
fh
.
write
(
html
)
htmlstr
+=
html
for
seq
in
self
.
seqs
:
html
=
seq
.
name
.
ljust
(
maxNameLength
)
+
' '
for
sym
in
seq
:
...
...
@@ -676,9 +678,15 @@ class Alignment():
color
=
'white'
html
+=
'<font style="BACKGROUND-COLOR:
%
s">
%
s</font>'
%
(
color
,
sym
)
html
+=
'
\n
'
fh
.
write
(
html
)
fh
.
write
(
'</pre></body></html>
\n
'
)
fh
.
close
()
htmlstr
+=
html
htmlstr
+=
'<pre>'
if
filename
:
fh
=
open
(
filename
,
'w'
)
fh
.
write
(
htmlstr
)
fh
.
write
(
'</body></html>
\n
'
)
fh
.
close
()
else
:
return
htmlstr
def
saveConsensus
(
aln
,
theta1
=
0.99
,
theta2
=
0.01
,
countgaps
=
False
,
consensus
=
True
,
filename
=
None
):
""" Display a table with rows for each alignment column, showing
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment