Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch v0.1.1 #14

Merged
merged 9 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

.DS_Store
.DS_Store
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# FRAPOSA_PGSC

[![DOI](https://zenodo.org/badge/610312021.svg)](https://zenodo.org/badge/latestdoi/610312021)

FRAPOSA (Fast and Robust Ancestry Prediction by using Online singular value decomposition and Shrinkage Adjustment)
is a python script to predict the ancestry of study samples by the results of principal component analysis (PCA) on a
reference panel. The software originally accompanied
Expand Down
Empty file removed fraposa_pgsc/__init__.py
Empty file.
905 changes: 466 additions & 439 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[virtualenvs]
create = true
in-project = true
11 changes: 2 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
[tool.poetry]
name = "fraposa-pgsc"
version = "0.1.0"
version = "0.1.1"
description = "Tools to perform ancestry projection to a reference dataset within the calculator pipeline (pgsc_calc)"
authors = ["smlmbrt <sam.a.lambert@gmail.com>"]
license = "MIT License"
readme = "README.md"
packages = [{include = "fraposa_pgsc"}]
packages = [{include = "fraposa_pgsc", from = "src"}]

[tool.poetry.scripts]
fraposa = "fraposa_pgsc.fraposa_runner:main"
fraposa_pred = "fraposa_pgsc.predstupopu:main"
fraposa_plot = "fraposa_pgsc.plotpcs:main"

# note: poetry currently has half-implemented support for shell scripts
# https://github.com/python-poetry/poetry/issues/241#issuecomment-1459952704
# the created package bundles the script correctly in the built wheel file
# but the script doesn't get added to PATH after poetry build + install
# the dockerfile takes care of this: splitindiv.sh works as expected
splitindiv = {reference = "scripts/splitindiv.sh", type = "file"}

[tool.poetry.dependencies]
python = "^3.10"
pandas = "^1.5.3"
Expand Down
7 changes: 7 additions & 0 deletions src/fraposa_pgsc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import logging
import importlib.metadata

log_fmt = "%(name)s: %(asctime)s %(levelname)-8s %(message)s"
logging.basicConfig(format=log_fmt, datefmt="%Y-%m-%d %H:%M:%S")
logger = logging.getLogger(__name__)
__version__ = importlib.metadata.version("fraposa_pgsc")
2 changes: 1 addition & 1 deletion fraposa_pgsc/fraposa.py → src/fraposa_pgsc/fraposa.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pyplink import PyPlink
from sklearn.neighbors import KNeighborsClassifier

from fraposa_pgsc.Variants import MatchType, Variants
from fraposa_pgsc.variants import MatchType, Variants

matplotlib.use('Agg')
import matplotlib.pyplot as plt
Expand Down
File renamed without changes.
12 changes: 7 additions & 5 deletions fraposa_pgsc/plotpcs.py → src/fraposa_pgsc/plotpcs.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#! /usr/bin/env python
import argparse
import fraposa_pgsc.fraposa as fp

import fraposa as fp
import argparse, sys


if __name__ == '__main__':
def main():
parser = argparse.ArgumentParser()
parser.add_argument('ref_filepref', help='Prefix of binary PLINK file for the reference data.')
parser.add_argument('stu_filepref', help='Prefix of binary PLINK file for the study data.')
args = parser.parse_args()

fp.plot_pcs(args.ref_filepref, args.stu_filepref)


if __name__ == '__main__':
main()
11 changes: 7 additions & 4 deletions fraposa_pgsc/predstupopu.py → src/fraposa_pgsc/predstupopu.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#! /usr/bin/env python

import fraposa as fp
import fraposa_pgsc.fraposa as fp
import argparse

if __name__ == '__main__':

def main():
parser=argparse.ArgumentParser()
parser.add_argument('ref_filepref', help='Prefix of binary PLINK file for the reference data.')
parser.add_argument('stu_filepref', help='Prefix of binary PLINK file for the study data.')
Expand All @@ -19,3 +18,7 @@
n_neighbors = int(args.nneighbors)

fp.pred_popu_stu(args.ref_filepref, args.stu_filepref, n_neighbors, weights)


if __name__ == '__main__':
main()
File renamed without changes.
Loading