brie 2.3.0__tar.gz → 2.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- brie-2.3.1/.github/workflows/publish.yml +27 -0
- brie-2.3.1/.gitignore +107 -0
- brie-2.3.1/.gitmodules +3 -0
- brie-2.3.1/.readthedocs.yml +32 -0
- brie-2.3.1/.travis.yml +10 -0
- brie-2.3.1/MANIFEST.in +2 -0
- {brie-2.3.0 → brie-2.3.1}/PKG-INFO +1 -1
- brie-2.3.1/brie/version.py +2 -0
- brie-2.3.1/brie/version1/brie.py +280 -0
- brie-2.3.1/brie/version1/brie_diff.py +276 -0
- brie-2.3.1/brie/version1/model_brie.py +452 -0
- {brie-2.3.0 → brie-2.3.1}/brie.egg-info/PKG-INFO +1 -1
- {brie-2.3.0 → brie-2.3.1}/brie.egg-info/SOURCES.txt +38 -1
- brie-2.3.1/doc/Makefile +177 -0
- brie-2.3.1/doc/brie1.rst +212 -0
- brie-2.3.1/doc/brie_count.rst +112 -0
- brie-2.3.1/doc/brie_quant.rst +211 -0
- brie-2.3.1/doc/conf.py +386 -0
- brie-2.3.1/doc/image/BRIE2_roadmap.png +0 -0
- brie-2.3.1/doc/index.rst +126 -0
- brie-2.3.1/doc/install.rst +117 -0
- brie-2.3.1/doc/quick_start.rst +158 -0
- brie-2.3.1/doc/release.rst +144 -0
- brie-2.3.1/doc/requirements.txt +13 -0
- brie-2.3.1/doc/tutorial.rst +5 -0
- brie-2.3.1/examples/brie2_demo.sh +40 -0
- brie-2.3.1/examples/demo_v1/anno_maker.sh +67 -0
- brie-2.3.1/examples/demo_v1/brie_demo.sh +33 -0
- brie-2.3.1/examples/gastrulation/E-MTAB-4079.130cells.txt +131 -0
- brie-2.3.1/examples/gastrulation/brie_sashimi.sh +22 -0
- brie-2.3.1/examples/gastrulation/gastrulation_130cells.sh +78 -0
- brie-2.3.1/examples/gastrulation/prepare_anno.sh +23 -0
- brie-2.3.1/examples/gastrulation/sashimi_setting.txt +81 -0
- brie-2.3.1/examples/make_list.sh +14 -0
- brie-2.3.1/requirements.txt +23 -0
- brie-2.3.1/simulator/README.rst +149 -0
- brie-2.3.1/simulator/simuDropout.py +217 -0
- brie-2.3.1/simulator/simuPSI.py +194 -0
- brie-2.3.1/simulator/spanki_demo.sh +50 -0
- brie-2.3.1/simulator/utils.py +81 -0
- brie-2.3.1/tests/README.rst +4 -0
- brie-2.3.0/brie/version.py +0 -2
- {brie-2.3.0 → brie-2.3.1}/LICENSE +0 -0
- {brie-2.3.0 → brie-2.3.1}/README.rst +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/__init__.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/_cli/__init__.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/_cli/_cli.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/_cli/count.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/_cli/download.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/_cli/extract.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/_cli/quant.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/bin/__init__.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/bin/brie_main.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/bin/count.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/bin/quant.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/models/__init__.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/models/base_model.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/models/hypothesis_tests.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/models/model_Beta.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/models/model_TFProb.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/models/model_TFProb_dev.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/models/model_wrap.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/models/simulator.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/models/tools.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/plot/LRtest_plot.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/plot/__init__.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/plot/base_plot.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/settings.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/__init__.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/base_utils.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/bias_utils.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/count.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/count_droplet.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/fasta_utils.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/gtf_utils.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/io_utils.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/preprocessing.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/run_utils.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/sam_utils.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie/utils/tran_utils.py +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie.egg-info/dependency_links.txt +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie.egg-info/entry_points.txt +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie.egg-info/requires.txt +0 -0
- {brie-2.3.0 → brie-2.3.1}/brie.egg-info/top_level.txt +0 -0
- {brie-2.3.0 → brie-2.3.1}/setup.cfg +0 -0
- {brie-2.3.0 → brie-2.3.1}/setup.py +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-and-publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write # required for trusted publishing
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.11"
|
|
19
|
+
|
|
20
|
+
- name: Install build
|
|
21
|
+
run: pip install build
|
|
22
|
+
|
|
23
|
+
- name: Build sdist and wheel
|
|
24
|
+
run: python -m build
|
|
25
|
+
|
|
26
|
+
- name: Publish to PyPI
|
|
27
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
brie-2.3.1/.gitignore
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
.DS_Store*
|
|
2
|
+
.vscode/
|
|
3
|
+
temp/
|
|
4
|
+
doc/*.ipynb
|
|
5
|
+
|
|
6
|
+
# Byte-compiled / optimized / DLL files
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*$py.class
|
|
10
|
+
|
|
11
|
+
# C extensions
|
|
12
|
+
*.so
|
|
13
|
+
|
|
14
|
+
# Distribution / packaging
|
|
15
|
+
.Python
|
|
16
|
+
env/
|
|
17
|
+
build/
|
|
18
|
+
develop-eggs/
|
|
19
|
+
dist/
|
|
20
|
+
downloads/
|
|
21
|
+
eggs/
|
|
22
|
+
.eggs/
|
|
23
|
+
lib/
|
|
24
|
+
lib64/
|
|
25
|
+
parts/
|
|
26
|
+
sdist/
|
|
27
|
+
var/
|
|
28
|
+
wheels/
|
|
29
|
+
*.egg-info/
|
|
30
|
+
.installed.cfg
|
|
31
|
+
*.egg
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.coverage
|
|
47
|
+
.coverage.*
|
|
48
|
+
.cache
|
|
49
|
+
nosetests.xml
|
|
50
|
+
coverage.xml
|
|
51
|
+
*.cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
|
|
62
|
+
# Flask stuff:
|
|
63
|
+
instance/
|
|
64
|
+
.webassets-cache
|
|
65
|
+
|
|
66
|
+
# Scrapy stuff:
|
|
67
|
+
.scrapy
|
|
68
|
+
|
|
69
|
+
# Sphinx documentation
|
|
70
|
+
doc/_build/
|
|
71
|
+
|
|
72
|
+
# PyBuilder
|
|
73
|
+
target/
|
|
74
|
+
|
|
75
|
+
# Jupyter Notebook
|
|
76
|
+
.ipynb_checkpoints
|
|
77
|
+
|
|
78
|
+
# pyenv
|
|
79
|
+
.python-version
|
|
80
|
+
|
|
81
|
+
# celery beat schedule file
|
|
82
|
+
celerybeat-schedule
|
|
83
|
+
|
|
84
|
+
# SageMath parsed files
|
|
85
|
+
*.sage.py
|
|
86
|
+
|
|
87
|
+
# dotenv
|
|
88
|
+
.env
|
|
89
|
+
|
|
90
|
+
# virtualenv
|
|
91
|
+
.venv
|
|
92
|
+
venv/
|
|
93
|
+
ENV/
|
|
94
|
+
|
|
95
|
+
# Spyder project settings
|
|
96
|
+
.spyderproject
|
|
97
|
+
.spyproject
|
|
98
|
+
|
|
99
|
+
# Rope project settings
|
|
100
|
+
.ropeproject
|
|
101
|
+
|
|
102
|
+
# mkdocs documentation
|
|
103
|
+
/site
|
|
104
|
+
|
|
105
|
+
# mypy
|
|
106
|
+
.mypy_cache/
|
|
107
|
+
|
brie-2.3.1/.gitmodules
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# .readthedocs.yaml
|
|
2
|
+
# Read the Docs configuration file
|
|
3
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
4
|
+
|
|
5
|
+
# Required
|
|
6
|
+
version: 2
|
|
7
|
+
|
|
8
|
+
# Set the OS, Python version and other tools you might need
|
|
9
|
+
build:
|
|
10
|
+
os: ubuntu-22.04
|
|
11
|
+
tools:
|
|
12
|
+
python: "3.11"
|
|
13
|
+
# You can also specify other tool versions:
|
|
14
|
+
# nodejs: "19"
|
|
15
|
+
# rust: "1.64"
|
|
16
|
+
# golang: "1.19"
|
|
17
|
+
|
|
18
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
19
|
+
sphinx:
|
|
20
|
+
configuration: doc/conf.py
|
|
21
|
+
|
|
22
|
+
# Optionally build your docs in additional formats such as PDF and ePub
|
|
23
|
+
# formats:
|
|
24
|
+
# - pdf
|
|
25
|
+
# - epub
|
|
26
|
+
|
|
27
|
+
# Optional but recommended, declare the Python requirements required
|
|
28
|
+
# to build your documentation
|
|
29
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
30
|
+
python:
|
|
31
|
+
install:
|
|
32
|
+
- requirements: doc/requirements.txt
|
brie-2.3.1/.travis.yml
ADDED
brie-2.3.1/MANIFEST.in
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# This is a main file to run the diceseq software, which will return the
|
|
2
|
+
# isoform proportions ratio for each gene at all time points.
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
import time
|
|
7
|
+
import pysam
|
|
8
|
+
import numpy as np
|
|
9
|
+
import multiprocessing
|
|
10
|
+
from optparse import OptionParser, OptionGroup
|
|
11
|
+
|
|
12
|
+
# import pyximport; pyximport.install()
|
|
13
|
+
from ..utils.gtf_utils import load_genes
|
|
14
|
+
from ..utils.run_utils import set_info, map_data, save_data
|
|
15
|
+
from .model_brie import brie_MH_Heuristic
|
|
16
|
+
|
|
17
|
+
PROCESSED = 0
|
|
18
|
+
TOTAL_GENE = 0
|
|
19
|
+
TOTAL_READ = []
|
|
20
|
+
START_TIME = time.time()
|
|
21
|
+
|
|
22
|
+
def show_progress(RV=None):
|
|
23
|
+
global PROCESSED, TOTAL_GENE, START_TIME
|
|
24
|
+
if RV is not None:
|
|
25
|
+
PROCESSED += 1
|
|
26
|
+
bar_len = 20
|
|
27
|
+
run_time = time.time() - START_TIME
|
|
28
|
+
percents = 100.0 * PROCESSED / TOTAL_GENE
|
|
29
|
+
filled_len = int(bar_len * percents / 100)
|
|
30
|
+
bar = '=' * filled_len + '-' * (bar_len - filled_len)
|
|
31
|
+
|
|
32
|
+
sys.stdout.write('\r[Brie] [%s] %.1f%% done in %.1f sec.'
|
|
33
|
+
% (bar, percents, run_time))
|
|
34
|
+
sys.stdout.flush()
|
|
35
|
+
return RV
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def main():
|
|
39
|
+
import warnings
|
|
40
|
+
warnings.filterwarnings('error')
|
|
41
|
+
|
|
42
|
+
# parse command line options
|
|
43
|
+
parser = OptionParser()
|
|
44
|
+
parser.add_option("--anno_file", "-a", dest="anno_file", default=None,
|
|
45
|
+
help="Annotation file for genes and transcripts in GTF or GFF3")
|
|
46
|
+
parser.add_option("--sam_file", "-s", dest="sam_file", default=None,
|
|
47
|
+
help=("Sorted and indexed bam/sam files, use ',' for replicates "
|
|
48
|
+
"e.g., rep1.sorted.bam,sam1_rep2.sorted.bam"))
|
|
49
|
+
parser.add_option("--out_dir", "-o", dest="out_dir", default="output",
|
|
50
|
+
help="Full path of output directory")
|
|
51
|
+
parser.add_option("--factor_file", "-f", dest="factor_file", default=None,
|
|
52
|
+
help=("Features in csv.gz file to predict isoform expression."))
|
|
53
|
+
# parser.add_option("--gene_file", "-c", dest="gene_file", default=None,
|
|
54
|
+
# help=("Gene features, the same order of the input genes."))
|
|
55
|
+
# parser.add_option("--cell_file", "-c", dest="cell_file", default=None,
|
|
56
|
+
# help=("Cell features, the same order of the input sam files."))
|
|
57
|
+
|
|
58
|
+
group = OptionGroup(parser, "Optional arguments")
|
|
59
|
+
group.add_option("--nproc", "-p", type="int", dest="nproc", default="4",
|
|
60
|
+
help="Number of subprocesses [default: %default]")
|
|
61
|
+
group.add_option("--weight_file", "-w", dest="weight_file", default=None,
|
|
62
|
+
help=("File with weights, an output of Brie."))
|
|
63
|
+
group.add_option("--ftype", "-y", dest="ftype", default="Y",
|
|
64
|
+
help="Type of function target: FPKM, Y, Psi [default: %default].")
|
|
65
|
+
|
|
66
|
+
group.add_option("--fLen", type="float", nargs=2, dest="frag_leng",
|
|
67
|
+
default=[None,None], help=("Two arguments for fragment length: "
|
|
68
|
+
"mean and standard diveation, default: auto-detected"))
|
|
69
|
+
group.add_option("--bias", nargs=3, dest="bias_args",
|
|
70
|
+
default=["unif","None","None"], help=("Three argments for bias "
|
|
71
|
+
"correction: BIAS_MODE,REF_FILE,BIAS_FILE(s). BIAS_MODE: unif, end5, "
|
|
72
|
+
"end3, both. REF_FILE: the genome reference file in fasta format. "
|
|
73
|
+
"BIAS_FILE(s): bias files from dice-bias, use '---' for time specific "
|
|
74
|
+
"files, [default: unif None None]"))
|
|
75
|
+
|
|
76
|
+
group.add_option("--sigma", dest="_sigma", default=None,
|
|
77
|
+
help=("Sigma in Bayesian regression: the Gaussian standard deviation "
|
|
78
|
+
"of residues [default: Auto]."))
|
|
79
|
+
group.add_option("--lambda", dest="_lambda", default="0.1",
|
|
80
|
+
help=("Lambda in Bayesian regression: the coeffiecient of "
|
|
81
|
+
"L2 constrain on weights [default: %default]."))
|
|
82
|
+
|
|
83
|
+
group.add_option("--mcmc", type="int", nargs=4, dest="mcmc_run",
|
|
84
|
+
default=[500,5000,1000,50], help=("Four arguments for in MCMC "
|
|
85
|
+
"iterations: save_sample,max_run,min_run,gap_run. Required: "
|
|
86
|
+
"save_sample =< 3/4*mim_run. [default: 500 5000 1000 50]"))
|
|
87
|
+
|
|
88
|
+
# group.add_option("--add_premRNA", action="store_true", dest="add_premRNA",
|
|
89
|
+
# default=False, help="Add the pre-mRNA as a transcript")
|
|
90
|
+
# parser.add_option("--feature_log",action="store_true",dest="feature_log",
|
|
91
|
+
# default=False, help="Use log scale for all features.")
|
|
92
|
+
# parser.add_option("--two_isoform",action="store_true",dest="two_isoform",
|
|
93
|
+
# default=False, help=("Only two isoforms for all genes. This is mainly "
|
|
94
|
+
# "for splicing events."))
|
|
95
|
+
|
|
96
|
+
parser.add_option_group(group)
|
|
97
|
+
|
|
98
|
+
(options, args) = parser.parse_args()
|
|
99
|
+
if len(sys.argv[1:]) == 0:
|
|
100
|
+
print("Welcome to Brie!\n")
|
|
101
|
+
print("use -h or --help for help on argument.")
|
|
102
|
+
sys.exit(1)
|
|
103
|
+
if options.anno_file == None:
|
|
104
|
+
print("[Brie] Error: need --anno_file for annotation.")
|
|
105
|
+
sys.exit(1)
|
|
106
|
+
else:
|
|
107
|
+
sys.stdout.write("\r[Brie] loading annotation file... ")
|
|
108
|
+
sys.stdout.flush()
|
|
109
|
+
# anno = load_annotation(options.anno_file, options.anno_source)
|
|
110
|
+
genes = load_genes(options.anno_file)
|
|
111
|
+
sys.stdout.write("\r[Brie] loading annotation file... Done.\n")
|
|
112
|
+
sys.stdout.flush()
|
|
113
|
+
# genes = anno["genes"]
|
|
114
|
+
tran_len = []
|
|
115
|
+
tran_ids = []
|
|
116
|
+
gene_ids = []
|
|
117
|
+
for g in genes:
|
|
118
|
+
for t in g.trans:
|
|
119
|
+
tran_len.append(t.tranL)
|
|
120
|
+
tran_ids.append(t.tranID)
|
|
121
|
+
gene_ids.append(g.geneID)
|
|
122
|
+
gene_ids = np.array(gene_ids)
|
|
123
|
+
tran_ids = np.array(tran_ids)
|
|
124
|
+
tran_len = np.array(tran_len)
|
|
125
|
+
|
|
126
|
+
global TOTAL_GENE, TOTAL_TRAN
|
|
127
|
+
TOTAL_GENE = len(genes)
|
|
128
|
+
TOTAL_TRAN = len(tran_ids)
|
|
129
|
+
|
|
130
|
+
if options.sam_file == None:
|
|
131
|
+
print("[Brie] Error: need --sam_file for indexed and aliged reads.")
|
|
132
|
+
sys.exit(1)
|
|
133
|
+
else:
|
|
134
|
+
global TOTAL_READ
|
|
135
|
+
TOTAL_READ = 0
|
|
136
|
+
sam_file = options.sam_file
|
|
137
|
+
for ss in sam_file.split(","):
|
|
138
|
+
if not os.path.isfile(ss):
|
|
139
|
+
print("Error: No such file\n -- %s" %ss)
|
|
140
|
+
sys.exit(1)
|
|
141
|
+
pysam_stats = pysam.idxstats(ss)
|
|
142
|
+
if type(pysam_stats) is not list:
|
|
143
|
+
pysam_stats = pysam_stats.split("\n")
|
|
144
|
+
for tp in pysam_stats:
|
|
145
|
+
tmp = tp.strip().split("\t")
|
|
146
|
+
if len(tmp) >= 3:
|
|
147
|
+
TOTAL_READ += float(tmp[2])
|
|
148
|
+
|
|
149
|
+
two_isoform = True
|
|
150
|
+
if options.factor_file == None:
|
|
151
|
+
feature_all = np.zeros((len(tran_ids), 1))
|
|
152
|
+
feature_ids = ["zero"]
|
|
153
|
+
if two_isoform:
|
|
154
|
+
idxF = np.arange(0, len(tran_ids), 2)
|
|
155
|
+
feature_all[idxF+1,:] = None
|
|
156
|
+
else:
|
|
157
|
+
idxF = np.arange(0, len(tran_ids))
|
|
158
|
+
else:
|
|
159
|
+
feature_all, feature_ids, idxF = map_data(options.factor_file,
|
|
160
|
+
tran_ids, False) #options.feature_log
|
|
161
|
+
|
|
162
|
+
if options.out_dir is None:
|
|
163
|
+
out_dir = os.path.dirname(os.path.abspath(ss)) + "/brie_out"
|
|
164
|
+
else:
|
|
165
|
+
out_dir = options.out_dir
|
|
166
|
+
try:
|
|
167
|
+
os.stat(os.path.abspath(out_dir))
|
|
168
|
+
except:
|
|
169
|
+
os.mkdir(os.path.abspath(out_dir))
|
|
170
|
+
|
|
171
|
+
if options.weight_file == None:
|
|
172
|
+
weights_in = None
|
|
173
|
+
else:
|
|
174
|
+
weights_in = np.loadtxt(options.weight_file, dtype="str", skiprows=1)
|
|
175
|
+
weights_in = weights_in[:, 1].astype(float).reshape(-1)
|
|
176
|
+
if options._sigma is None:
|
|
177
|
+
_sigma = None
|
|
178
|
+
else:
|
|
179
|
+
_sigma = float(options._sigma)
|
|
180
|
+
if options._lambda is None:
|
|
181
|
+
_lambda = None
|
|
182
|
+
else:
|
|
183
|
+
_lambda = float(options._lambda)
|
|
184
|
+
|
|
185
|
+
bias_mode, ref_file, bias_file = options.bias_args
|
|
186
|
+
if bias_mode == "unif":
|
|
187
|
+
ref_file = None
|
|
188
|
+
bias_file = None
|
|
189
|
+
elif ref_file is "None":
|
|
190
|
+
ref_file = None
|
|
191
|
+
bias_file = None
|
|
192
|
+
bias_mode = "unif"
|
|
193
|
+
print("[Brie] No reference sequence, change to uniform mode.")
|
|
194
|
+
elif bias_file is "None":
|
|
195
|
+
ref_file = None
|
|
196
|
+
bias_file = None
|
|
197
|
+
bias_mode = "unif"
|
|
198
|
+
print("[Brie] No bias parameter file, change to uniform mode.")
|
|
199
|
+
else:
|
|
200
|
+
bias_file = bias_file.split("---")
|
|
201
|
+
|
|
202
|
+
no_twice = False
|
|
203
|
+
auto_min = 200
|
|
204
|
+
mate_mode = "pair"
|
|
205
|
+
two_isoform = True
|
|
206
|
+
add_premRNA = False
|
|
207
|
+
print_detail = False
|
|
208
|
+
|
|
209
|
+
nproc = options.nproc
|
|
210
|
+
ftype = options.ftype
|
|
211
|
+
FLmean, FLstd = options.frag_leng
|
|
212
|
+
sample_num, M, initial, gap = options.mcmc_run
|
|
213
|
+
|
|
214
|
+
# print(gene_ids)
|
|
215
|
+
# import h5py
|
|
216
|
+
# f = h5py.File(os.path.join(out_dir, "samples.h5"), "w")
|
|
217
|
+
# # f.create_dataset("gene_ids", data=gene_ids, compression="gzip")
|
|
218
|
+
# # f.create_dataset("tran_ids", data=tran_ids, compression="gzip")
|
|
219
|
+
# f.create_dataset("features", data=feature_all, compression="gzip")
|
|
220
|
+
# f.create_dataset("feature_ids", data=feature_ids, compression="gzip")
|
|
221
|
+
# # f.create_dataset("W_sample", data=W_all[:,-min(m2,sample_num):],
|
|
222
|
+
# # compression="gzip", compression_opts=9)
|
|
223
|
+
# # f.create_dataset("Psi_sample", data=Psi_all[:,-min(m1,sample_num):],
|
|
224
|
+
# # compression="gzip", compression_opts=9)
|
|
225
|
+
# # f.create_dataset("FPKM", data=RPK_all[:,-m1:].mean(axis=1),
|
|
226
|
+
# # compression="gzip", compression_opts=9)
|
|
227
|
+
# # f.create_dataset("counts", data=Cnt_all[:,-m1:].mean(axis=1),
|
|
228
|
+
# # compression="gzip", compression_opts=9)
|
|
229
|
+
# # f.create_dataset("sigma", data=np.array([sigma_]), compression="gzip")
|
|
230
|
+
# f.close()
|
|
231
|
+
|
|
232
|
+
# exit()
|
|
233
|
+
|
|
234
|
+
print("[Brie] loading reads for %d genes with %d cores..." %(TOTAL_GENE,
|
|
235
|
+
nproc))
|
|
236
|
+
global START_TIME
|
|
237
|
+
START_TIME = time.time()
|
|
238
|
+
|
|
239
|
+
R_all, len_iso_all, prob_iso_all = [], [], []
|
|
240
|
+
if nproc <= 1:
|
|
241
|
+
for g in genes:
|
|
242
|
+
RV = set_info(g, sam_file, bias_mode, ref_file, bias_file, FLmean,
|
|
243
|
+
FLstd, mate_mode, auto_min)
|
|
244
|
+
show_progress(RV)
|
|
245
|
+
R_all.append(RV["Rmat"])
|
|
246
|
+
len_iso_all.append(RV["len_iso"])
|
|
247
|
+
prob_iso_all.append(RV["prob_iso"])
|
|
248
|
+
|
|
249
|
+
else:
|
|
250
|
+
pool = multiprocessing.Pool(processes=nproc)
|
|
251
|
+
result = []
|
|
252
|
+
for g in genes:
|
|
253
|
+
result.append(pool.apply_async(set_info, (g, sam_file, bias_mode,
|
|
254
|
+
ref_file, bias_file, FLmean, FLstd, mate_mode, auto_min),
|
|
255
|
+
callback=show_progress))
|
|
256
|
+
pool.close()
|
|
257
|
+
pool.join()
|
|
258
|
+
for res in result:
|
|
259
|
+
RV = res.get()
|
|
260
|
+
R_all.append(RV["Rmat"])
|
|
261
|
+
len_iso_all.append(RV["len_iso"])
|
|
262
|
+
prob_iso_all.append(RV["prob_iso"])
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
print("\n[Brie] running Brie for %d isoforms on %d genes with %d cores..."
|
|
266
|
+
%(TOTAL_TRAN, TOTAL_GENE, nproc))
|
|
267
|
+
|
|
268
|
+
Psi_all, Y_all, RPK_all, Cnt_all, W_all, sigma_ = brie_MH_Heuristic(R_all,
|
|
269
|
+
len_iso_all, prob_iso_all, feature_all, idxF, weights_in=weights_in,
|
|
270
|
+
_sigma=_sigma, _lambda=_lambda, ftype=ftype, total_count=TOTAL_READ,
|
|
271
|
+
M=M, Mmin=initial, gap=gap, nproc=nproc)
|
|
272
|
+
|
|
273
|
+
save_data(out_dir, sample_num, gene_ids, tran_ids, tran_len, feature_all,
|
|
274
|
+
feature_ids, Psi_all, RPK_all, Cnt_all, W_all, sigma_)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
if __name__ == "__main__":
|
|
279
|
+
main()
|
|
280
|
+
|