Skip to content

Commit

Permalink
Move into package structure; add pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfG committed Jun 29, 2023
1 parent 85c2b25 commit 44db207
Show file tree
Hide file tree
Showing 9 changed files with 388 additions and 340 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ example/
__pycache__
**.mzml
test/

# Environment
.venv

# Builds
build/
dist/
*.egg-info/
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ pythonenv3.8
**.d
test/
**.DS_Store
.vscode
.vscode

# Environment
.venv

# Builds
build/
dist/
*.egg-info/
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[project]
name = "tdf2mzml"
description = "PythonConvert Bruker TDF format to MzML"
authors = [{name = "Michael A. Freitas"}]
readme = "README.md"
license = {file = "LICENSE.md"}
version = "0.1.0"
classifiers = [
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering :: Bio-Informatics",
]
requires-python = ">=3.8"
dependencies = [
"psims>=0.1.31",
"numpy>=1.18"
]

[project.urls]
Home = "https://github.com/mafreitas/tdf2mzml"

[project.scripts]
tdf2mzml = "tdf2mzml.tdf2mzml:main"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = {find = {include = ["tdf2mzml*"]}}
package-data = {tdf2mzml = ["*.so", "*.lib", "*.dll"]}
Empty file added tdf2mzml/__init__.py
Empty file.
File renamed without changes.
24 changes: 12 additions & 12 deletions tdf2mzml.py → tdf2mzml/tdf2mzml.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import sqlite3, sys, time
import sys
import time
import timsdata as timsdata
import tdf2mzml.timsdata as timsdata

NAME = 'tdf2mzml'
MAJOR_VERSION = '0.3'
Expand Down Expand Up @@ -54,7 +54,7 @@ def timing(f):
Returns
-------
funciton
new function wrap with timer and logging
new function wrap with timer and logging
"""
def wrap(*args):
time1 = time.time()
Expand Down Expand Up @@ -123,7 +123,7 @@ def sha1_checksum(path_name):

def centroid_precursor_frame(mzml_data_struct):
"""
Read and returns a centroid spectrum for a precursor frame
Read and returns a centroid spectrum for a precursor frame
This function uses the SDK to get and return an MS1 centroid spectrum for
the requested frame.
Expand All @@ -148,7 +148,7 @@ def centroid_precursor_frame(mzml_data_struct):

def profile_precursor_frame(mzml_data_struct):
"""
Read and return a profile spectrum for a precursor frame
Read and return a profile spectrum for a precursor frame
This function uses the SDK to get and return an MS1 profile spectrum for
the requested frame.
Expand All @@ -165,7 +165,7 @@ def profile_precursor_frame(mzml_data_struct):
"""
precursor_frame_id = mzml_data_struct['current_precursor']['id']
num_scans = mzml_data_struct['td'].conn.execute("SELECT NumScans FROM Frames WHERE Id={}".format(precursor_frame_id)).fetchone()[0]

#SDK takes 0-num_scans as input.
i_array = mzml_data_struct['td'].extractProfileForFrame(precursor_frame_id, 0, num_scans)

Expand All @@ -180,7 +180,7 @@ def profile_precursor_frame(mzml_data_struct):

def raw_precursor_frame(mzml_data_struct):
"""
Read and return a raw spectrum for a precursor frame
Read and return a raw spectrum for a precursor frame
This function simply adds together the ms1 spectra to create a raw MS1 spectrum
for the requested frame.
Expand Down Expand Up @@ -229,7 +229,7 @@ def get_spectrum_dict(mzml_data_struct):
Returns
-------
dict:
dict:
spectrum dictionary
"""
spectrum_dict = collections.OrderedDict()
Expand Down Expand Up @@ -322,7 +322,7 @@ def get_spectrum_dict(mzml_data_struct):
# """
# Get the number of spectra for the conversion

# Helper function to determine number of spectra. This function rescans the
# Helper function to determine number of spectra. This function rescans the
# data file in order to account for the start and end frames.

# Parameters
Expand Down Expand Up @@ -716,7 +716,7 @@ def get_precursor_list(mzml_data_struct):
Returns
-------
list
list
list of precursor values
"""
# get MS2 spetrum for each precursor
Expand Down Expand Up @@ -924,13 +924,13 @@ def process_arg(args):
Parameters
----------
args :
args :
args manespace object from argspars
Returns
-------
dict :
dict :
dictionary of arguments
"""
return vars(args)
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 44db207

Please sign in to comment.