-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from GilbertLabUCSF/abe-dev
debug, new modules, and code improvements
- Loading branch information
Showing
22 changed files
with
554 additions
and
266 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
Binary file not shown.
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 |
---|---|---|
@@ -1 +1 @@ | ||
version = "0.1.1" | ||
version = "0.2.0" |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
from . import load | ||
from . import data | ||
|
||
data = data.Data() #Global object data instantiated on import required for access by GeneQuery Objects | ||
from . import (Gene, CellLine, Organelle, Cancer, CellLineCluster, GeneCluster) | ||
|
||
from .candi import (Gene, CellLine, Organelle, Cancer, CellLineCluster, GeneCluster) |
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
Empty file.
Empty file.
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,52 @@ | ||
import numpy as np | ||
import pandas as pd | ||
import anndata as ad | ||
|
||
from pydeseq2.dds import DeseqDataSet | ||
from pydeseq2.default_inference import DefaultInference | ||
from pydeseq2.ds import DeseqStats | ||
from adpbulk import ADPBulk | ||
|
||
|
||
def pseudobulk_by_group(adt, groups, method="mean"): | ||
# initialize the object | ||
adpb = ADPBulk(adt, groupby=groups, method=method) | ||
|
||
# perform the pseudobulking | ||
pseudobulk_matrix = adpb.fit_transform() | ||
|
||
# retrieve the sample metadata (useful for easy incorporation with edgeR) | ||
sample_meta = adpb.get_meta() | ||
|
||
out = ad.AnnData( | ||
X=pseudobulk_matrix, | ||
obs=sample_meta.set_index('SampleName') | ||
) | ||
|
||
return out | ||
|
||
|
||
def run_deseq(adata, design, tested_level, ref_level, n_cpus=8): | ||
|
||
inference = DefaultInference(n_cpus=n_cpus) | ||
|
||
dds = DeseqDataSet( | ||
counts=adata.to_df().astype(int), | ||
metadata=adata.obs, | ||
design_factors=design, # compare samples based on the "condition" | ||
refit_cooks=True, | ||
inference=inference, | ||
) | ||
|
||
dds.deseq2() | ||
|
||
stat_res = DeseqStats( | ||
dds, | ||
contrast=[design, tested_level, ref_level], | ||
inference=inference | ||
) | ||
stat_res.summary() | ||
|
||
df = stat_res.results_df | ||
|
||
return df |
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
Oops, something went wrong.