Skip to content

Commit

Permalink
Merge branch 'bigbio:master' into extended
Browse files Browse the repository at this point in the history
  • Loading branch information
veitveit authored Aug 25, 2022
2 parents 874c7fa + 884c89f commit 96e2a69
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 25 deletions.
127 changes: 121 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,123 @@
.idea/
.idea*
dist/
build/
*egg-info/
# repo specific
/experimental_design.tsv
/openms.tsv
__pycache__

## Typical Python package ignorance

.DS_Store

.coverage
.pytest_cache
docs/api/_build

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
testing*
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# backup files
*~
*\?

# Jetbrains IDEs
.idea
pip-wheel-metadata
.vscode
.*.sw?
1 change: 1 addition & 0 deletions sdrf_pipelines/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.0.21"
1 change: 0 additions & 1 deletion sdrf_pipelines/maxquant/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

5 changes: 2 additions & 3 deletions sdrf_pipelines/maxquant/maxquant.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 09:46:14 2020
Expand Down Expand Up @@ -992,7 +991,7 @@ def maxquant_convert(
for j in range(arr.shape[1]):
arr[i][j] = sorted(arr[i])[j]

label_arr = np.array(list(set([tuple(t) for t in arr])))
label_arr = np.array(list({tuple(t) for t in arr}))
file2silac_shape[raw] = label_arr.shape
label_arr.sort()
if label_arr.shape[0] == 2: # Support two or three silac labels
Expand Down Expand Up @@ -1099,7 +1098,7 @@ def maxquant_convert(
fastaFilePath_node = doc.createElement("fastaFilePath")
fastaFilePath_node.appendChild(doc.createTextNode(fastaFilePath))
identifierParseRule = doc.createElement("identifierParseRule")
identifierParseRule.appendChild(doc.createTextNode(">([^\s]*)"))
identifierParseRule.appendChild(doc.createTextNode(r">([^\s]*)"))
descriptionParseRule = doc.createElement("descriptionParseRule")
descriptionParseRule.appendChild(doc.createTextNode(">(.*)"))
taxonomyParseRule = doc.createElement("taxonomyParseRule")
Expand Down
3 changes: 0 additions & 3 deletions sdrf_pipelines/msstats/msstats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-


import re

import pandas as pd
Expand Down
6 changes: 3 additions & 3 deletions sdrf_pipelines/openms/unimod.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def search_mods_by_keyword(self, keyword: str = None):
return found_list

def _get_elements(self, node):
for e in node.findall("%selements/%selem" % (self.xmlns, self.xmlns)):
for e in node.findall(f"{self.xmlns}elements/{self.xmlns}elem"):
ea = e.attrib
self.elements[ea["title"]] = ea
if re.match(r"[A-Z]", ea["title"][:1]):
self.elements["%s%s" % (int(round(float(ea["mono_mass"]))), ea["title"])] = ea
self.elements["{}{}".format(int(round(float(ea["mono_mass"]))), ea["title"])] = ea

def _get_modifications(self, node):
for e in node.findall("%smodifications/%smod" % (self.xmlns, self.xmlns)):
for e in node.findall(f"{self.xmlns}modifications/{self.xmlns}mod"):
ma = e.attrib
d = e.findall("%sdelta" % self.xmlns)[0]
for k in d.attrib.keys():
Expand Down
2 changes: 2 additions & 0 deletions sdrf_pipelines/parse_sdrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import click
import pandas as pd

from sdrf_pipelines import __version__
from sdrf_pipelines.maxquant.maxquant import Maxquant
from sdrf_pipelines.msstats.msstats import Msstats
from sdrf_pipelines.normalyzerde.normalyzerde import NormalyzerDE
Expand All @@ -22,6 +23,7 @@
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])


@click.version_option(version=__version__, package_name="sdrf_pipelines", message="%(package)s %(version)s")
@click.group(context_settings=CONTEXT_SETTINGS)
def cli():
"""
Expand Down
4 changes: 2 additions & 2 deletions sdrf_pipelines/sdrf/sdrf_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def default_message(self):
Return a message for the validation of the Ontology Term
:return:
"""
return "the term name or title can't be found in the ontology -- {}".format(self._ontology_name)
return f"the term name or title can't be found in the ontology -- {self._ontology_name}"

@staticmethod
def validate_ontology_terms(cell_value, labels):
Expand Down Expand Up @@ -285,7 +285,7 @@ def _get_column_pairs(self, panda_sdrf):

for column in columns_to_pair:
if column.name not in panda_sdrf and column._optional is False:
message = "The column {} is not present in the SDRF".format(column.name)
message = f"The column {column.name} is not present in the SDRF"
errors.append(LogicError(message, error_type=logging.ERROR))
elif column.name in panda_sdrf:
column_pairs.append((panda_sdrf[column.name], column))
Expand Down
4 changes: 2 additions & 2 deletions sdrf_pipelines/utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ def __str__(self) -> str:
self.row, self.column, self.value, self.message, logging.getLevelName(self._error_type)
)
else:
return "{} -- {}".format(self.message, logging.getLevelName(self._error_type))
return f"{self.message} -- {logging.getLevelName(self._error_type)}"


class AppConfigException(AppException):
def __init__(self, value):
super(AppConfigException, self).__init__(value)
super().__init__(value)


class ConfigManagerException(Exception):
Expand Down
2 changes: 0 additions & 2 deletions sdrf_pipelines/zooma/ols.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
OLS API wrapper
Expand Down
22 changes: 19 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
from __future__ import print_function
import codecs
import os.path

from setuptools import find_packages
from setuptools import setup

with open("README.md", "r", encoding="UTF-8") as fh:
with open("README.md", encoding="UTF-8") as fh:
long_description = fh.read()


def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), "r") as fp:
return fp.read()


def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
raise RuntimeError("Unable to find version string.")


setup(
name="sdrf-pipelines",
version="0.0.21",
version=get_version("sdrf_pipelines/__init__.py"),
author="BigBio Team",
author_email="[email protected]",
description="Translate, convert SDRF to configuration pipelines",
Expand Down

0 comments on commit 96e2a69

Please sign in to comment.