Package: bialign
BiAlign - Bialignment of RNAs and proteinsThe tool BiAlign computes optimal bi-alignments of RNAs and proteins. Such
bi-alignments support evolutionary 'shift' events between sequence and
structure. In this way, bialignments extend alignments based on sequence
and struture similarity to the case of potential incongruence between
sequence and structure evolution.The current version extends the capabilities from RNA alignments to the alignment of protein
sequence and secondary structure, supporting realistic 'affine' gap cost
with gap opening and extension scores.The first version of this tool has been described inWaldl M., Will S., Wolfinger M.T., Hofacker I.L., Stadler P.F. (2020)
Bi-alignments as Models of Incongruent Evolution of RNA Sequence and
Secondary Structure. In: Cazzaniga P., Besozzi D., Merelli I., Manzoni L.
(eds) Computational Intelligence Methods for Bioinformatics and
Biostatistics. CIBB 2019. Lecture Notes in Computer Science, vol 12313.
Springer, Cham.https://doi.org/10.1007/978-3-030-63061-4_15InstallationThis software will run with full functionality only on Linux and Mac
systems. Installation via conda is not supported on Windows
and the prediction of RNA structures (using the Vienna RNA package) cannot be
supported.The software can be installed via Conda (only Linux/Mac) or pip (Mac/Linux/Windows/...)  respectively byconda install -c bioconda bialignorpip install bialignConda installation is recommended, since it will automatically install dependencies like the Vienna RNA
package. When installing via pip (or from source, see below), additionally install numpy, matplotlib, and (optionally) the Vienna RNA package.Installation from sourceInstallation or from source, e.g. a clone of the git repository, relies on
the python setup system.We require Cython to compile performance critical code. For this purpose Cython and
Python (including pip/setuptools) need to be installed. Install from source bypip install .Moreover, for aligning RNAs, the tool requires the Vienna RNA package with Python bindings. We recommend to use the tool under Linux or MacOS and install the prerequisites via conda / bioconda.Usage examplesThe tool can be used from the command line or via its Python interface
(e.g. from a Jupyter notebook).Command line interfaceTo get an overview on all command line parameters that configure modes and
alignment parameters, please refer to the help output of the tool as obtained bybialign.py --helpRNA bi-alignment examplesThis 'toy' example demonstrates a simple helix shift:bialign.pyGCGGGGGAUAUCCCCAUCGGGGGAUAUCCCCAUCG\--strA"...(((.....)))....."--strB".(((.....)))...."\--structure400\--gap_opening_cost-200--gap_cost-50\--max_shift1--shift_cost-150Using default text output mode, this producesInput:
seqA	 GCGGGGGAUAUCCCCAUCG
seqB	 GGGGAUAUCCCCAUCG
strA	 ...(((.....))).....
strB	 .(((.....)))....
SCORE: 6800

A               GCGGGGGAUAUCCCC-AUCG
B               G---GGGAUAUCCCC-AUCG
A ss            ...-(((.....))).....
B ss            .---(((.....)))-....
A shifts        ...<...........>....
B shifts        ....................Structures will be predicted (using the Vienna RNA package) if they are not
explicitly given, e.g.bialign.py UGUAAACAUCCUCGACUGGAAGCUGUGAAGCCACAAAUGGGCUUUCAGUCGGAUGUUUGCA UGUAAACAUCCUACACUCAGCUGUCAUACAUGCGUUGGCUGGGAUGUGGAUGUUUACGNote that this fails, if the Vienna RNA package with Python binding is not
available.Bi-Alignments of proteins with affine gap costbialign.pyRAKLPLKEKKLTATANYHPGIRYIMTGYSAKYIYSSTYARFRKAKLPLKEKKLTRTANYHPGIRYIMTGYSAKRIYSSTYAYFR\--strA"CHHHHHHHHHHHHHCCCCTCEEEEEEECCTCEEEEEEEECCC"--strB"HHHHHHHHHHHHCCCCCCTCEEEEEEECCCCCEEEEEEEECC"\--typeProtein--shift_cost-150--structure_weight800--simmatrixBLOSUM62--gap_opening_cost-150\--gap_cost-50--max_shift1--outmodesortedDue to the requested output modesorted, this produces text output with BLAST-like
annotation by the respective consensus sequence and structure of
the sequence and structure alignment component.Input:
seqA	 RAKLPLKEKKLTATANYHPGIRYIMTGYSAKYIYSSTYARFR
seqB	 KAKLPLKEKKLTRTANYHPGIRYIMTGYSAKRIYSSTYAYFR
strA	 CHHHHHHHHHHHHHCCCCTCEEEEEEECCTCEEEEEEEECCC
strB	 HHHHHHHHHHHHCCCCCCTCEEEEEEECCCCCEEEEEEEECC
SCORE: 48500

