Commit Graph

98 Commits

Author SHA1 Message Date
1172869397 Uniprotxml parse ligand tag (#5001)
* enable handling of <ligand> tags in UniProt XML files

* test parsing of <ligand> in UniProt XML

* add name to CONTRIB.rst

* format with black

* enable capture of multiple ligands from uniprot xml file. update tests accordingly

* add mock UniProt XML file with multiple ligand tags per feature

* test for correct len of all ligands list and multiple ligands per feature
2025-05-31 00:09:26 +01:00
ea8ff473e3 Allow parsers in Bio.SeqIO to handle both text and binary modes (#4842) 2024-09-18 10:04:06 +01:00
86c189c43d use SequenceIterator & binary mode for Bio.SeqIO Uniprot XML (#4833) 2024-09-17 11:24:04 +01: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
6636e9de6e Ran black v24.2.0 2024-03-14 11:05:43 +00:00
5ab7317d0f SeqRecord does not check type of Seq argument (#4477)
* Add name to 'NEWS.rst' and 'CONTRIB.rst'
* Raise a warning when a SeqRecord is created using a string and also convert the argument to a Seq.
* Test that the BiopythonDeprecationWarning is raised when initializing a SeqRecord with a string.

Authored-by: Ernesto Rodriguez <ernesto.rodriguez@tum.de>
2023-11-16 15:03:01 +00:00
b454dca8a2 Catch non-UniProt-XML in SeqIO parser (#4486)
This fix uses the xml namespaces in the input to validate uniprot-xml
format in SeqIO, since the parser is already assuming the input has
uniprot namespace.

This will cause the parser to fail with a clear error message and prevent
misleading error messages like the OOM error in issue #4467

The test checks it aborts parsing when the input does not have the
expected xml namespace.
2023-11-07 16:36:36 +00:00
dd8d5b7fa3 Rename Bio.SeqFeature.FeatureLocation to SimpleLocation (#4076)
* Rename Bio.SeqFeature.FeatureLocation to SimpleLocation

Retain the old name as an alias for backward compatibility only.

* FeatureLocation -> SimpleLocation in DEPRECATED notes

* Avoid deprecated strand argument to SeqFeature

* Drop now redundant adjective simple in docstrings

Co-authored-by: Michiel de Hoon <mjldehoon@yahoo.com>
2022-10-08 08:45:36 +09:00
3802e60e66 f-strings on Bio.Seq* using flynt 0.69 2021-09-13 16:14:16 +01:00
06dd487a2d pyupgrade: f-strings in Bio.SeqIO
I reverted things using format method instead.
2021-09-10 09:27:49 +01:00
36ad78155a reorder imports for SeqIO and AlignIO
$ reorder-python-imports --separate-relative --separate-from-import --py36-plus Bio/Seq*.py Bio/SeqIO/*.py Bio/AlignIO/*.py Tests/test_Seq*.py Tests/test_AlignIO*.py

$ black Bio/ Tests/
2021-03-06 13:05:10 +00:00
96bd2b09f2 Don't record alphabet in UniprotIO 2020-07-28 09:40:40 +01:00
7729b7af71 remove alphabet checks for uniprot (#2981) 2020-06-18 18:47:26 +09:00
2562497442 Use molecule type instead of alphabet in GenBankWriter (#2972)
* not nearly done

* test_SeqIO.py passes

* fixed some tests

* fixed a few more tests

* Fix test_SeqIO_Insdc.py bug

* travis

* black
2020-06-16 19:42:24 +09:00
91f1db52ae Use next instead of list to fetch first element.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-05-10 16:46:21 +01:00
ae755750c1 Use iter instead of getiterator for Python 3.9 compatibility. 2020-05-10 16:46:21 +01:00
2b8559b7c1 No need for 'except XXX as local_var' here (flake8 F841) 2020-02-19 09:38:44 +00:00
41037b67d3 use ElementTree to handle file paths (#2629)
* use ElementTree to handle file paths

* black
2020-02-06 08:23:29 +09:00
ba893ee4af drop redudant arg 2020-01-21 17:10:25 +00:00
7cd81c0746 Python 3 should always have ElementTree 2020-01-10 11:00:48 +00:00
8ee33ce867 Pyupgrade part 2 (again) (#2480)
This time without the minimal string re-formatting.

Basically, it's the IOError stuff and some other small changes.
2020-01-03 19:37:11 +00:00
481d3f079b remove explicit class inheritance of object 2019-12-28 19:21:54 +00:00
827429d3d8 remove python2 import for StringIO 2019-12-27 16:45:02 +00:00
b094b8baf4 Python 3 only has ElementTree 2019-12-26 11:27:12 +00:00
3e53872e95 fix unnesary comps 2019-11-18 12:35:52 +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
d20f11f6d9 Revert adding EMBL-CDS from UniProt (#2310)
This reverts commit 3b46a068645fa8f98af5e7ddb7afdf699bf4e340
and the associated acknowledgements.

Sadly we don't (yet) have consent for the dual licensing, my
mistake in not catching this while reviewing the pull request.
2019-11-06 13:24:30 +00:00
a616fc5fbd Dual license Bio/SeqIO/UniprotIO.py
Original author Andrea Pierleoni and contributors since as tracked
by version control have all agreed:

 - Adhemar Zerlotini (@azneto)
   https://github.com/biopython/biopython/pull/1412#issue-147372599
 - Andrea Pierleoni (@apierleoni)
   https://github.com/biopython/biopython/issues/898#issuecomment-526607210
 - Carlos Pena (@carlosp420)
   https://github.com/biopython/biopython/issues/898#issuecomment-236925650
 - Chris Rands (@chris-rands)
   https://github.com/biopython/biopython/pull/1301
 - chrismit (@Chris7)
   https://github.com/biopython/biopython/issues/898#issuecomment-380509619
 - Christian Brueffer (@cbrueffer)
   https://github.com/biopython/biopython/issues/898#issuecomment-236922857
 - Devang Thakkar (@DevangThakkar)
   https://github.com/biopython/biopython/pull/1845
 - Francesco Gastaldello (@gasta88)
   https://github.com/biopython/biopython/pull/1063
 - @morrme
   https://github.com/biopython/biopython/pull/1172#issuecomment-295430028
 - Oscar G. Garcia (@OscarMaestre)
   https://github.com/biopython/biopython/issues/898#issuecomment-279468659
 - Peter Cock (@peterjc)
   https://github.com/biopython/biopython/issues/898#issue-167420613
 - Uri Laserson (@laserson)
   https://github.com/biopython/biopython/issues/898#issuecomment-253339817
 - Vincent Davis (@vincentdavis)
   https://github.com/biopython/biopython/issues/898#issuecomment-236938752
2019-11-04 17:21:39 +00:00
3b46a06864 added embl-cds from uniprot to dbxref (#2310) 2019-10-31 13:04:00 +00:00
07d2b82f99 Rework loop which did not look nice after black formatting.
Used short loop variable (as earlier in file), simple a start value
calculation into two steps, and moved a comment line.
2019-09-16 09:45:06 +01:00
c3a25ef978 Ran black version 19.3b0 on Bio.SeqIO 2019-09-16 09:45:06 +01:00
158ddf75a0 Tweak comment placement for black 2019-09-16 09:45:06 +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
44ecbad7b2 Refactor list/dict/set comprehensions and literal syntax (#2087)
Issues identified using flake8-comprehensions
2019-05-30 12:50:08 +01:00
8ebd3a628f Consistent error messages for empty file parsing in SeqIO (#1845)
raise 'Empty file.' error messages on encountering an empty file
instead of the current non standard errors. Formats affected are as
follows: cif-atom, pdb-atom, uniprot-xml.
2018-11-19 11:34:56 +00:00
928669ed3c Avoid creating new class instance in argument defaults.
This avoids a flake8-bugbear warning,

B008 Do not perform calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time call. If this is intended, assign the function call to a module-level variable and use that variable as a default value.

We already have a module-level variable with a shared
instance of the generic protein alphabet - so use that.
2018-08-17 13:46:36 +01:00
d699a4d51d Indentation tweaks in SeqIO for flake8 E127 / E128 2018-01-29 12:13:45 +00:00
0008a0dd3b Imparative mood for SeqIO, SearchIO and Crystal (D401)
Squashed commit of pull request #1498, docstyle changes for #1473.
2018-01-12 16:05:19 +00:00
ba39e1f768 adding the docstring 'Initialize the class.' to every def __init__ with no docstring 2017-10-19 22:20:04 +01:00
be6b89e282 More RST tweaks to docstrings, mostly argument bullet lists 2017-06-16 12:46:00 +01:00
80988e819a corrections for pydocstyle rule D204 2017-05-07 22:36:29 +01:00
30865f6390 pydocstyle D413 blank line after last section
Squashed commit of pull request #1170
2017-04-25 10:51:07 +01:00
f2d1c141da Fixes for pydocstyle rule D405 2017-04-21 16:26:37 +01:00
77df7d8251 fixes for pydocstyle rule D412 2017-04-20 15:52:50 +01:00
49e7da7b44 Remove unwanted white space after docstrings (etc)
$ pydocstyle Bio/ BioSQL/ Tests/ Scripts/ Doc/ --select D202
...
D202: No blank lines allowed after function docstring
2017-02-22 22:44:17 +00:00
769564699c XML submittedName allowed in Uniprot. Fixes #1028 (#1034)
Fixes #1028 by adding "submittedName" to the allowed name tags in UniprotIO

Test added to test_Uniprot.py

Squashed commit of pull request #1034.
2017-01-07 23:42:37 +09:00
78e2cb3abe Fix UniprotIO error on mass spec
Some mass spec location tags (`begin` and `end`) don't have `position` attributes.  For example, one of them has `status="unknown".  This causes a KeyError.`
2016-10-14 16:55:37 +01:00
d979f0f1d4 correct import statement for BiopythonDeprecationWarning 2016-10-11 10:39:48 +01:00
e1d314e252 Deprecate taking a string in UniprotIterator
This was an anomoloy in the SeqIO API.
2016-09-02 12:28:27 +01:00