psdi-data-conversion 0.0.37__tar.gz → 0.0.38__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/PKG-INFO +88 -4
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/README.md +87 -1
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/app.py +30 -4
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/constants.py +6 -5
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/converter.py +13 -6
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/converters/base.py +56 -53
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/converters/c2x.py +1 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/converters/openbabel.py +10 -10
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/database.py +335 -113
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/main.py +151 -69
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/data.js +18 -4
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/format.js +22 -9
- psdi_data_conversion-0.0.38/psdi_data_conversion/templates/index.htm +135 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/testing/constants.py +3 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/testing/conversion_callbacks.py +2 -1
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/testing/conversion_test_specs.py +27 -15
- psdi_data_conversion-0.0.38/psdi_data_conversion/testing/gui.py +428 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/testing/utils.py +35 -16
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/pyproject.toml +5 -3
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/tests/gui/gui_test.py +4 -5
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/tests/python/cli_test.py +75 -11
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/tests/python/converter_test.py +7 -4
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/tests/python/database_test.py +55 -8
- psdi_data_conversion-0.0.37/psdi_data_conversion/templates/index.htm +0 -126
- psdi_data_conversion-0.0.37/psdi_data_conversion/testing/gui.py +0 -366
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/.gitignore +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/CHANGELOG.md +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/CONTRIBUTING.md +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/LICENSE +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/__init__.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/bin/LICENSE_ATOMSK +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/bin/LICENSE_C2X +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/bin/linux/atomsk +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/bin/linux/c2x +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/bin/mac/atomsk +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/bin/mac/c2x +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/converters/__init__.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/converters/atomsk.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/dist.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/file_io.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/log_utility.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/scripts/atomsk.sh +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/scripts/c2x.sh +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/security.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/accessibility.htm +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/convert.htm +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/convertato.htm +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/convertc2x.htm +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/documentation.htm +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/download.htm +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/feedback.htm +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/header-links.html +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/index-versions/header-links.html +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/index-versions/psdi-common-footer.html +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/index-versions/psdi-common-header.html +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/psdi-common-footer.html +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/psdi-common-header.html +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/content/report.htm +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/data/data.json +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/colormode-toggle-dm.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/colormode-toggle-lm.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/psdi-icon-dark.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/psdi-icon-light.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/psdi-logo-darktext-simple.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/psdi-logo-darktext.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/psdi-logo-lighttext-simple.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/psdi-logo-lighttext.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-bluesky-black.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-bluesky-white.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-instagram-black.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-instagram-white.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-linkedin-black.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-linkedin-white.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-mastodon-black.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-mastodon-white.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-x-black.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-x-white.svg +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-youtube-black.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/social-logo-youtube-white.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/ukri-epsr-logo-darktext.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/ukri-epsr-logo-lighttext.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/ukri-logo-darktext.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/img/ukri-logo-lighttext.png +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/accessibility.js +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/common.js +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/convert.js +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/convert_common.js +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/convertato.js +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/convertc2x.js +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/load_accessibility.js +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/psdi-common.js +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/javascript/report.js +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/styles/format.css +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/static/styles/psdi-common.css +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/testing/__init__.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/scripts/setup_bin.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/1ARJ.mmcif +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/1NE6.mmcif +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/5a9z-assembly1.cif +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/Fapatite.ins +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/aceticacid.mol +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/benzyne.molden +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/caffeine-smi.tar +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/caffeine-smi.tar.gz +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/caffeine-smi.zip +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/caffeine.inchi +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/ch3cl-esp.cub +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/cyclopropane_err.mol +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/ethanol.xyz +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/fullRhinovirus.pdb +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/hemoglobin.pdb +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/nacl.cif +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/nacl.mol +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/aceticacid.log.txt +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/aceticacid.mol2 +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/caffeine-2D-fastest.xyz +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/caffeine-3D-best.xyz +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/caffeine.smi +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/caffeine.xyz +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/caffeine_a_in.smi +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/caffeine_a_in_kx_f4_l5_out.smi +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/caffeine_a_in_kx_f4_out.smi +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/caffeine_a_in_kx_out.smi +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/caffeine_a_in_x_out.smi +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/hemoglobin_Atomsk.xyz +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/hemoglobin_c2x.xyz +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/nacl.log +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/nacl.mol +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/quartz_OB.cif +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/quartz_OB.log.txt +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/quartz_atomsk.cif +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/quartz_atomsk.log.txt +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/standard_test.inchi +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/xyz_files-mol.zip +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/output/xyz_files.log.txt +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/periodic_dmol3.outmol +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/quartz.xyz +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/quartz_err.xyz +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/test_data/standard_test.cdxml +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/tests/python/dist_test.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/tests/python/file_io_test.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/tests/python/logging_test.py +0 -0
- {psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/tests/python/security_test.py +0 -0
@@ -1,13 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: psdi_data_conversion
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.38
|
4
4
|
Summary: Chemistry file format conversion service, provided by PSDI
|
5
5
|
Project-URL: Homepage, https://data-conversion.psdi.ac.uk/
|
6
6
|
Project-URL: Documentation, https://psdi-uk.github.io/psdi-data-conversion/
|
7
|
-
Project-URL: Repository, https://github.com/PSDI-UK/psdi-data-conversion
|
8
7
|
Project-URL: Issues, https://github.com/PSDI-UK/psdi-data-conversion/issues
|
9
8
|
Project-URL: Changelog, https://github.com/PSDI-UK/psdi-data-conversion/blob/main/CHANGELOG.md
|
10
|
-
Project-URL: Download, https://github.com/PSDI-UK/psdi-data-conversion/releases/latest
|
11
9
|
Author: Ray Whorley, Don Cruickshank, Tom Underwood
|
12
10
|
Author-email: Samantha Pearman-Kanza <s.pearman-kanza@soton.ac.uk>, Bryan Gillis <7204836+brgillis@users.noreply.github.com>
|
13
11
|
License: Apache License
|
@@ -245,7 +243,7 @@ Description-Content-Type: text/markdown
|
|
245
243
|
|
246
244
|
# PSDI Data Conversion
|
247
245
|
|
248
|
-
Version: Pre-release 2024-
|
246
|
+
Version: Pre-release 2024-04-14
|
249
247
|
|
250
248
|
This is the repository for the PSDI PF2 Chemistry File Format Conversion project. The goal of this project is to provide utilities to assist in converting files between the many different file formats used in chemistry, providing information on what converters are available for a given conversion and the expected quality of it, and providing multiple interfaces to perform these conversions. These interfaces are:
|
251
249
|
|
@@ -281,6 +279,10 @@ This is the repository for the PSDI PF2 Chemistry File Format Conversion project
|
|
281
279
|
- [Troubleshooting](#troubleshooting)
|
282
280
|
- [OSError: [Errno 24] Too many open files](#oserror-errno-24-too-many-open-files)
|
283
281
|
- [Errors running c2x or Atomsk converters](#errors-running-c2x-or-atomsk-converters)
|
282
|
+
- [A supported conversion fails](#a-supported-conversion-fails)
|
283
|
+
- [Input file is malformatted or corrupt](#input-file-is-malformatted-or-corrupt)
|
284
|
+
- [Input file's format is misidentified](#input-files-format-is-misidentified)
|
285
|
+
- [Other known issues](#other-known-issues)
|
284
286
|
- [Licensing](#licensing)
|
285
287
|
- [Contributors](#contributors)
|
286
288
|
- [Funding](#funding)
|
@@ -473,6 +475,24 @@ options] [-s/--strict] [--nc/--no-check] [-q/--quiet] [-g/--log-file <log file n
|
|
473
475
|
|
474
476
|
Call `psdi-data-convert -h` for details on each of these options.
|
475
477
|
|
478
|
+
Note that some requested conversions may involve ambiguous formats which share the same extension. In this case, the application will print a warning and list possible matching formats, with a disambiguating name that can be used to specify which one. For instance, the `c2x` converter can convert into two variants of the `pdb` format, and if you ask it to convert to `pdb` without specifying which one, you'll see:
|
479
|
+
|
480
|
+
```
|
481
|
+
ERROR: Extension 'pdb' is ambiguous and must be defined by ID. Possible formats and their IDs are:
|
482
|
+
9: pdb-0 (Protein Data Bank)
|
483
|
+
259: pdb-1 (Protein Data Bank with atoms numbered)
|
484
|
+
```
|
485
|
+
|
486
|
+
This provides the IDs ("9" and "259") and disambiguating names ("pdb-0" and "pdb-1") for the matching formats. Either can be used in the call to the converter, e.g.:
|
487
|
+
|
488
|
+
```bash
|
489
|
+
psdi-data-conversion nacl.cif -t 9 -w c2x
|
490
|
+
# Or equivalently:
|
491
|
+
psdi-data-conversion nacl.cif -t pdb-0 -w c2x
|
492
|
+
```
|
493
|
+
|
494
|
+
The "<format>-0" pattern can be used with any format, even if it's unambiguous, and will be interpreted as the first instance of the format in the database with valid conversions. Note that as the database expands in future versions and more valid conversions are added, these disambiguated names may change, so it is recommended to use the format's ID in scripts and with the library to ensure consistency between versions of this package.
|
495
|
+
|
476
496
|
#### Requesting Information on Possible Conversions
|
477
497
|
|
478
498
|
The script can also be used to get information on possible conversions by providing the `-l/--list` argument:
|
@@ -547,6 +567,8 @@ Where `filename` is the name of the file to convert (either fully-qualified or r
|
|
547
567
|
|
548
568
|
See the method's documentation via `help(run_converter)` after importing it for further details on usage.
|
549
569
|
|
570
|
+
Note that as with running the application through the command-line, some extra care may be needed in the case that the input or output format is ambiguous - see the [Data Conversion](#data-conversion) section above for more details on this. As with running through the command-line, a format's ID or disambiguated name must be used in the case of ambiguity.
|
571
|
+
|
550
572
|
#### `constants`
|
551
573
|
|
552
574
|
This package defines most constants used in the package. It may be imported via:
|
@@ -608,6 +630,8 @@ Once installed, the command-line script `psdi-data-convert-gui` will be made ava
|
|
608
630
|
In case of problems when using Chrome, try opening Chrome from the command line:
|
609
631
|
open -a "Google Chrome.app" --args --allow-file-access-from-files
|
610
632
|
|
633
|
+
The local version has some customisable options for running it, which can can be seen by running `psdi-data-convert-gui --help`. Most of these are only useful for development, but one notable setting is `--max-file-size-ob`, which sets the maximum allowed filesize for conversions with the Open Babel converter in megabytes. This is set to 1 MB by default, since Open Babel has a known bug which causes it to hang indefinitely for some conversions over this size (such as from large `mmcif` files). This can be set to a higher value (or to 0 to disable the limit) if the user wishes to disable this safeguard.
|
634
|
+
|
611
635
|
## Extending Functionality
|
612
636
|
|
613
637
|
The Python library and CLA are written to make it easy to extend the functionality of this package to use other file format converters. This can be done by downloading or cloning the project's source from it's GitHub Repository (https://github.com/PSDI-UK/psdi-data-conversion), editing the code to add your converter following the guidance in the "[Adding File Format Converters](https://github.com/PSDI-UK/psdi-data-conversion/blob/main/CONTRIBUTING.md#adding-file-format-converters)" section of CONTRIBUTING.md to integrate it with the Python code, and installing the modified package on your system via:
|
@@ -691,6 +715,66 @@ Alternatively, you can run your own versions of the `c2x` and `atomsk` binaries
|
|
691
715
|
|
692
716
|
On the other hand, it's possible that an error of this sort will occur if you have a non-working binary of one of these converters in your `$PATH`. If this might be the case, you can try removing it and see if the prepackaged binary works for you, or else recompile it to try to fix errors.
|
693
717
|
|
718
|
+
### A supported conversion fails
|
719
|
+
|
720
|
+
Here we'll go over some of the most common reasons that a supported conversion might fail, and what can be done to fix the issue.
|
721
|
+
|
722
|
+
#### Input file is malformatted or corrupt
|
723
|
+
|
724
|
+
Usually if there is a problem with the input file, the error message you receive should indicate some difficulty reading it. If the error message indicates this might be the issue, try the following:
|
725
|
+
|
726
|
+
Check the validity of the input file, ideally using another tool which can read in a file of its type, and confirm that it can be read successfully. This doesn't guarantee that the file is valid, as some utilities are tolerant to some formatting errors, but if you get an error here, then you know the issue is with the file. If the file can be read by another utility, see if the conversion you're attempting is supported by another converter - it might be that the file has a negligible issue that another converter is able to ignore.
|
727
|
+
|
728
|
+
If you've confirmed that the input file is malformatted or corrupt, see if it's possible to regenerate it or fix it manually. There may be a bug in the program which generated it - if this is under your control, check the format's documentation to help fix it. Otherwise, you can see if you can use the format's documentation as a guide to manually fix the file.
|
729
|
+
|
730
|
+
#### Input file's format is misidentified
|
731
|
+
|
732
|
+
If you've followed the steps in the previous section and confirmed that the input file is valid, but you're still having issues with it, one possibility is that this application is misidentifying the file's format. This can happen if you've given the file an extension which isn't expected of its format, or in rare cases where an extension is shared by multiple formats.
|
733
|
+
|
734
|
+
To remedy this, try explicitly specifying the format, rather than letting the application guess it from the extension. You can see all supported formats by running `psdi-data-convert -l`, and then get details on one with `psdi-data-convert -l -f <format>` to confirm that it's the correct format. You can then call the conversion script with the argument `-f <format>`, or within Python make a call to the library with `run_converter(..., from_format=<format>)` to specify the format.
|
735
|
+
|
736
|
+
`<format>` here can be the standard extension of the format (in the case of unambiguous extensions), its ID, or its disambiguated name. To give an example which explains what each of these are, let's say you have an MDL MOL file you wish to convert to XYZ, so you get information about it and possible converters with `psdi-data-convert -l -f mol -t xyz`:
|
737
|
+
|
738
|
+
```base
|
739
|
+
$ psdi-data-convert -l -f mol
|
740
|
+
WARNING: Format 'mol' is ambiguous and could refer to multiple formats. It may be necessary to explicitly specify which
|
741
|
+
you want to use when calling this script, e.g. with '-f mol-0' - see the disambiguated names in the list below:
|
742
|
+
|
743
|
+
18: mol-0 (MDL MOL)
|
744
|
+
216: mol-1 (MOLDY)
|
745
|
+
|
746
|
+
20: xyz (XYZ cartesian coordinates)
|
747
|
+
|
748
|
+
The following registered converters can convert from mol-0 to xyz:
|
749
|
+
|
750
|
+
Open Babel
|
751
|
+
c2x
|
752
|
+
|
753
|
+
For details on input/output flags and options allowed by a converter for this conversion, call:
|
754
|
+
psdi-data-convert -l <converter name> -f mol-0 -t xyz
|
755
|
+
|
756
|
+
The following registered converters can convert from mol-1 to xyz:
|
757
|
+
|
758
|
+
Atomsk
|
759
|
+
|
760
|
+
For details on input/output flags and options allowed by a converter for this conversion, call:
|
761
|
+
psdi-data-convert -l <converter name> -f mol-1 -t xyz
|
762
|
+
```
|
763
|
+
|
764
|
+
This output indicates that the application is aware of two formats which share the `mol` extension: MDL MOL and MOLDY. It lists the ID, disambiguated name, and description of each: ID `18` and disambiguated name `mol-0` for MDL MOL, and ID `216` and disambiguated name `mol-1` for MOLDY. The XYZ format, on the other hand, is unambiguous, and only lists the standard extension for it as its disambiguated name (although `xyz-0` will be accepted without error as well).
|
765
|
+
|
766
|
+
The program then lists converters which can handle the requested conversion, revealing a potential pitfall: The Open Babel and c2x converters can convert from MDL MOL to XYZ, which the Atomsk converter can convert from MOLDY to XYZ. If you don't specify which format you're converting from, the script might assume you meant to use the other one, if that's the only one compatible with the converter you've requested (or with the default converter, Open Babel, if you didn't explicitly request one). So to be careful here, it's best to specify this input format unambiguously.
|
767
|
+
|
768
|
+
Since in this example you have an MDL MOL file, you would use `-f 18` or `-f mol-0` to explicitly specify it in the command-line, or similarly provide one of these to the `from_format` argument of `run_converter` within Python. The application will then properly handle it, including alerting you if you request a conversion that isn't supported by your requested converter (e.g. if you request a conversion of this MDL MOL file to XYZ with Atomsk).
|
769
|
+
|
770
|
+
Important note: The disambiguated name is generated dynamically and isn't stored in the database, and in rare cases may change for some formats in future versions of this application which expand support to more formats and conversions. For uses which require forward-compatibility with future versions of this application, the ID should be used instead.
|
771
|
+
|
772
|
+
#### Other known issues
|
773
|
+
|
774
|
+
Through testing, we've identified some other conversion issues, which we list here:
|
775
|
+
|
776
|
+
- Open Babel will indefinitely hang when attempting to convert large files (more than ~1 MB) of certain types (such as `mmcif`). This is an issue with the converter itself and not our application, which we hope will be fixed in a future version. If this occurs, the job will have to be forcibly terminated. CTRL+C will fail to terminate it, but it can be stopped with CTRL+Z, then terminated with `kill %N`, where N is the number listed beside the job when it is stopped (usually 1). The conversion should then be attempted with another supported converter.
|
777
|
+
|
694
778
|
## Licensing
|
695
779
|
|
696
780
|
This project is provided under the Apache License version 2.0, the terms of which can be found in the file `LICENSE`.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# PSDI Data Conversion
|
2
2
|
|
3
|
-
Version: Pre-release 2024-
|
3
|
+
Version: Pre-release 2024-04-14
|
4
4
|
|
5
5
|
This is the repository for the PSDI PF2 Chemistry File Format Conversion project. The goal of this project is to provide utilities to assist in converting files between the many different file formats used in chemistry, providing information on what converters are available for a given conversion and the expected quality of it, and providing multiple interfaces to perform these conversions. These interfaces are:
|
6
6
|
|
@@ -36,6 +36,10 @@ This is the repository for the PSDI PF2 Chemistry File Format Conversion project
|
|
36
36
|
- [Troubleshooting](#troubleshooting)
|
37
37
|
- [OSError: [Errno 24] Too many open files](#oserror-errno-24-too-many-open-files)
|
38
38
|
- [Errors running c2x or Atomsk converters](#errors-running-c2x-or-atomsk-converters)
|
39
|
+
- [A supported conversion fails](#a-supported-conversion-fails)
|
40
|
+
- [Input file is malformatted or corrupt](#input-file-is-malformatted-or-corrupt)
|
41
|
+
- [Input file's format is misidentified](#input-files-format-is-misidentified)
|
42
|
+
- [Other known issues](#other-known-issues)
|
39
43
|
- [Licensing](#licensing)
|
40
44
|
- [Contributors](#contributors)
|
41
45
|
- [Funding](#funding)
|
@@ -228,6 +232,24 @@ options] [-s/--strict] [--nc/--no-check] [-q/--quiet] [-g/--log-file <log file n
|
|
228
232
|
|
229
233
|
Call `psdi-data-convert -h` for details on each of these options.
|
230
234
|
|
235
|
+
Note that some requested conversions may involve ambiguous formats which share the same extension. In this case, the application will print a warning and list possible matching formats, with a disambiguating name that can be used to specify which one. For instance, the `c2x` converter can convert into two variants of the `pdb` format, and if you ask it to convert to `pdb` without specifying which one, you'll see:
|
236
|
+
|
237
|
+
```
|
238
|
+
ERROR: Extension 'pdb' is ambiguous and must be defined by ID. Possible formats and their IDs are:
|
239
|
+
9: pdb-0 (Protein Data Bank)
|
240
|
+
259: pdb-1 (Protein Data Bank with atoms numbered)
|
241
|
+
```
|
242
|
+
|
243
|
+
This provides the IDs ("9" and "259") and disambiguating names ("pdb-0" and "pdb-1") for the matching formats. Either can be used in the call to the converter, e.g.:
|
244
|
+
|
245
|
+
```bash
|
246
|
+
psdi-data-conversion nacl.cif -t 9 -w c2x
|
247
|
+
# Or equivalently:
|
248
|
+
psdi-data-conversion nacl.cif -t pdb-0 -w c2x
|
249
|
+
```
|
250
|
+
|
251
|
+
The "<format>-0" pattern can be used with any format, even if it's unambiguous, and will be interpreted as the first instance of the format in the database with valid conversions. Note that as the database expands in future versions and more valid conversions are added, these disambiguated names may change, so it is recommended to use the format's ID in scripts and with the library to ensure consistency between versions of this package.
|
252
|
+
|
231
253
|
#### Requesting Information on Possible Conversions
|
232
254
|
|
233
255
|
The script can also be used to get information on possible conversions by providing the `-l/--list` argument:
|
@@ -302,6 +324,8 @@ Where `filename` is the name of the file to convert (either fully-qualified or r
|
|
302
324
|
|
303
325
|
See the method's documentation via `help(run_converter)` after importing it for further details on usage.
|
304
326
|
|
327
|
+
Note that as with running the application through the command-line, some extra care may be needed in the case that the input or output format is ambiguous - see the [Data Conversion](#data-conversion) section above for more details on this. As with running through the command-line, a format's ID or disambiguated name must be used in the case of ambiguity.
|
328
|
+
|
305
329
|
#### `constants`
|
306
330
|
|
307
331
|
This package defines most constants used in the package. It may be imported via:
|
@@ -363,6 +387,8 @@ Once installed, the command-line script `psdi-data-convert-gui` will be made ava
|
|
363
387
|
In case of problems when using Chrome, try opening Chrome from the command line:
|
364
388
|
open -a "Google Chrome.app" --args --allow-file-access-from-files
|
365
389
|
|
390
|
+
The local version has some customisable options for running it, which can can be seen by running `psdi-data-convert-gui --help`. Most of these are only useful for development, but one notable setting is `--max-file-size-ob`, which sets the maximum allowed filesize for conversions with the Open Babel converter in megabytes. This is set to 1 MB by default, since Open Babel has a known bug which causes it to hang indefinitely for some conversions over this size (such as from large `mmcif` files). This can be set to a higher value (or to 0 to disable the limit) if the user wishes to disable this safeguard.
|
391
|
+
|
366
392
|
## Extending Functionality
|
367
393
|
|
368
394
|
The Python library and CLA are written to make it easy to extend the functionality of this package to use other file format converters. This can be done by downloading or cloning the project's source from it's GitHub Repository (https://github.com/PSDI-UK/psdi-data-conversion), editing the code to add your converter following the guidance in the "[Adding File Format Converters](https://github.com/PSDI-UK/psdi-data-conversion/blob/main/CONTRIBUTING.md#adding-file-format-converters)" section of CONTRIBUTING.md to integrate it with the Python code, and installing the modified package on your system via:
|
@@ -446,6 +472,66 @@ Alternatively, you can run your own versions of the `c2x` and `atomsk` binaries
|
|
446
472
|
|
447
473
|
On the other hand, it's possible that an error of this sort will occur if you have a non-working binary of one of these converters in your `$PATH`. If this might be the case, you can try removing it and see if the prepackaged binary works for you, or else recompile it to try to fix errors.
|
448
474
|
|
475
|
+
### A supported conversion fails
|
476
|
+
|
477
|
+
Here we'll go over some of the most common reasons that a supported conversion might fail, and what can be done to fix the issue.
|
478
|
+
|
479
|
+
#### Input file is malformatted or corrupt
|
480
|
+
|
481
|
+
Usually if there is a problem with the input file, the error message you receive should indicate some difficulty reading it. If the error message indicates this might be the issue, try the following:
|
482
|
+
|
483
|
+
Check the validity of the input file, ideally using another tool which can read in a file of its type, and confirm that it can be read successfully. This doesn't guarantee that the file is valid, as some utilities are tolerant to some formatting errors, but if you get an error here, then you know the issue is with the file. If the file can be read by another utility, see if the conversion you're attempting is supported by another converter - it might be that the file has a negligible issue that another converter is able to ignore.
|
484
|
+
|
485
|
+
If you've confirmed that the input file is malformatted or corrupt, see if it's possible to regenerate it or fix it manually. There may be a bug in the program which generated it - if this is under your control, check the format's documentation to help fix it. Otherwise, you can see if you can use the format's documentation as a guide to manually fix the file.
|
486
|
+
|
487
|
+
#### Input file's format is misidentified
|
488
|
+
|
489
|
+
If you've followed the steps in the previous section and confirmed that the input file is valid, but you're still having issues with it, one possibility is that this application is misidentifying the file's format. This can happen if you've given the file an extension which isn't expected of its format, or in rare cases where an extension is shared by multiple formats.
|
490
|
+
|
491
|
+
To remedy this, try explicitly specifying the format, rather than letting the application guess it from the extension. You can see all supported formats by running `psdi-data-convert -l`, and then get details on one with `psdi-data-convert -l -f <format>` to confirm that it's the correct format. You can then call the conversion script with the argument `-f <format>`, or within Python make a call to the library with `run_converter(..., from_format=<format>)` to specify the format.
|
492
|
+
|
493
|
+
`<format>` here can be the standard extension of the format (in the case of unambiguous extensions), its ID, or its disambiguated name. To give an example which explains what each of these are, let's say you have an MDL MOL file you wish to convert to XYZ, so you get information about it and possible converters with `psdi-data-convert -l -f mol -t xyz`:
|
494
|
+
|
495
|
+
```base
|
496
|
+
$ psdi-data-convert -l -f mol
|
497
|
+
WARNING: Format 'mol' is ambiguous and could refer to multiple formats. It may be necessary to explicitly specify which
|
498
|
+
you want to use when calling this script, e.g. with '-f mol-0' - see the disambiguated names in the list below:
|
499
|
+
|
500
|
+
18: mol-0 (MDL MOL)
|
501
|
+
216: mol-1 (MOLDY)
|
502
|
+
|
503
|
+
20: xyz (XYZ cartesian coordinates)
|
504
|
+
|
505
|
+
The following registered converters can convert from mol-0 to xyz:
|
506
|
+
|
507
|
+
Open Babel
|
508
|
+
c2x
|
509
|
+
|
510
|
+
For details on input/output flags and options allowed by a converter for this conversion, call:
|
511
|
+
psdi-data-convert -l <converter name> -f mol-0 -t xyz
|
512
|
+
|
513
|
+
The following registered converters can convert from mol-1 to xyz:
|
514
|
+
|
515
|
+
Atomsk
|
516
|
+
|
517
|
+
For details on input/output flags and options allowed by a converter for this conversion, call:
|
518
|
+
psdi-data-convert -l <converter name> -f mol-1 -t xyz
|
519
|
+
```
|
520
|
+
|
521
|
+
This output indicates that the application is aware of two formats which share the `mol` extension: MDL MOL and MOLDY. It lists the ID, disambiguated name, and description of each: ID `18` and disambiguated name `mol-0` for MDL MOL, and ID `216` and disambiguated name `mol-1` for MOLDY. The XYZ format, on the other hand, is unambiguous, and only lists the standard extension for it as its disambiguated name (although `xyz-0` will be accepted without error as well).
|
522
|
+
|
523
|
+
The program then lists converters which can handle the requested conversion, revealing a potential pitfall: The Open Babel and c2x converters can convert from MDL MOL to XYZ, which the Atomsk converter can convert from MOLDY to XYZ. If you don't specify which format you're converting from, the script might assume you meant to use the other one, if that's the only one compatible with the converter you've requested (or with the default converter, Open Babel, if you didn't explicitly request one). So to be careful here, it's best to specify this input format unambiguously.
|
524
|
+
|
525
|
+
Since in this example you have an MDL MOL file, you would use `-f 18` or `-f mol-0` to explicitly specify it in the command-line, or similarly provide one of these to the `from_format` argument of `run_converter` within Python. The application will then properly handle it, including alerting you if you request a conversion that isn't supported by your requested converter (e.g. if you request a conversion of this MDL MOL file to XYZ with Atomsk).
|
526
|
+
|
527
|
+
Important note: The disambiguated name is generated dynamically and isn't stored in the database, and in rare cases may change for some formats in future versions of this application which expand support to more formats and conversions. For uses which require forward-compatibility with future versions of this application, the ID should be used instead.
|
528
|
+
|
529
|
+
#### Other known issues
|
530
|
+
|
531
|
+
Through testing, we've identified some other conversion issues, which we list here:
|
532
|
+
|
533
|
+
- Open Babel will indefinitely hang when attempting to convert large files (more than ~1 MB) of certain types (such as `mmcif`). This is an issue with the converter itself and not our application, which we hope will be fixed in a future version. If this occurs, the job will have to be forcibly terminated. CTRL+C will fail to terminate it, but it can be stopped with CTRL+Z, then terminated with `kill %N`, where N is the number listed beside the job when it is stopped (usually 1). The conversion should then be attempted with another supported converter.
|
534
|
+
|
449
535
|
## Licensing
|
450
536
|
|
451
537
|
This project is provided under the Apache License version 2.0, the terms of which can be found in the file `LICENSE`.
|
@@ -19,6 +19,7 @@ import psdi_data_conversion
|
|
19
19
|
from psdi_data_conversion import log_utility
|
20
20
|
from psdi_data_conversion import constants as const
|
21
21
|
from psdi_data_conversion.converter import run_converter
|
22
|
+
from psdi_data_conversion.database import FormatInfo, get_format_info
|
22
23
|
from psdi_data_conversion.file_io import split_archive_ext
|
23
24
|
|
24
25
|
# Env var for the SHA of the latest commit
|
@@ -139,13 +140,38 @@ def convert():
|
|
139
140
|
qualified_output_log = os.path.join(const.DEFAULT_DOWNLOAD_DIR,
|
140
141
|
split_archive_ext(filename)[0] + const.OUTPUT_LOG_EXT)
|
141
142
|
|
143
|
+
# Determine the input and output formats
|
144
|
+
d_formats = {}
|
145
|
+
for format_label in "to", "from":
|
146
|
+
name = request.form[format_label]
|
147
|
+
full_note = request.form[format_label+"_full"]
|
148
|
+
|
149
|
+
l_possible_formats: list[FormatInfo] = get_format_info(name, which="all")
|
150
|
+
|
151
|
+
# If there's only one possible format, use that
|
152
|
+
if len(l_possible_formats) == 1:
|
153
|
+
d_formats[format_label] = l_possible_formats[0]
|
154
|
+
continue
|
155
|
+
|
156
|
+
# Otherwise, find the format with the matching note
|
157
|
+
found = False
|
158
|
+
for possible_format in l_possible_formats:
|
159
|
+
if possible_format.note in full_note:
|
160
|
+
d_formats[format_label] = possible_format
|
161
|
+
found = True
|
162
|
+
break
|
163
|
+
if not found:
|
164
|
+
print(f"Format '{name}' with full description '{full_note}' could not be found in database.",
|
165
|
+
file=sys.stderr)
|
166
|
+
abort(const.STATUS_CODE_GENERAL)
|
167
|
+
|
142
168
|
if (not service_mode) or (request.form['token'] == token and token != ''):
|
143
169
|
try:
|
144
170
|
conversion_output = run_converter(name=request.form['converter'],
|
145
171
|
filename=qualified_filename,
|
146
172
|
data=request.form,
|
147
|
-
to_format=
|
148
|
-
from_format=
|
173
|
+
to_format=d_formats["to"],
|
174
|
+
from_format=d_formats["from"],
|
149
175
|
strict=(request.form['check_ext'] != "false"),
|
150
176
|
log_mode=log_mode,
|
151
177
|
log_level=log_level,
|
@@ -286,10 +312,10 @@ def main():
|
|
286
312
|
"variables and their defaults will instead control execution. These defaults will result in "
|
287
313
|
"the app running in production server mode.")
|
288
314
|
|
289
|
-
parser.add_argument("--max-file-size", type=float, default=const.DEFAULT_MAX_FILE_SIZE,
|
315
|
+
parser.add_argument("--max-file-size", type=float, default=const.DEFAULT_MAX_FILE_SIZE/const.MEGABYTE,
|
290
316
|
help="The maximum allowed filesize in MB - 0 (default) indicates no maximum")
|
291
317
|
|
292
|
-
parser.add_argument("--max-file-size-ob", type=float, default=const.DEFAULT_MAX_FILE_SIZE_OB,
|
318
|
+
parser.add_argument("--max-file-size-ob", type=float, default=const.DEFAULT_MAX_FILE_SIZE_OB/const.MEGABYTE,
|
293
319
|
help="The maximum allowed filesize in MB for the Open Babel converter, taking precendence over "
|
294
320
|
"the general maximum file size when Open Babel is used - 0 indicates no maximum. Default 1 MB.")
|
295
321
|
|
{psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/constants.py
RENAMED
@@ -45,10 +45,11 @@ MAX_FILESIZE_OB_EV = "MAX_FILESIZE_OB"
|
|
45
45
|
# Files and Folders
|
46
46
|
# -----------------
|
47
47
|
|
48
|
-
# Maximum output file size in bytes
|
49
48
|
MEGABYTE = 1024*1024
|
50
|
-
|
51
|
-
|
49
|
+
|
50
|
+
# Maximum output file size in bytes
|
51
|
+
DEFAULT_MAX_FILE_SIZE = 0 * MEGABYTE
|
52
|
+
DEFAULT_MAX_FILE_SIZE_OB = 1 * MEGABYTE
|
52
53
|
|
53
54
|
DEFAULT_UPLOAD_DIR = './psdi_data_conversion/static/uploads'
|
54
55
|
DEFAULT_DOWNLOAD_DIR = './psdi_data_conversion/static/downloads'
|
@@ -75,7 +76,7 @@ XZTAR_FORMAT = "xztar"
|
|
75
76
|
D_TAR_FORMATS = {TAR_EXTENSION: TAR_FORMAT,
|
76
77
|
GZTAR_EXTENSION: GZTAR_FORMAT,
|
77
78
|
BZTAR_EXTENSION: BZTAR_FORMAT,
|
78
|
-
XZTAR_EXTENSION:
|
79
|
+
XZTAR_EXTENSION: XZTAR_FORMAT}
|
79
80
|
|
80
81
|
# A list of specifically the extensions that are combinations of multiple different extensions
|
81
82
|
L_COMPOUND_EXTENSIONS = [GZTAR_EXTENSION, BZTAR_EXTENSION, XZTAR_EXTENSION]
|
@@ -93,7 +94,7 @@ L_ALL_ARCHIVE_EXTENSIONS = [*D_SUPPORTED_ARCHIVE_FORMATS.keys(), *L_UNSUPPORTED_
|
|
93
94
|
|
94
95
|
# Number of character spaces allocated for flags/options
|
95
96
|
|
96
|
-
# Get the terminal width so we can prettily print help text
|
97
|
+
# Get the terminal width so we can prettily print help text - default to 80 chars by 20 lines
|
97
98
|
TERM_WIDTH, _ = shutil.get_terminal_size((80, 20))
|
98
99
|
|
99
100
|
# Log formatting
|
{psdi_data_conversion-0.0.37 → psdi_data_conversion-0.0.38}/psdi_data_conversion/converter.py
RENAMED
@@ -196,7 +196,7 @@ class FileConversionRunResult:
|
|
196
196
|
|
197
197
|
|
198
198
|
def check_from_format(filename: str,
|
199
|
-
from_format: str,
|
199
|
+
from_format: str | int,
|
200
200
|
strict=False) -> bool:
|
201
201
|
"""Check that the filename for an input file ends with the expected extension
|
202
202
|
|
@@ -204,7 +204,7 @@ def check_from_format(filename: str,
|
|
204
204
|
----------
|
205
205
|
filename : str
|
206
206
|
The filename
|
207
|
-
from_format : str
|
207
|
+
from_format : str | int
|
208
208
|
The expected format (extension)
|
209
209
|
strict : bool, optional
|
210
210
|
If True, will raise an exception on failure. Otherwise will print a warning and return False
|
@@ -220,14 +220,21 @@ def check_from_format(filename: str,
|
|
220
220
|
If `strict` is True and the the file does not end with the expected exception
|
221
221
|
"""
|
222
222
|
|
223
|
+
# Get the name of the format
|
224
|
+
if isinstance(from_format, str):
|
225
|
+
from_format_name = from_format
|
226
|
+
else:
|
227
|
+
from psdi_data_conversion.database import get_format_info
|
228
|
+
from_format_name = get_format_info(from_format).name
|
229
|
+
|
223
230
|
# Silently make sure `from_format` starts with a dot
|
224
|
-
if not
|
225
|
-
|
231
|
+
if not from_format_name.startswith("."):
|
232
|
+
from_format_name = f".{from_format}"
|
226
233
|
|
227
|
-
if filename.endswith(
|
234
|
+
if filename.endswith(from_format_name):
|
228
235
|
return True
|
229
236
|
|
230
|
-
msg = const.ERR_WRONG_EXTENSIONS.format(file=os.path.basename(filename), ext=
|
237
|
+
msg = const.ERR_WRONG_EXTENSIONS.format(file=os.path.basename(filename), ext=from_format_name)
|
231
238
|
|
232
239
|
if strict:
|
233
240
|
raise base.FileConverterInputException(msg)
|