Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
profileview
Overview
Overview
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Edoardo SARTI
profileview
Commits
3fc1e4da
Commit
3fc1e4da
authored
Jul 19, 2019
by
Riccardo Vicedomini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skip logo generation if there are no conserved positions only for the appropriate logo
parent
cfb5aa85
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
25 deletions
+22
-25
parseHHR.py
scripts/parseHHR.py
+22
-25
No files found.
scripts/parseHHR.py
View file @
3fc1e4da
...
...
@@ -241,32 +241,29 @@ def main( argv = None ):
#queryConsensus = [ qc for i,qc in enumerate(hhm.consensus) ] # if hhm.conserved[i] ]
#queryCovered = BitVector(size=len(hhm.master_seq))
# skip if no conserved positions
if
hhm
.
conserved
.
count_bits
()
<=
0
:
continue
# output sequence logo restricted to conserved positions
with
open
(
"{}/{}.fas"
.
format
(
args
.
fasDir
,
queryName
),
'r'
)
as
fas
:
fas_str
=
""
for
rec
in
SeqIO
.
parse
(
fas
,
'fasta'
):
seq
=
''
.
join
([
c
for
i
,
c
in
enumerate
(
rec
.
seq
)
if
hhm
.
conserved
[
i
]
])
fas_str
+=
">{}
\n
{}
\n
"
.
format
(
rec
.
id
,
seq
)
loptions
=
weblogo
.
LogoOptions
(
logo_title
=
"{} ({})"
.
format
(
hhmNameDict
[
queryName
],
queryName
),
unit_name
=
"bits"
,
yaxis_label
=
""
,
#show_yaxis=False,
color_scheme
=
weblogo
.
std_color_schemes
[
"chemistry"
],
annotate
=
[
i
+
1
for
i
,
b
in
enumerate
(
hhm
.
conserved
)
if
b
],
rotate_numbers
=
True
,
stack_aspect_ratio
=
3
,
stack_width
=
weblogo
.
std_sizes
[
"large"
],
stacks_per_line
=
hhm
.
conserved
.
count_bits
(),
show_fineprint
=
False
)
ldata
=
weblogo
.
LogoData
.
from_seqs
(
weblogo
.
read_seq_data
(
io
.
StringIO
(
fas_str
))
)
lformat
=
weblogo
.
LogoFormat
(
ldata
,
loptions
)
with
open
(
os
.
path
.
join
(
args
.
outDir
,
"{}.conserved.pdf"
.
format
(
hhmNameDict
[
queryName
])),
'wb'
)
as
ofh
:
ofh
.
write
(
weblogo
.
pdf_formatter
(
ldata
,
lformat
)
)
if
hhm
.
conserved
.
count_bits
()
>
0
:
with
open
(
"{}/{}.fas"
.
format
(
args
.
fasDir
,
queryName
),
'r'
)
as
fas
:
fas_str
=
""
for
rec
in
SeqIO
.
parse
(
fas
,
'fasta'
):
seq
=
''
.
join
([
c
for
i
,
c
in
enumerate
(
rec
.
seq
)
if
hhm
.
conserved
[
i
]
])
fas_str
+=
">{}
\n
{}
\n
"
.
format
(
rec
.
id
,
seq
)
loptions
=
weblogo
.
LogoOptions
(
logo_title
=
"{} ({})"
.
format
(
hhmNameDict
[
queryName
],
queryName
),
unit_name
=
"bits"
,
yaxis_label
=
""
,
#show_yaxis=False,
color_scheme
=
weblogo
.
std_color_schemes
[
"chemistry"
],
annotate
=
[
i
+
1
for
i
,
b
in
enumerate
(
hhm
.
conserved
)
if
b
],
rotate_numbers
=
True
,
stack_aspect_ratio
=
3
,
stack_width
=
weblogo
.
std_sizes
[
"large"
],
stacks_per_line
=
hhm
.
conserved
.
count_bits
(),
show_fineprint
=
False
)
ldata
=
weblogo
.
LogoData
.
from_seqs
(
weblogo
.
read_seq_data
(
io
.
StringIO
(
fas_str
))
)
lformat
=
weblogo
.
LogoFormat
(
ldata
,
loptions
)
with
open
(
os
.
path
.
join
(
args
.
outDir
,
"{}.conserved.pdf"
.
format
(
hhmNameDict
[
queryName
])),
'wb'
)
as
ofh
:
ofh
.
write
(
weblogo
.
pdf_formatter
(
ldata
,
lformat
)
)
with
open
(
"{}/{}.fas"
.
format
(
args
.
fasDir
,
queryName
),
'r'
)
as
fas
:
loptions
=
weblogo
.
LogoOptions
(
...
...
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