A ss            -CHHHHHHHHHHHHHCCCCTCEEEEEEECCTCEEEEEEEEC-CC
A               -RAKLPLKEKKLTATANYHPGIRYIMTGYSAKYIYSSTYAR-FR
consensus       -.AKLPLKEKKLT.TANYHPGIRYIMTGYSAK.IYSSTYA.-FR
B               -KAKLPLKEKKLTRTANYHPGIRYIMTGYSAKRIYSSTYAY-FR
B ss            -HHHHHHHHHHHHCCCCCCTCEEEEEEECCCCCEEEEEEEE-CC
consensus ss    -.HHHHHHHHHHH..CCCCTCEEEEEEECC.C.EEEEEEE.-CC

A               RAKLPLKEKKLTA-TANYHPGIRYIMTGYSAK-YIYSSTYARFR
A ss            CHHHHHHHHHHHH-HCCCCTCEEEEEEECCTC-EEEEEEEECCC
consensus ss    .HHHHHHHHHHHH..CCCCTCEEEEEEECC.C.EEEEEEEE.CC
B ss            -HHHHHHHHHHHHCCCCCCTCEEEEEEECCCCCEEEEEEEE-CC
B               -KAKLPLKEKKLTRTANYHPGIRYIMTGYSAKRIYSSTYAY-FR
consensus       .........K....TANYHPGIRYIMTGYSAK....S.....FR

A shifts        >............<..................<........>..
B shifts        ............................................Input can also be read from files as written by the secondary structure prediction
web server CFSSP (Kumar et al, 2013;http://www.biogem.org/tool/chou-fasman).bialign.py--fileinExamples/DNAPolymerase1_Escherichia.cfsspExamples/DNAPolymerase1_Xanthomonas.cfssp\--typeProtein--shift_cost-150--structure_weight800--simmatrixBLOSUM62--gap_opening_cost-150\--gap_cost-50--max_shift1Python interfaceThe following code generates a bi-alignment of two toy proteins and shows
the resulting alignment in a graphical representation.importbialignmentimportbialignmentasbaimporttimeitargs={'type':'Protein','gap_cost':-50,'gap_opening_cost':-150,'shift_cost':-150,'structure_weight':800,'max_shift':1,'simmatrix':'BLOSUM62'}args['nameA']='A'args['nameB']='B'strA="CHHHHHHHHHHHHHCCCCTCEEEEEEECCTCEEEEEEEECCC"seqA="RAKLPLKEKKLTATANYHPGIRYIMTGYSAKYIYSSTYARFR"seqB="KAKLPLKEKKLTRTANYHPGIRYIMTGYSAKRIYSSTYAYFR"strB="HHHHHHHHHHHHCCCCCCTCEEEEEEECCCCCEEEEEEEECC"bialigner=ba.BiAligner(seqA,seqB,strA,strB,**args)score=bialigner.optimize()print('SCORE',score)print()forlineinbialigner.decode_trace():print(line)ba.plot_alignment(bialigner.decode_trace_full(),width=80,show_position_numbers=False,name_offset=3,#outname = "example.svg" #optionally write plot to file)