Skip to content

Commit

Permalink
Merge pull request #3 from 136s/dev
Browse files Browse the repository at this point in the history
ver 0.2.0
  • Loading branch information
136s authored Jun 4, 2024
2 parents a631726 + 378700e commit 9a893c8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion ncbi_counts/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python

VERSION = (0, 1, 0)
VERSION = (0, 2, 0)
__version__ = ".".join(map(str, VERSION))
1 change: 1 addition & 0 deletions ncbi_counts/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python

from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import Path
import warnings
Expand Down
18 changes: 9 additions & 9 deletions ncbi_counts/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ def load_input(input_path: StrPath) -> GeoRegex:
Returns:
GeoRegex: Dictionary of regular expressions.
"""
match Path(input_path).suffix:
case ".yaml" | ".yml":
return load_yaml(input_path)
case ".csv":
return load_csv(input_path)
case ".tsv":
return load_csv(input_path, sep="\t")
case _:
raise ValueError("Supported file types are .yaml, .yml, .csv, .tsv.")
suf = Path(input_path).suffix
if suf in (".yaml" | ".yml"):
return load_yaml(input_path)
elif suf == ".csv":
return load_csv(input_path)
elif suf == ".tsv":
return load_csv(input_path, sep="\t")
else:
raise ValueError("Supported file types are .yaml, .yml, .csv, .tsv.")
6 changes: 3 additions & 3 deletions ncbi_counts/types.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python

from pathlib import Path
from typing import Literal
from typing import Literal, Union


StrPath = str | Path
StrPath = Union[str, Path]
GseAcc = str
GsmAcc = str
Groups = Literal["treatment", "control"] | str
Groups = Union[Literal["treatment", "control"], str]
PairRegex = dict[Groups, dict[str, str]]
GeoRegex = dict[GseAcc, list[PairRegex]]
PairGsms = dict[Groups, list[GsmAcc]]
Expand Down
13 changes: 6 additions & 7 deletions ncbi_counts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,12 @@ def get_count_url(
Returns:
str: URL of NCBI-generated count file.
"""
match norm_type:
case None:
count_type = "raw_counts"
case "fpkm" | "tpm":
count_type = "norm_counts_" + norm_type.upper()
case _:
raise ValueError("Supported normalization types are 'fpkm' and 'tpm'.")
if norm_type is None:
count_type = "raw_counts"
elif norm_type in ("fpkm", "tpm"):
count_type = "norm_counts_" + norm_type.upper()
else:
raise ValueError("Supported normalization types are 'fpkm' and 'tpm'.")
return (
GEO_DOWNLOAD_BASE
+ f"type=rnaseq_counts&acc={gse_acc}&format=file&file={gse_acc}_{count_type}_{annot_ver}_NCBI.tsv.gz"
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

from pathlib import Path
from setuptools import setup, find_packages

Expand Down Expand Up @@ -37,7 +36,7 @@ def readme():
],
url="https://github.com/136s/ncbi_counts",
packages=find_packages(exclude=("tests", "docs")),
python_requires=">=3.10.0",
python_requires=">=3.9.0",
install_requires=["GEOparse", "pandas", "PyYAML"],
extras_require={"dev": ["pytest", "build", "twine"]},
keywords=["GEO", "Gene Expression Omnibus", "Bioinformatics", "RNA-seq", "NCBI"],
Expand Down

0 comments on commit 9a893c8

Please sign in to comment.