def _write_fasta( seq, linelength, hea ): output = ['>', seq.name] if hea and seq.hea: output.append( ' ' + seq.hea) output.append('\n') if linelength: output.append( wrap(seq.seq, linelength) ) else: output.append( seq.seq + '\n') return ''.join(output)
def _writeEMBLLine(key, val, linelength ): lmar = 5 fstr = '%-' + `lmar` + 's%s' strList = [] strLen = linelength-lmar if not val.strip(): strList.append( fstr %(key, ' ') ) else: # word wrap val valLines = wrap(val, strLen, output='list') for line in valLines: strList.append( fstr %(key, line) ) return os.linesep.join(strList)
def print_align(q_al_str, t_al_str, width): for q,t in zip(wrap(q_al_str,width,'list'), wrap(t_al_str,width,'list')): print q print t print ''
def __repr__(self): """Special method to return string representation of the whole sequence object when `obj` or repr(obj) is called""" return """>%s%s\n%s""" % (self.name, self.hea, wrap(self.seq, 60))