-
Notifications
You must be signed in to change notification settings - Fork 6
/
run_mRNA.py
99 lines (77 loc) · 2.61 KB
/
run_mRNA.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#-*- coding:utf-8 -*-
from __future__ import division
import re,sys,os
import cPickle as pickle
import numpy as np
from optparse import OptionParser
import RNA_v2.frame.module01_mapping_from_raw as m01
import RNA_v2.frame.module02_RNA_Quantification as m02
import RNA_v2.frame.module03_Stat_Sample as m03
import RNA_v2.utils.module_create_database as m_db
def prepare_optparser():
usage ="""usage: %s [options] sample_input_information_xls
Reference fasta file and refGene file should be all put in dictionary
self.Database, which were defined in settings/projpath.py
If not put in self.Database, this program will downloading from UCSC.
Detail information could be reached in utils/module_create_database.py
Suport genome includes:
http://hgdownload.soe.ucsc.edu/goldenPath
Using -h or --help for more information
Example:
python %s --ref hg19 samp_test.xls
""" % (sys.argv[0],sys.argv[0])
description = " mRNA analysis pipeline "
optparser = OptionParser(
version="%s v2.0 20150610" % (sys.argv[0]),
description=description,
usage=usage,
add_help_option=False
)
optparser.add_option(
"-r", "--ref", default="hg19",
help="\nReference genome. [default: %default]"
)
optparser.add_option(
"--extra_GTF", default=None,
help="\nExtra GTF file for lncRNA. [default: %default]"
)
optparser.add_option(
"--given_GTF", default=None,
help="\nGiven GTF. Gene id for LncRNA should be lncGene"+\
"while trans id should be lncTran. [default: %default]"
)
optparser.add_option(
"-h", "--help", action="help",
help="\nShow this help message and exit."
)
return optparser
def main():
prepare_optparser()
(options,args) = prepare_optparser().parse_args()
try:
sam_RNAinfo = args[0]
ref = options.ref
extra_GTF = options.extra_GTF
given_GTF = options.given_GTF
except IndexError:
prepare_optparser().print_help()
sys.exit(1)
part0 = m_db.DataBaseInit(ref, sam_RNAinfo, is_debug=0)
part0.check_files()
part1 = m01.Map_From_raw(ref, sam_RNAinfo, is_debug=0)
part1.s01_QC(core_num=4)
part1.s02_Tophat(core_num=1)
part2 = m02.RNA_Quantification(ref, sam_RNAinfo, core_num=4, is_debug=0)
part2.run_pipeline(extra_GTF, given_GTF, is_MergeSam=1)
part3 = m03.SampStat(ref, sam_RNAinfo, given_GTF, is_debug=0)
try:
part3.Basic_Stat()
except:
pass
try:
part3.ERCC_Stat()
except:
pass
part3.Repeat_Stat()
if __name__ == '__main__':
main()