def PrintAlignedSequences( sequence1, sequence2, chain = None, format="modeller" ):

    ## align sequences by identity

    seq_row = alignlib.makeSequence( sequence1 )
    seq_col = alignlib.makeSequence( sequence2 )
    alignator = alignlib.makeAlignatorFullDP( -0.0, -0.0 )
    map_row2col = alignlib.makeAlignataVector()
    alignator.Align( seq_row, seq_col, map_row2col )

    lines = string.split(alignlib.writePairAlignment( seq_row, seq_col, map_row2col ), "\n")

    if format == "modeller":
        
        first_res, sequence, last_res = string.split( lines[0], "\t" )
        
        print ">P1;structure"  
        print "structureX: %s : %s : %s : %s : %s : : : : " % ("structure", first_res, "" , last_res, "" )
        print "%s*" % sequence

        first_res, sequence, last_res = string.split( lines[1], "\t" )
        
        print ">P1;sequence"
        print ("sequence" , first_res, "", last_res, "") % "sequence:%s : %s : %s : %s : %s : : : : "
        print "%s*" % sequence
    else:
        print lines
dataset/ETHPy150Open CGATOxford/cgat/legacy/pdb2sequence.py/PrintAlignedSequences/swapped operands of `%`