1548 Commits

Author SHA1 Message Date
e763ca5721 Add paragraph about iplotx in Phylo tutorial (#5028)
Add mention in NEWS.rst
2025-10-09 09:27:43 +01:00
be97b2d4e7 Aligner default arguments (#5029)
* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* doctests_fixed

* update

* update

* documentation

* add warning

* add a note to the DEPRECATED file

* adding a NEWS entry

* remove stray comments

---------

Co-authored-by: Michiel de Hoon <mdehoon@lacg01.local>
Co-authored-by: Michiel de Hoon <mdehoon@tkx380.genome.gsc.riken.jp>
Co-authored-by: Michiel Jan Laurens de Hoon <mdehoon@Michiels-MacBook-Air.local>
Co-authored-by: Michiel de Hoon <mdehoon@tkx288.genome.gsc.riken.jp>
2025-09-16 22:46:35 +09:00
6e43775844 documentation tweaks (#5055)
* documentation tweaks

* update

---------

Co-authored-by: Michiel de Hoon <mdehoon@tkx288.genome.gsc.riken.jp>
2025-09-04 16:23:53 +09:00
ad9456f3bb Align: add substitution matrix support to Alignment.format() (#5049)
* Align: add optional substitution matrix/aligner argument to format()
- Extended Alignment.format() to accept an optional argument:
  * substitution matrix (e.g. from Bio.Align.substitution_matrices)
  * PairwiseAligner object (uses its substitution matrix)
- Preserves compatibility with existing writer-specific arguments
  (e.g. "vulgar" for exonerate, metadata for mauve).
- Internal logic now distinguishes between substitution matrices
  (used in pretty-printing) and writer arguments (passed to
  AlignmentWriter).
- All alignment format tests pass (58/58).

* Align: add substitution matrix argument to helper format functions

- Updated _format_pretty, _format_unicode, _format_generalized
  to accept optional substitution matrix argument.
- Passed matrix from Alignment.format() into these helpers.
- Updated docstrings accordingly.
- All alignment format tests pass (58/58).

* Align.format: support substitution matrices in helper functions; add tests

- Updated helper functions in Align.format (generalized, pretty, html, etc.)
  to correctly handle substitution_matrix arguments.
- Added new test file `Tests/test_format_matrix.py` to cover:
  * identity matches (|), positive mismatches (:), negative mismatches (.),
    and gaps (-) using substitution matrices.
  * verified behavior with both NUC.4.4 and a custom BLASTN-like matrix.
- Confirmed tests pass with pytest.

Resolves #5043

* Add Rachel Stern to contributors list and NEWS (first contribution)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix style issues in test_format_matrix and Align -__init__

* Rename test_format_matrix.py to test_format_matrix_unittest.py for AppVeyor test discovery

* Move format matrix test to unittest style

* Refactor scoring argument handling in counts() and format()

- Renamed the optional argument in counts() from `argument` to `scoring` for
  clarity and consistency.
- Updated format() to accept the `scoring` parameter via **kwargs instead of
  a dedicated argument.
- Removed the explicit writer argument from format(), since it is no longer
  needed with kwargs-based handling.
- Adjusted the docstring of format() accordingly to reflect the new usage.

* Update test_format_matrix_unittest.py:
- Use explicit assertEqual for pattern strings instead of only assertIn/NotIn, following reviewer feedback.
- Simplify alignment selection by indexing [0] instead of next(iter(...)).

* Remove _pattern_from_pretty, assert full alignment format instead

- Replaced usage of `_pattern_from_pretty` helper with direct comparison
  of `aln.format("", scoring=M)` output in all relevant tests.
- This makes the tests simpler and closer to the actual API usage.
- Removed unused `_pattern_from_pretty` function.

* docs: document new `scoring` argument in Alignment.format tutorial

- Added explanation of the optional `scoring` argument to
  `Alignment.format()` in Doc/Tutorial/chapter_align.rst.
- Included example using PairwiseAligner and a substitution matrix
  (NUC.4.4) to illustrate how the pattern line reflects scores.
- Clarifies how symbols (|, :, ., -) correspond to matches,
  positive/negative mismatches, and gaps.

* docs: add cont-doctest and update scoring example with '.' mismatch

* docs: fix scoring example with gap penalties to show ':' and '.' in doctest

* docs: add <BLANKLINE> to doctest output in scoring example

* doc: add 8 in the middle line of the format

* doc: Arranging the print format

* Rearrange the print format

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: mdehoon <mjldehoon@yahoo.com>
2025-09-04 14:14:55 +09:00
66ad0a062e Extend the .counts method of an Alignment (#5011)
* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* updat

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* halfway finished

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* pdate

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* replace precompiler #defines by inline functions

* update

* update

* add tests

* update

* update

* update

* update

* update

* update

* update

* update

* documentation

* update

* avoid stpcpy

* pointer printing

* compiler warning

* testing without codonalign

* testing without codonalign and pairwisealigner

* compiler warning

* adding codonalign and pairwisealigner back in

* remove inline from check_indices

* add inline to check_indices

* update

* add test line 12287 test_pairwise_aligner.py

* update

* update

* update

* update

* change dtype from int32 to "i"

* all done

* testing

* testing

* testing

* testing

* done

* done

* fix how pointers are printed on Windows

* update

* update

* update

* update

* fix id printing on pypy

* style change only

* Use Py_uintptr_t instead of uintptr_t

* fix memory leak

* remove double semicolon

* check if GitHub actions are now pickup up Python version 3.13.5 without hardcoding it

---------

Co-authored-by: Michiel Jan Laurens de Hoon <mdehoon@Michiels-MacBook-Air.local>
Co-authored-by: Michiel de Hoon <mdehoon@tkx288.genome.gsc.riken.jp>
Co-authored-by: Michiel de Hoon <michiel.dehoon@riken.jp>
2025-07-11 14:40:07 +09:00
0969cc24fd Add automatic alignment generation to StructureAlignment 2025-07-03 09:33:06 -07:00
17e870f6da Added Documentation to CEAlign and QCPSuperimposer (#5002) 2025-06-09 09:00:38 -07:00
fc6af830e6 Remove unnecessar doctest:+ELLIPSIS from Tutorial
$ sed -i.bak "s/  # doctest:+ELLIPSIS$//g"
2025-02-28 07:51:11 +00:00
aabf125517 Alignments repr (#4957)
* update

* update

* update

* update

* black

---------

Co-authored-by: Michiel de Hoon <mdehoon@tkx288.genome.gsc.riken.jp>
2025-02-28 11:32:06 +09:00
44f7a0ae04 Fix typo spotted with updated codespell 2025-02-27 11:11:14 +00:00
186d3825c4 Updated matplotlib pylab to pyplot in cookbook (#4937)
* Updated pylab to pyplot example
* Updated cross-reference
2025-02-13 19:42:38 +00:00
9962ca2691 PairwiseAligner attribute names (#4933)
* target_internal_extend_gap_score

* target_internal_open_gap_score

* target_left_open_gap_score

* self.target_left_extend_gap_score

* target_right_open_gap_score

* target_right_extend_gap_score

* query_left_open_gap_score

* query_left_extend_gap_score

* query_internal_open_gap_score

* query_internal_extend_gap_score

* query_right_open_gap_score

* query_right_extend_gap_score

* target_gap_function

* query_gap_function

* internal_open_gap_score

* left_open_gap_score

* left_extend

* right_open_gap_score,right_extend_gap_score

* end_extend_gap_score

* target_open_gap_score

* target_extend_gap_score

* query_open_gap_score

* target_gap_score

* target_end_gap_score

* target_end_open_gap_score

* target_end_extend_gap_score

* target_internal_gap_score

* target_left_gap_score

* target_right_gap_score

* dc

* query_gap_score,query_extend_gap_score

* query_end_gap_score

* query_end_open_gap_score

* query_end_extend_gap_score

* query_internal_gap_score

* update

* doc

* doctest

* tests

* update

* tests

* tests

* pickle

* tests

* deprecation tests

* documentation

* flake

* black

* deprecated

---------

Co-authored-by: Michiel de Hoon <mdehoon@tkx288.genome.gsc.riken.jp>
Co-authored-by: Michiel Jan Laurens de Hoon <mdehoon@Michiels-MacBook-Air.local>
2025-02-10 15:25:21 +09:00
6adade16fb wildcard (#4931)
Co-authored-by: Michiel Jan Laurens de Hoon <mdehoon@Michiels-MacBook-Air.local>
2025-02-07 14:46:30 +09:00
650c2677f5 update (#4930)
Co-authored-by: Michiel de Hoon <mdehoon@madpc2s-MacBook-Pro.local>
2025-02-07 11:00:34 +09:00
4d380fab03 use ignore_sequences instead of gaps_only (#4929)
* update

* update

* update

---------

Co-authored-by: Michiel Jan Laurens de Hoon <mdehoon@Michiels-MacBook-Air.local>
2025-02-06 21:44:09 +09:00
e838eb90e6 Generalize the counts attribute of an Alignment (#4924)
* create template

* tests

* tests

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* stockholm

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Michiel de Hoon <mdehoon@tkx288.genome.gsc.riken.jp>
Co-authored-by: Michiel Jan Laurens de Hoon <mdehoon@Michiels-MacBook-Air.local>
2025-02-04 22:45:43 +09:00
8655dc66da We don't use hevea anymore
The PDF instructions need reviewing - I got stuck during
the Biopython 1.85 release but didn't have access to a
Linux machine with admin rights to try the approach
documented here.
2025-01-29 20:46:39 +00:00
bf6ded9fad fix Doc/conf.py 2025-01-16 10:45:19 +00:00
91e135e2a5 fix Doc/conf.py 2025-01-16 10:45:19 +00:00
55add62e03 fix typo in chapter_pairwise.rst 2025-01-16 16:10:32 +09:00
29c931b993 bugfix (#4914)
Co-authored-by: Michiel Jan Laurens de Hoon <mdehoon@Michiels-MacBook-Air.local>
2025-01-16 10:17:13 +09:00
4ea2126ec0 remove deprecated functionality from Bio.Align.AlignInfo (#4907)
Authored-by: Michiel de Hoon <mdehoon@tkx288.genome.gsc.riken.jp>
2025-01-15 18:38:28 +00:00
851a7a2e12 fix table (#4910)
Co-authored-by: Michiel Jan Laurens de Hoon <mdehoon@Michiels-MacBook-Air.local>
2025-01-15 11:35:55 +09:00
eedf82d415 FOGSAA PairwiseAligner implementation (#4784)
* scaffold FOGSAA and add setter for PairwiseAligner.algorithm

* add first version of FOGSAA scoring

* add restrictions to algorithm setter and support matrix scoring in FOGSAA

* add test for running fogsaa with matrix scoring

* Remove algorithm setter in lieu of FOGSAA_Mode, scaffold PathGenerator for FOGSAA

* Add basic support for FOGSAA alignment

* Add FOGSAA alignment with matrix scoring

* Add more restrictions to FOGSAA parameters.

These restrictions come from the queue data structure used not from the
algorithm itself. Changing the priority queue implementation may ease
these restrictions at a possible loss to performance.

* Change FOGSAA priority queue implementation to a max heap

This allows for the queue sort doubles, which in turn removes the
requirement of integer scores in FOGSAA.

* Allocate memory once, fix affine gaps, remove threshold

* more fixes

* Add error checking, debugging code, and fix lower bounds

* add support for different affine gaps on edges

* remove debug printfs, warn on invalid parameters

* fix floating point comparison bugs

* only copy cells of optimal path in fogsaa align

* stop using different macros for fogsaa cell types

* fix fogsaa docstrings, iterator, and reset algorithm on set_mode

* mention fogsaa in Tutorial/chapter_pairwise.rst

* fix fogsaa documentation in Doc/Tutorial/chapter_pairwise.rst

* fix typo
2024-10-17 10:07:18 +09:00
d5459bb627 Preserve root branch length in Phylo.TreeMixin.prune 2024-10-02 13:47:27 +01:00
2907bcbd82 Standardizing on import numpy as np 2024-09-03 12:30:49 +01:00
fa82465fbd deprecate Instance (#4799) 2024-08-22 16:34:07 +09:00
42e9dfdb02 qblast_update (#4793) 2024-08-17 10:14:28 +09:00
bdfdb12ece Update documentation for NCBIWWW.py (#4792)
NCBI no longer supports cloud service providers
2024-08-16 16:39:34 +01:00
0d10da94c9 Fix pycon formatting in legacy markdown file
New release blacken-docs v1.18.0 tries to parse this
markdown file, which had a lot of invalid pycon lines
(mostly missing ... on multi-line statements).

This also flagged some invalid indentation in the
rather long class examples, and some Python 2 style
print statements.

We should perhaps review and/or delete this file?
2024-07-03 17:27:21 +09:00
c2ba43db03 Add support for reading PFM from Cys2His2 Zinc Finger Proteins PWM Predictor. (#4693)
* Add support for reading PFM from Cys2His2 Zinc Finger Proteins PWM Predictor.

Add support for reading PFM from Cys2His2 Zinc Finger Proteins PWM Predictor
(http://zf.princeton.edu/logoMain.php).

* Capitilize motif subtypes for "pfm-four-columns" and "pfm-four-rows" correctly.

Capitilize motif subtypes for "pfm-four-columns" and "pfm-four-rows" correctly.

* Set empty motif name string when no motif name is found when reading PFM files in "pfm-four-columns" format.

Set empty motif name string when no motif name is found when
reading PFM files in "pfm-four-columns" format.

* Add reading PFM in "pfm-four-columns" and "pfm-four-rows" to motifs tutorial.

Add reading PFM in "pfm-four-columns" and "pfm-four-rows" to motifs tutorial.
2024-06-30 09:52:02 +09:00
de0bb21fb3 Apply isort (forcing single lines, not sorting by type) via ruff
$ ruff check --fix --select=I \
  --config=lint.isort.force-single-line=true \
  --config=lint.isort.order-by-type=false \
  BioSQL/ Bio/ Tests/ Scripts/ Doc/ setup.py

Using ruff version 0.4.10
2024-06-26 15:31:39 +09:00
0365206330 Fix for 64bit Windows - RuntimeError buffer has unexpected item byte size (8, expected 4) #4751 (#4752)
* update

* fix long dtype

* fix long dtype

* update

* update

* update

* update

* test numpy array repr

* test dtype

* try printing

* update

* update

* fix chapter_blast

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Michiel de Hoon <mdehoon@tkx249.genome.gsc.riken.jp>
Co-authored-by: Michiel de Hoon <mdehoon@madpc2s-MacBook-Pro.local>
2024-06-25 01:15:54 +09:00
4fe6640e46 Add BinaryCIF parser (#4707)
Also fixes a structure comparison bug
2024-06-11 04:35:46 +01:00
5d3189e689 Replace \bpversion API links with module links
Closes #4571, seems can't use |version| substitution
within an RST URL. Might be able to do these with RST
links instead now the Tutorial and API docs are all in
one combined Sphinx document.

Also replaced "built in" with "built-in".
2024-06-10 11:26:05 +09:00
f46a1a761a Avoid triple backticks for links to filenames
Didn't render as might be expected in RST.
2024-06-10 11:26:05 +09:00
a5515717ad Include :version: at start of docs & tutorial 2024-06-10 11:26:05 +09:00
53a65b413e Use C code to parse alignments in which dashes represent gaps (#4737)
* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* fix

* update

* update

* update

* update

* update

* Use int64_t instead of long

* avoid testing numpy array output

* update

* update

* update

* test

* test

* test

* test

* update

* update

* update

* update

* update

* no more compiler warnings

* update

* update

* update

* update

* change submodule name

---------

Co-authored-by: Michiel de Hoon <mdehoon@tkx249.genome.gsc.riken.jp>
2024-06-07 23:39:07 +09:00
40f0a08d4e [Typo] Tutorial - Section 4.3.2.3
One word fix to typo at Doc/Tutorial/chapter_seq_annot.rst (line 498).
2024-05-03 09:08:53 +01:00
752322a258 Avoid numpy2 scalar repr change in example
Rather than dealing with ELLIPSIS settings and
6.003321... vs np.float64(6.0033218093539675)
explicitly print with set number of decimal places.

Addresses in part #4676
2024-04-12 08:25:17 +01:00
45b377dc47 Tweak to doctest examples for numpy2
Avoid printing 1.0 vs np.float64(1.0) by comparing
to one, and use Python sum function over the numpy
method/function to avoid getting np.True_ over True.

Not ideal as this is slightly unnatural style, but
it makes the test work on numpy 1 or 2.

Addresses in part issue #4676
2024-04-11 14:50:11 +01:00
e0046af5ca Fix phenotype example
This was not being testing, and had the wrong output.

I also changed this to print 2dp with a loop to help
with the numpy2 scalar repr changes.
2024-04-11 13:24:25 +01:00
f2dd4207d0 In Bio.Align, deprecate infer_coordinates, and use parse_printed_alignment instead (#4684)
* replace infer_coordinates by parse_alignment_block

* update

* update

* update

* update

* update

* deprecate infer_coordinates

* update

* update

* update

* update

* fix memory leak

---------

Co-authored-by: Michiel de Hoon <mdehoon@tkx249.genome.gsc.riken.jp>
2024-03-29 23:20:29 +09:00
c95b1c60d9 fix doctest (#4674) 2024-03-21 08:25:35 +09:00
d627c0ec9c remove comment (#4673) 2024-03-20 10:32:03 +09:00
bfc7b2ca5d Add a Blast XML2 writer (#4669)
* added BLAST XML2 writer

* reorder

* abstract

* finished
2024-03-17 14:17:06 +09:00
57056bbfc4 ruff format v0.3.1, black v24.2.0
Reverted unwanted changes (mostly arrays in tests, but also
some whitespace in doctests).

Remaining changes are standardising spacing between module
docstring and imports, and lower-case \x<hex> in strings.
2024-03-14 11:05:43 +00:00
6636e9de6e Ran black v24.2.0 2024-03-14 11:05:43 +00:00
3497b6ee3b Blast xml writer cleanup (#4659)
* reorganize

* update

* reference

* update

* mbstat

* stat

* finished

* update

---------

Co-authored-by: Michiel de Hoon <mdehoon@tkx249.genome.gsc.riken.jp>
2024-03-14 13:19:59 +09:00
a45b4d003b Blast xml2 (#4657)
* tests

* update

* update

* update

* update

* update

* update

* tests passing

* update

* documentation update

* update

* update

* last element is blastxml2

* last element is blastxml2
2024-03-11 05:30:30 +09:00