def align(s1,s2,test=False,seqfmt='dna',
         psm=None,pmm=None,pgo=None,pge=None,
         matrix=None,
         outscore=False):
    """
    Creates pairwise local alignment between seqeunces.
    Get the visualization and alignment scores.
    :param s1: seqeunce 1
    :param s2: seqeunce 2    
    
    REF: http://biopython.org/DIST/docs/api/Bio.pairwise2-module.html
    The match parameters are:

    CODE  DESCRIPTION
    x     No parameters. Identical characters have score of 1, otherwise 0.
    m     A match score is the score of identical chars, otherwise mismatch
          score.
    d     A dictionary returns the score of any pair of characters.
    c     A callback function returns scores.
    The gap penalty parameters are:

    CODE  DESCRIPTION
    x     No gap penalties.
    s     Same open and extend gap penalties for both sequences.
    d     The sequences have different open and extend gap penalties.
    c     A callback function returns the gap penalties.  
    --
    DNA: 
    localms: psm=2,pmm=0.5,pgo=-3,pge=-1):
    Protein:
    http://resources.qiagenbioinformatics.com/manuals/clcgenomicsworkbench/650/Use_scoring_matrices.html
    """
    import operator
    from Bio import pairwise2
    if seqfmt=='dna':
        if any([p is None for p in [psm,pmm,pgo,pge]]):
            alignments = pairwise2.align.localxx(s1.upper(),s2.upper())
        else:
            alignments = pairwise2.align.localms(s1.upper(),s2.upper(),psm,pmm,pgo,pge)
    elif seqfmt=='protein':
        from Bio.pairwise2 import format_alignment
        from Bio.SubsMat import MatrixInfo
        if matrix is None:
            matrix = MatrixInfo.blosum62
        alignments =pairwise2.align.globaldx(s1, s2, matrix)
#         print(format_alignment(*a))        
    if test:
        print(alignments)
    alignsymb=np.nan
    score=np.nan
    sorted_alignments = sorted(alignments, key=operator.itemgetter(2))
    for a in alignments:
        alignstr=pairwise2.format_alignment(*a)
        alignsymb=alignstr.split('\n')[1]
        score=a[2]
        if test:
            print(alignstr)
        break
    if not outscore:
        return alignsymb.replace(' ','-'),score
    else:
        return score
Creates pairwise local alignment between seqeunces.
    Get the visualization and alignment scores.
    :param s1: seqeunce 1
    :param s2: seqeunce 2    
    
    REF: http://biopython.org/DIST/docs/api/Bio.pairwise2-module.html
    The match parameters are:

    CODE  DESCRIPTION
    x     No parameters. Identical characters have score of 1, otherwise 0.
    m     A match score is the score of identical chars, otherwise mismatch
          score.
    d     A dictionary returns the score of any pair of characters.
    c     A callback function returns scores.
    The gap penalty parameters are:

    CODE  DESCRIPTION
    x     No gap penalties.
    s     Same open and extend gap penalties for both sequences.
    d     The sequences have different open and extend gap penalties.
    c     A callback function returns the gap penalties.  
    --
    DNA: 
    localms: psm=2,pmm=0.5,pgo=-3,pge=-1):
    Protein:
    http://resources.qiagenbioinformatics.com/manuals/clcgenomicsworkbench/650/Use_scoring_matrices.html