Skip to content

Commit

Permalink
update to v2.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyh09 committed Sep 23, 2021
1 parent 0c11c16 commit b81b7c7
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 14 deletions.
2 changes: 1 addition & 1 deletion brie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
at https://brie.readthedocs.io/.
"""

from ._cli import cli
# from ._cli import cli
from .version import __version__

# direct classes or functions
Expand Down
13 changes: 13 additions & 0 deletions brie/bin/brie_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

from ..version import __version__

def main():
print("Welcome to BRIE v%s! Command lines available:\n " %(__version__))
print("brie-count\n Counting reads for exon-skipping events from "
"per cell bam files")
print("brie-quant\n Quantify splicing ratio and detecting differential "
"splicing\n")


if __name__ == "__main__":
main()
54 changes: 44 additions & 10 deletions brie/plot/LRtest_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,58 @@ def LRT_basic(LRT_res):
plt.show()


def volcano(adata, x="cell_coeff", y="pval", index=0, score_red=0.0001,
n_anno=10, anno_id='index', log_y=True, adjust=True):
def volcano(adata, x="cell_coeff", y="ELBO_gain", index=0, score_red=4,
n_anno=10, anno_id='index', log_y=None, clip_y_min=0, adjust=True):
"""Volcano plot for p values and weights
Parameters
----------
adata: AnnData
The input AnnData, containing varm[x] and varm[y]
x: str
The tag in adata.varm for presenting in x-axis
y: str
The tag in adata.varm for presenting in y-axis
index: int
The index to present, used as adata.varm[x|y][:, index]
score_red: float
The cutoff score for highlighting in red
n_anno: int
Number of top hits to add names
anno_id: str
The tag id of the adata.var to use as var name
log_y: bool
If True, show y axis as log scale
clip_y_min: float
Clipping y at lower bound
adjust: bool
If True, adjust the annotation position
Examples
--------
brie.pl.volcano(adata, x="cell_coeff", y="ELBO_gain", score_red=4)
brie.pl.volcano(adata, x="cell_coeff", y="pval", score_red=0.0001)
brie.pl.volcano(adata, x="cell_coeff", y="FDR", score_red=0.0001)
"""
xval = adata.varm[x][:, index]
yval = adata.varm[y][:, index]

if clip_y_min is not None:
yval[yval < clip_y_min] = clip_y_min

if log_y:
idx = yval < score_red
idx_anno = np.argsort(yval)[:n_anno]
y_label = "-log10(%s)" %(y)

yval = -np.log10(yval)
else:
if y == 'ELBO_gain':
idx = yval > score_red
idx_anno = np.argsort(yval)[-n_anno:]
y_label = str(y)

else:
idx = yval < score_red
idx_anno = np.argsort(yval)[:n_anno]
if log_y is None or log_y is True:
y_label = "-log10(%s)" %(y)
yval = -np.log10(yval)
else:
y_label = str(y)

plt.scatter(xval[~idx], yval[~idx], color="gray")
plt.scatter(xval[idx], yval[idx], color="firebrick")

Expand Down
4 changes: 2 additions & 2 deletions brie/utils/count.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def SE_probability(gene, rlen=75, edge_hang=10, junc_hang=2):
"""
# check SE event
if _check_SE_event(gene) == False:
print("This is not exon-skipping event!")
print("This is not exon-skipping event: %s! %(gene.geneID)")
exit()

l1, l2, l3 = gene.trans[0].exons[:, 1] - gene.trans[0].exons[:, 0]
Expand Down Expand Up @@ -186,7 +186,7 @@ def SE_effLen(gene, rlen=75, edge_hang=10, junc_hang=2):
"""
# check SE event
if _check_SE_event(gene) == False:
print("This is not exon-skipping event!")
print("This is not exon-skipping event: %s! %(gene.geneID)")
exit()

l1, l2, l3 = gene.trans[0].exons[:, 1] - gene.trans[0].exons[:, 0]
Expand Down
2 changes: 1 addition & 1 deletion brie/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "2.0.5"
__version__ = "2.0.6"

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
entry_points={
'console_scripts': [
# 'brie = brie:_cli.cli',
'brie = brie.bin.brie_main:main',
'brie-count = brie.bin.count:main',
'brie-quant = brie.bin.quant:main',
'brie1 = brie.version1.brie:main',
Expand Down

0 comments on commit b81b7c7

Please sign in to comment.