MDAnalysis / UserGuide

User Guide for MDAnalysis
https://userguide.mdanalysis.org
22 stars 33 forks source link

document interoperability with Bio.align #244

Open orbeckst opened 1 year ago

orbeckst commented 1 year ago

Is your feature request related to a problem? Please describe. https://github.com/MDAnalysis/mdanalysis/issues/3950 deprecates align.sequence_alignment() and schedules it for removal for MDA 3.0. Therefore, there will remain no code that directly generates a pairwise alignment from two AtomGroups.

Describe the solution you'd like Document the actual code that's currently in the function (see also the new Notes in the docs (after PR https://github.com/MDAnalysis/mdanalysis/pull/3951 is merged):

      import Bio.Align.PairwiseAligner

      aligner = Bio.Align.PairwiseAligner(
         mode="global",
         match_score=match_score,
         mismatch_score=mismatch_penalty,
         open_gap_score=gap_penalty,
         extend_gap_score=gapextension_penalty)
      aln = aligner.align(reference.residues.sequence(format="Seq"),
                          mobile.residues.sequence(format="Seq"))

      # choose top alignment with highest score
      topalignment = aln[0]

The code is short and provides more flexibility to the user. We should have a short UG page that shows some basic interoperability with biopythons Bio.align module and mention how ResidueGroup can directly provide sequences as input for functions/classes in Bio.align.

Describe alternatives you've considered Do nothing...

Additional context This is the restructured text that could be used directly for a UG entry:

    If you prefer to work directly with :mod:`Bio.Align` objects then you can
    run your alignment with :class:`Bio.Alig.PairwiseAligner` as ::

      import Bio.Align.PairwiseAligner

      aligner = Bio.Align.PairwiseAligner(
         mode="global",
         match_score=match_score,
         mismatch_score=mismatch_penalty,
         open_gap_score=gap_penalty,
         extend_gap_score=gapextension_penalty)
      aln = aligner.align(reference.residues.sequence(format="Seq"),
                          mobile.residues.sequence(format="Seq"))

      # choose top alignment with highest score
      topalignment = aln[0]

    The ``topalignment`` is a :class:`Bio.Align.PairwiseAlignment` instance
    that can be used in your bioinformatics workflows.