189 Commits

Author SHA1 Message Date
39eb8f9889 Fix formatting errors 2024-12-31 18:44:31 +00:00
b8b90e1152 4775: raise warnings instead of errors if dashes are not in the expected places for dates 2024-12-31 18:44:31 +00:00
67ea5cee9a Fix parsing of DBLINK field with multiline records 2024-12-31 18:13:30 +00:00
87350ad4df Remove now redundany typing imports
Found with ruff check F401 (which we don't currently
enforce but probably ought to later).
2024-06-27 09:55:07 +09:00
519066cfb8 pep 585 typing rewrites etc using pyupgrade 3.16.0
$ pyupgrade --keep-percent-format --py39-plus \
      Bio/*.py Bio/*/*.py BioSQL/*.py

Didn't find any changes in tests, scripts, or docs.
Followed by removing a few now redundant imports
and black in one case.
2024-06-27 09:55:07 +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
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
ddd11697d3 Don't use record specific attributes in GenBank parser warning
See issue #4579
2024-01-19 11:03:43 +00:00
720217b0c4 Fix empty structured comment parser (#4492) 2023-12-19 14:11:23 +00:00
68e3c989d9 ruff fix PIE790 Unnecessary pass statement
$ ruff --fix --select PIE790 BioSQL/ Bio/ Doc/examples/ Tests/ Scripts/
Found 62 errors (62 fixed, 0 remaining).

Then re-ran black.
2023-11-02 09:34:48 +00:00
98372cdd5b ruff UP032 Use f-string instead of format call
$ ruff --fix --select UP032 BioSQL/ Bio/ Doc/examples/ Tests/ Scripts/
Found 3 errors (3 fixed, 0 remaining).
2023-11-02 09:34:48 +00:00
42ca9f27b8 Basic type hints: QualityIO, SeqRecords, ...
Co-authored-by: Thomas Holder <thomas@thomas-holder.de>
2023-08-08 10:51:44 +01:00
07697d1de4 Extend special case top level taxonomy terms
Longer list reported by David Coornaert in
discussion on #4210.
2023-04-23 21:03:05 +01:00
0d353b69d1 Special case single entry GenBank lineage
Closes #4210 where 'Bacteria.' was treated as a continuation
of the organism name due to lacking any semi-colons.
2023-04-23 21:03:05 +01:00
ae4b078d99 Use black v22.1.0
Main change is to simple power expressions, e.g.

>>> pssm.distribution(background=background, precision=10 ** 4)

becomes:

>>> pssm.distribution(background=background, precision=10**4)

Also standardises string prefixes (e.g raw bytes), and
there are some tweaks to multi-line expressions.

I have used the "black --target-version py37 ..." form, but
it does not seem to make any difference over the default.

Note also had to update to blacken-docs v1.12.1
2022-01-31 14:33:14 +00:00
72bbd10a47 f-strings on Bio.GenBank using flynt 0.69 2021-09-13 16:14:16 +01:00
db4dae1501 pyupgrade: f-strings on Bio/GenBank/
Reverted one change, and did not touch the regex examples
in the __init__.py file, as change was less readable.
2021-09-10 09:27:49 +01:00
51fb8f9abd Assorted spelling corrections from codespell
See https://github.com/codespell-project/codespell

We have lots of false positives, so currently this
needs manual review and/or a list of biological
terms to ignore like "Ser" and "OTU".
2021-08-29 00:24:41 +01:00
2e6f010fe1 black, version 21.7b0 2021-08-27 19:30:22 +01:00
e9496f5e88 Automatically remove redundant commas
Used this hack from https://github.com/psf/black/issues/1288

$ pip install black==19.3b0 && black . && pip install black==19.10b && black .

I then manually reverted changes to a handful of explicit data
structures where the magic trailing comma should be retained
(indicates to black not to squash into one line).

Doing this dramatically improves the changes from trying black
version 21.7b0 (right now just four minor changes).
2021-08-27 13:42:55 +01:00
28f4fd2954 Remove all occurrences of OrderedDict in biopython (#3598)
Co-authored-by: eglif <fabian.egli@hest.ethz.ch>
2021-06-22 17:05:29 +01:00
3742a17f8b Standardize class init docstrings (#3529)
Standardize class initialization comment throughout project
2021-04-17 10:13:59 +01:00
56c6603d9b pyupgrade --py36-plus --keep-percent-format 2021-01-11 11:19:55 +00:00
02bbcb96e8 Remove useless self assignment
SonarCloud complained: Remove or correct this useless self-assignment.
2020-10-04 18:47:16 +01:00
28e7214e15 Do not record alphabet in Bio.GenBank 2020-07-28 11:00:21 +01:00
caaa894ba5 Fixed typos in docstrings and docs (#3013)
Used https://github.com/erichurkman/misspellings to find common misspellings in the code.
2020-06-29 11:52:25 +01:00
3aa17a5b62 Remove stray GenBank scanner comment (#2934) 2020-05-30 10:17:28 +01:00
4b02fc57d2 Handle malformed structured comment (#2851)
The record will be parsed and the malformed comment
will be ignored/removed. A warning will be raised.

Add name to NEWS
2020-04-28 12:55:25 +01:00
b47daf0bc5 Initial commit for parsing 2020-02-11 12:46:29 +00:00
d4f7929feb change all "r" args 2020-01-26 19:49:35 +00:00
c0b9123f7f update Bio.GenBank for python3 (#2558) 2020-01-17 08:18:55 +09:00
f09b169a4a updating Bio.File for python3 (#2557)
* updating Bio.File for python3

* travis
2020-01-16 23:27:32 +09:00
481d3f079b remove explicit class inheritance of object 2019-12-28 19:21:54 +00:00
616b0d16d0 GenBank: Fix TSA line parsing (#2431)
Signed-off-by: Kai Blin <kblin@biosustain.dtu.dk>
2019-12-25 14:49:51 +00:00
0c25556525 Removed print_function and division future imports 2019-12-25 14:41:32 +00:00
31aaacc9df Apply black style to Bio.GenBank (#2406)
Peter's comment: These additional changes after black was applied
in #2191 were with black v19.3b0 or 19.10b0 (latest), suggesting I had
accidentally using an unreleased branch of black.
2019-12-18 13:11:48 +00:00
f7e609fc01 Parse multiline structured comments in GenBank files
GenBank files can contain multiline comments in the form

COMMENT     ##MIENS-Data-START##
            environment        :: Temperate shelf and sea biome
                                  [ENVO:00000895], coastal water body
                                  [ENVO:02000049], coastal water
                                  [ENVO:00002150]
            ##MIENS-Data-END##

Previously lines after the 'environment' comment key were attached to the
global comment instead of the structured comment, resulting in

["MIENS-Data"]["environment"] == "Temperate shelf and sea biome"

After this commit the extra lines are attached to the value at the previous
structured comment's key, resulting in

["MIENS-Data"]["environment"] == "Temperate shelf and sea biome [ENVO:00000895], coastal water body [ENVO:02000049], coastal water [ENVO:00002150]"

Issue: #2177
2019-12-04 13:16:19 +00:00
018ce495ea Fix implicitly concatenated string literals on one line
These were created by black which allows longer lines,
but does not currently combine string literals like this.
Spotted using https://github.com/keisheiled/flake8-implicit-str-concat/
2019-11-29 12:59:47 +00:00
af73d7e063 Avoid generator functions in SeqIO, use iterators (#2321)
* move with block inside each submodule

* fix SeqXmlIO

* cleanup

* travis

* fix for python2

* travis being a jerk

* travis being a jerk

* hello goodbye

* putting changes back in

* travis being obnoxious
2019-11-11 22:48:44 +09:00
a59dde0d57 Apply black v19.3b0 to GenBank code 2019-11-05 17:19:34 +00:00
d7433439b0 Minimal support for GenBank TSA files (#2269)
Follows example of WGS support; could do better on the 'length'
versus 'record count' handling? See issue #2268
2019-09-17 11:49:26 +01:00
b58c4b613b Using tool unify to convert Bio/ to use double quotes
Using https://github.com/myint/unify for this:

$ unify --quote \" --in-place Bio/*.py Bio/*/*.py Bio/*/*/*.py
$ git checkout Bio/Restriction/Restriction_Dictionary.py

