-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check if plotting tests is compatable with github actions
- Loading branch information
1 parent
72d5ebf
commit c6456e2
Showing
17 changed files
with
11,528 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11,202 changes: 11,202 additions & 0 deletions
11,202
scimap/tests/scimapExampleData/exemplar-001--unmicst_cell.csv
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
marker,exemplar-001--unmicst_cell | ||
ELANE,7.8 | ||
CD57,8.9 | ||
CD45,6.4 | ||
CD11B,7.6 | ||
SMA,7.5 | ||
CD16,6.5 | ||
ECAD,7.35 | ||
FOXP3,7.4 | ||
NCAM,7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
channel_number,cycle_number,marker_name,Filter,excitation_wavelength,emission_wavelength,background,exposure,remove | ||
21,6,DNA_6,DAPI,395,431,,100, | ||
22,6,ELANE,FITC,485,525,,100, | ||
23,6,CD57,Sytox,555,590,,100, | ||
24,6,CD45,Cy5,640,690,,100, | ||
25,7,DNA_7,DAPI,395,431,,100, | ||
26,7,CD11B,FITC,485,525,,100, | ||
27,7,SMA,Sytox,555,590,,100, | ||
28,7,CD16,Cy5,640,690,,100, | ||
29,8,DNA_8,DAPI,395,431,,100, | ||
30,8,ECAD,FITC,485,525,,100, | ||
31,8,FOXP3,Sytox,555,590,,100, | ||
32,8,NCAM,Cy5,640,690,,100, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
,,ELANE,CD57,CD45,CD11B,SMA,CD16,ECAD,FOXP3,NCAM | ||
all,ECAD+,,,,,,,pos,, | ||
all,Immune,,,pos,,,,,, | ||
all,SMA+,,,,,pos,,,, | ||
Immune,NK cells,,allpos,,neg,,allpos,,, | ||
Immune,Other myeloid cells,,,,pos,,,,, | ||
Immune,Treg,,,,,,,,pos, | ||
Other myeloid cells,Dendritic cells,,allneg,,,,allneg,,, |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Tue Apr 23 20:14:55 2024 | ||
@author: aj | ||
Test helper function | ||
""" | ||
|
||
import pytest | ||
import os | ||
import anndata as ad | ||
import pandas as pd | ||
|
||
# load data | ||
@pytest.fixture | ||
def adata(): | ||
image_path = os.getcwd() + '/scimap/tests/scimapExampleData/scimapExampleData.h5ad' | ||
adata = ad.read_h5ad(image_path) | ||
return adata | ||
|
||
|
||
# classify | ||
def test_classify (adata): | ||
from scimap.helpers.classify import classify | ||
adata = classify(adata, pos=['FOXP3'], neg=['ECAD'], phenotype='phenotype') | ||
assert adata.obs['classify'].value_counts()['passed_classify'] == 228 | ||
|
||
# rename | ||
def test_rename (adata): | ||
from scimap.helpers.rename import rename | ||
name= {'renamed': ['Dendritic cells', 'NK cells']} | ||
adata = rename (adata, name, from_column='phenotype', to_column='phenotype_renamed') | ||
assert adata.obs['phenotype_renamed'].value_counts()['renamed'] == 85 | ||
|
||
# dropFeatures | ||
def test_dropFeatures (adata): | ||
from scimap.helpers.dropFeatures import dropFeatures | ||
adata = dropFeatures(adata, drop_markers=['ELANE', 'NCAM']) | ||
assert len(adata.var.index) == 7 | ||
|
||
# merge_adata_obs | ||
def test_merge_adata_obs (adata): | ||
from scimap.helpers.merge_adata_obs import merge_adata_obs | ||
bdata = adata.copy() | ||
bdata.obs['new_col'] = bdata.obs['imageid'] | ||
combined_adata = merge_adata_obs(adata=[adata, bdata]) | ||
assert len(combined_adata.obs.columns) == 14 | ||
|
||
# scimap_to_csv | ||
def test_scimap_to_csv (adata): | ||
from scimap.helpers.scimap_to_csv import scimap_to_csv | ||
data = scimap_to_csv(adata) | ||
assert data.shape == (11201, 22) | ||
|
||
# downloadDemoData | ||
def downloadDemoData (): | ||
from scimap.helpers.downloadDemoData import downloadDemoData | ||
download_directory = os.getcwd() + '/demodata' | ||
downloadDemoData (download_directory, api_url="https://zenodo.org/api/records/11054442") | ||
downloaded_data = pd.read_csv(os.getcwd() + '/demodata/manual_gates.csv') | ||
assert downloaded_data.shape == (9, 2) | ||
|
||
# addROI_omero | ||
|
||
# animate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Tue Apr 23 21:22:21 2024 | ||
@author: aj | ||
Test plotting functions | ||
""" | ||
|
||
import pytest | ||
import os | ||
import anndata as ad | ||
import matplotlib.pyplot as plt | ||
|
||
# load data | ||
@pytest.fixture | ||
def adata(): | ||
image_path = os.getcwd() + '/scimap/tests/scimapExampleData/scimapExampleData.h5ad' | ||
adata = ad.read_h5ad(image_path) | ||
return adata | ||
|
||
|
||
# heatmap | ||
def test_heatmap (adata): | ||
from scimap.plotting.heatmap import heatmap | ||
heatmap(adata, groupBy='phenotype', standardScale='column') | ||
|
||
|
||
|
||
|
||
# markerCorrelation | ||
# groupCorrelation | ||
# distPlot | ||
# densityPlot2D | ||
# cluster_plots | ||
# umap | ||
# foldchange | ||
# spatial_scatterPlot | ||
# spatial_distance | ||
# spatial_interaction | ||
# spatialInteractionNetwork | ||
# spatial_pscore | ||
# stacked_barplot | ||
# pie | ||
# voronoi | ||
|
||
|
||
# image_viewer | ||
# addROI_image | ||
# gate_finder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Mon Apr 22 22:16:06 2024 | ||
@author: aj | ||
Pre processing tools tests | ||
""" | ||
|
||
import pytest | ||
import os | ||
import anndata as ad | ||
import pandas as pd | ||
|
||
|
||
#os.chdir ('/Users/aj/Dropbox (Partners HealthCare)/nirmal lab/softwares/scimap') | ||
|
||
# loading via mcmicro | ||
def test_mcmicro_to_scimap(): | ||
from scimap.preprocessing.mcmicro_to_scimap import mcmicro_to_scimap | ||
feature_table_path = [os.getcwd() + '/scimap/tests/scimapExampleData/exemplar-001--unmicst_cell.csv'] | ||
adata = mcmicro_to_scimap (feature_table_path) | ||
assert adata.shape == (11201, 9) | ||
|
||
|
||
@pytest.fixture | ||
def adata(): | ||
image_path = os.getcwd() + '/scimap/tests/scimapExampleData/scimapExampleData.h5ad' | ||
adata = ad.read_h5ad(image_path) | ||
return adata | ||
|
||
|
||
# log1p | ||
def test_log1p (adata): | ||
from scimap.preprocessing.log1p import log1p | ||
adata = log1p (adata, layer='log_test') | ||
assert adata.layers['log_test'].shape == (11201, 9) | ||
|
||
|
||
# rescale | ||
def test_rescale (adata): | ||
from scimap.preprocessing.rescale import rescale | ||
manual_gate = pd.read_csv(os.getcwd() + '/scimap/tests/scimapExampleData/manual_gates.csv') | ||
adata = rescale (adata, gate=manual_gate) | ||
assert round(adata.X[0][0], 2) == 0.12 | ||
|
||
|
||
# combat | ||
def test_combat (adata): | ||
from scimap.preprocessing.combat import combat | ||
adata = combat (adata, batch='ROI') | ||
assert adata.layers['combat'].shape == (11201, 9) | ||
adata = combat (adata, batch='ROI', layer='raw', label='combat_raw') | ||
assert adata.layers['combat_raw'].shape == (11201, 9) | ||
adata = combat (adata, batch='ROI', log=True, label='combat_log') | ||
assert adata.layers['combat_log'].shape == (11201, 9) | ||
adata = combat (adata, batch='ROI', layer='log', label='combat_log_layer') | ||
assert adata.layers['combat_log_layer'].shape == (11201, 9) | ||
adata = combat (adata, batch='ROI', replaceOriginal=True) | ||
assert round(adata.X[0][0], 2) == 0.12 |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.