Skip to content

Commit

Permalink
Merge pull request #231 from MannLabs/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sander-willems-bruker authored Oct 17, 2022
2 parents a56f4a5 + e14e6a6 commit 0f1275a
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 23 deletions.
5 changes: 3 additions & 2 deletions alphatims/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


__project__ = "alphatims"
__version__ = "1.0.4"
__version__ = "1.0.5"
__license__ = "Apache"
__description__ = "A Python package to index Bruker TimsTOF raw data for fast and easy accession and visualization"
__author__ = "Sander Willems, Eugenia Voytik"
Expand All @@ -17,14 +17,15 @@
"bioinformatics",
"data indexing",
]
__python_version__ = ">=3.8,<3.10"
__python_version__ = ">=3.8,<4"
__classifiers__ = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering :: Bio-Informatics",
]
__console_scripts__ = [
Expand Down
2 changes: 1 addition & 1 deletion alphatims/bruker.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def parse_decompressed_bruker_binary_type2(decompressed_bytes: bytes) -> tuple:
last_scan = len(intensities) - np.sum(scan_indices[1:])
scan_indices[:-1] = scan_indices[1:]
scan_indices[-1] = last_scan
return scan_indices, tof_indices, intensities
return scan_indices, tof_indices - 1, intensities


@alphatims.utils.njit(nogil=True)
Expand Down
12 changes: 10 additions & 2 deletions alphatims/tempmmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,16 @@ def reset() -> str:
f"Folder {TEMP_DIR_NAME} with temp mmap arrays is being deleted. "
"All existing temp mmapp arrays will be unusable!"
)
for _array in ARRAYS.values():
_array[1].close()
import gc
for _array_name in list(ARRAYS.keys()):
_array_tuple = ARRAYS.pop(_array_name)
_array, _memmap = _array_tuple
del _array_tuple
_array.data.release()
del _array
gc.collect()
_memmap.close()
del _memmap
del _TEMP_DIR
_TEMP_DIR, TEMP_DIR_NAME = make_temp_dir()
ARRAYS = {}
Expand Down
8 changes: 6 additions & 2 deletions alphatims/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,16 +621,20 @@ def wrapper(iterable, *args):
threads.append(thread)
if include_progress_callback:
import time
if len(iterable) > 10**6:
granularity = 1000
else:
granularity = len(iterable)
# progress_count = 0
progress_bar = 0
progress_count = np.sum(progress_counter)
for result in progress_callback(
iterable,
range(granularity),
include_progress_callback=include_progress_callback
):
while progress_bar >= progress_count:
time.sleep(0.01)
progress_count = np.sum(progress_counter)
progress_count = granularity * np.sum(progress_counter) / len(iterable)
progress_bar += 1
for thread in threads:
thread.join()
Expand Down
2 changes: 1 addition & 1 deletion misc/bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.0.4
current_version = 1.0.5
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
Expand Down
2 changes: 1 addition & 1 deletion misc/one_click_linux/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: AlphaTims
Version: 1.0.4
Version: 1.0.5
Architecture: all
Maintainer: Mann Labs <[email protected]>
Description: AlphaTims GUI
Expand Down
2 changes: 1 addition & 1 deletion misc/one_click_linux/create_installer_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rm -rf dist
rm -rf build
python setup.py sdist bdist_wheel
cd misc/one_click_linux
pip install "../../dist/alphatims-1.0.4-py3-none-any.whl[plotting-stable,stable,legacy-stable]"
pip install "../../dist/alphatims-1.0.5-py3-none-any.whl[plotting-stable,stable,legacy-stable]"
pip install pyinstaller==4.10
pyinstaller ../pyinstaller/alphatims.spec -y
conda deactivate
Expand Down
4 changes: 2 additions & 2 deletions misc/one_click_macos/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<key>CFBundleIconFile</key>
<string>alpha_logo.icns</string>
<key>CFBundleIdentifier</key>
<string>alphatims.1.0.4</string>
<string>alphatims.1.0.5</string>
<key>CFBundleShortVersionString</key>
<string>1.0.4</string>
<string>1.0.5</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
6 changes: 3 additions & 3 deletions misc/one_click_macos/create_installer_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rm -rf build
python setup.py sdist bdist_wheel
cd misc/one_click_macos
pip install pyinstaller==4.10
pip install "../../dist/alphatims-1.0.4-py3-none-any.whl[plotting-stable,stable,legacy-stable]"
pip install "../../dist/alphatims-1.0.5-py3-none-any.whl[plotting-stable,stable,legacy-stable]"
conda list
pyinstaller ../pyinstaller/alphatims.spec -y
conda deactivate
Expand All @@ -34,7 +34,7 @@ if false; then
# https://scriptingosx.com/2019/09/notarize-a-command-line-tool/
for f in $(find dist/alphatims -name '*.so' -or -name '*.dylib'); do codesign --sign "Developer ID Application: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)" $f; done
codesign --sign "Developer ID Application: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)" dist/alphatims/Contents/MacOS/alphatims_gui --force --options=runtime --entitlements entitlements.xml
pkgbuild --root dist/alphatims --identifier de.mpg.biochem.alphatims.app --version 1.0.4 --install-location /Applications/AlphaTims.app --scripts scripts alphatims.pkg --sign "Developer ID Installer: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)"
pkgbuild --root dist/alphatims --identifier de.mpg.biochem.alphatims.app --version 1.0.5 --install-location /Applications/AlphaTims.app --scripts scripts alphatims.pkg --sign "Developer ID Installer: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)"
productbuild --distribution distribution.xml --resources Resources --package-path alphatims.pkg dist/alphatims_gui_installer_macos.pkg --sign "Developer ID Installer: Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (7QSY5527AQ)"
requestUUID=$(xcrun altool --notarize-app --primary-bundle-id "de.mpg.biochem.alphatims.app" --username "[email protected]" --password "@keychain:Alphatims-develop" --asc-provider 7QSY5527AQ --file dist/alphatims_gui_installer_macos.pkg 2>&1 | awk '/RequestUUID/ { print $NF; }')
request_status="in progress"
Expand All @@ -46,6 +46,6 @@ if false; then
xcrun altool --notarization-info "$requestUUID" --username "[email protected]" --password "@keychain:Alphatims-develop"
xcrun stapler staple dist/alphatims_gui_installer_macos.pkg
else
pkgbuild --root dist/alphatims --identifier de.mpg.biochem.alphatims.app --version 1.0.4 --install-location /Applications/AlphaTims.app --scripts scripts alphatims.pkg
pkgbuild --root dist/alphatims --identifier de.mpg.biochem.alphatims.app --version 1.0.5 --install-location /Applications/AlphaTims.app --scripts scripts alphatims.pkg
productbuild --distribution distribution.xml --resources Resources --package-path alphatims.pkg dist/alphatims_gui_installer_macos.pkg
fi
2 changes: 1 addition & 1 deletion misc/one_click_macos/distribution.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-script minSpecVersion="1.000000">
<title>AlphaTims 1.0.4</title>
<title>AlphaTims 1.0.5</title>
<background mime-type="image/png" file="alpha_logo.png" scaling="proportional"/>
<welcome file="welcome.html" mime-type="text/html" />
<conclusion file="conclusion.html" mime-type="text/html" />
Expand Down
2 changes: 1 addition & 1 deletion misc/one_click_windows/alphatims_innoinstaller.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "AlphaTims"
#define MyAppVersion "1.0.4"
#define MyAppVersion "1.0.5"
#define MyAppPublisher "Max Planck Institute of Biochemistry, Mann department"
#define MyAppURL "https://github.com/MannLabs/alphatims"
#define MyAppExeName "alphatims_gui.exe"
Expand Down
2 changes: 1 addition & 1 deletion misc/one_click_windows/create_installer_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ call rmdir dist /s /q
call rmdir build /s /q
call python setup.py sdist bdist_wheel
call cd misc/one_click_windows
call pip install "../../dist/alphatims-1.0.4-py3-none-any.whl[plotting-stable,stable,legacy-stable]"
call pip install "../../dist/alphatims-1.0.5-py3-none-any.whl[plotting-stable,stable,legacy-stable]"
call pip install pyinstaller==4.10
call pyinstaller ../pyinstaller/alphatims.spec -y
call conda deactivate
Expand Down
2 changes: 1 addition & 1 deletion misc/one_click_windows/create_installer_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rm -rf dist
rm -rf build
python setup.py sdist bdist_wheel
cd misc/one_click_windows
pip install "../../dist/alphatims-1.0.4-py3-none-any.whl[plotting-stable,stable,legacy-stable]"
pip install "../../dist/alphatims-1.0.5-py3-none-any.whl[plotting-stable,stable,legacy-stable]"
pip install pyinstaller==4.10
# TODO https://stackoverflow.com/questions/54175042/python-3-7-anaconda-environment-import-ssl-dll-load-fail-error/60405693#60405693
pyinstaller ../pyinstaller/alphatims.spec -y
Expand Down
2 changes: 2 additions & 0 deletions requirements/requirements_development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ plotly==4.12.0
seaborn==0.11.0
twine==4.0.0
bumpversion==0.6.0

pywin32; sys_platform=='win32'
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
extra_requirements[extra] = []
for line in requirements_file:
extra_requirements[extra_stable].append(line)
# conditional req like: "pywin32; sys_platform=='win32'"
line, *conditions = line.split(';')
requirement, *comparison = re.split("[><=~!]", line)
requirement == requirement.strip()
requirement = ";".join([requirement] + conditions)
extra_requirements[extra].append(requirement)

requirements = extra_requirements.pop("")
Expand All @@ -45,10 +48,7 @@
entry_points={
"console_scripts": package2install.__console_scripts__,
},
install_requires=requirements + [
# TODO Remove hardcoded requirement?
"pywin32==225; sys_platform=='win32'"
],
install_requires=requirements,
extras_require=extra_requirements,
python_requires=package2install.__python_version__,
)

0 comments on commit 0f1275a

Please sign in to comment.