Note excluded automatically generated file
Bio/Restriction/Restriction_Dictionary.py
2019-08-02 14:10:22 +01:00
4de2bb94ff Use a bullet point list for these URLs 2019-07-16 08:05:20 +01:00
c2bad83d44 Fail explicitly on bytes in GenBank/EMBL 2019-06-28 07:48:49 +02:00
b13faf4baa Remove redundant self test from Bio.GenBank.Scanner (#1936)
Testing the same method in Tests/test_GenBank_unitest.py instead,
using existing example files. Addresses part of GitHub issue #820.
2019-02-27 16:40:17 +00:00
c6427ef0ba Fix flake8 F117 over-indented, new in pycodestyle 2.5.0
$ flake8 --isolated --select E117 Bio/
Bio/pairwise2.py:950:13: E117 over-indented
Bio/pairwise2.py:952:13: E117 over-indented
Bio/codonalign/chisq.py:107:17: E117 over-indented
Bio/codonalign/codonseq.py:634:13: E117 over-indented
Bio/GenBank/Record.py:469:13: E117 over-indented
Bio/GenBank/Record.py:471:21: E117 over-indented
Bio/GenBank/Record.py:476:13: E117 over-indented
Bio/GenBank/Record.py:478:21: E117 over-indented
Bio/GenBank/Scanner.py:105:25: E117 over-indented
Bio/PDB/FragmentMapper.py:71:21: E117 over-indented (comment)
Bio/Phylo/PAML/_parse_codeml.py:235:17: E117 over-indented
Bio/SearchIO/ExonerateIO/exonerate_vulgar.py:94:17: E117 over-indented
2019-02-01 13:38:46 +00:00
406cb2eb07 Update the GenBank parser for extra long accession (#1888)
Updated warnings/errors, tests and NEWS.rst

Squashed commit of pull request #1888 to close issue #1870.
2019-01-14 13:43:10 +00:00
c1f0f643a5 Style changes for flake8 E127 and E128
Style changes to comply with E127 and E128 in Bio folder.

Also added full stops to SearchIO docstrings set via the property function, see PEP257.

Work in reference to issue #1515, squashed commit of pull request #1768.
2018-08-24 09:25:57 +01:00
6914172cd3 Fixing multiline assert statements in Bio folder
Fixed nearly all multiline assert statements in Bio folder, in reference to #1515.
2018-08-22 14:56:08 +01:00
14f2e45c00 Fixing multiline assert in GenBank folder
Fixing multiline assert statements in reference to  #1515. Specifically fixing the multiline assert statements that return error messages.
2018-08-22 14:56:08 +01:00