Commit cfb5aa85 by Riccardo Vicedomini

skip logo generation if there are no conserved positions

parent 1e4024b8
......@@ -241,11 +241,16 @@ 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'):
fas_str += ">{}\n{}\n".format(rec.id,''.join([ c for i,c in enumerate(rec.seq) if hhm.conserved[i] ]))
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",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment