Skip to content

Commit

Permalink
Add tests for 2 samples and 1 sample for zpca-tpm (#15)
Browse files Browse the repository at this point in the history
* Add tests for 2 samples and 1 sample when using zpca-tpm
* Bump version to 0.8.3
  • Loading branch information
fgypas authored Apr 9, 2021
1 parent 3008763 commit 1d1c168
Show file tree
Hide file tree
Showing 12 changed files with 266,521 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

test_data/TRANSCRIPT_TPM_2_SAMPLES/
test_data/TRANSCRIPT_TPM_1_SAMPLE/
11 changes: 11 additions & 0 deletions scripts/zpca-counts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ def main():
sys.stdout.write(f"Running PCA {os.linesep}")

n_components = determine_number_of_components(df)

if n_components == 1:
w = open(os.path.join(options.out, "PCA.tsv"), 'w')
w.write(f"")
w.close()
w = open(os.path.join(options.out, "scree.tsv"), 'w')
w.write(f"")
w.close()
sys.stderr.write(f"Too few samples for PCA {os.linesep}")
sys.stderr.write(f"Exiting {os.linesep}")
sys.exit(0)

scaled_data, pca_data, per_var, labels, = perform_pca(df, n_components)

Expand Down
11 changes: 11 additions & 0 deletions scripts/zpca-tpm
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ def main():

n_components = determine_number_of_components(df)

if n_components == 1:
w = open(os.path.join(options.out, "PCA.tsv"), 'w')
w.write(f"")
w.close()
w = open(os.path.join(options.out, "scree.tsv"), 'w')
w.write(f"")
w.close()
sys.stderr.write(f"Too few samples for PCA {os.linesep}")
sys.stderr.write(f"Exiting {os.linesep}")
sys.exit(0)

scaled_data, pca_data, per_var, labels, = perform_pca(df, n_components)

if options.verbose:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setup(
name='zpca',
version='0.8.2',
version='0.8.3',
description="PCA analysis for genes or transcripts.",
author="Foivos Gypas",
author_email='[email protected]',
Expand Down
Loading

0 comments on commit 1d1c168

Please sign in to comment.