forked from BradnerLab/pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipeline_template.py
executable file
·149 lines (95 loc) · 5.37 KB
/
pipeline_template.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/python
#pipeline_template.py
'''
The MIT License (MIT)
Copyright (c) 2013 Charles Lin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''
#generic pipeline template for human data
#==========================================================================
#=============================DEPENDENCIES=================================
#==========================================================================
import sys
sys.path.append('/ark/home/cl512/src/pipeline/')
import pipeline_dfci
import datetime
import random
import string
#==========================================================================
#============================PARAMETERS====================================
#==========================================================================
dataFile = '/grail/projects/MYPROJECT/DATA_TABLE.txt' #PATH TO YOUR DATA TABLE
genome ='hg18'
annotFile = '/ark/home/cl512/src/pipeline/annotation/hg19_refseq.ucsc'
#project folders
projectFolder = '/grail/projects/MYPROJECT/' #PATH TO YOUR PROJECT FOLDER
#standard folder names
gffFolder ='%sgff/' % (projectFolder)
macsFolder = '%smacsFolder/' % (projectFolder)
macsEnrichedFolder = '%smacsEnriched/' % (projectFolder)
mappedEnrichedFolder = '%smappedEnriched/' % (projectFolder)
mappedFolder = '%smappedFolder/' % (projectFolder)
wiggleFolder = '%swiggles/' % (projectFolder)
metaFolder = '%smeta/' % (projectFolder)
#making folders
folderList = [gffFolder,macsFolder,macsEnrichedFolder,mappedEnrichedFolder,mappedFolder,wiggleFolder,metaFolder]
for folder in folderList:
pipeline_dfci.formatFolder(folder,True)
#==========================================================================
#========================FORMATTING SAMPLE TABLE===========================
#==========================================================================
##THIS SECTION CREATES A DATA TABLE FROM A WHITEHEAD ANNOTATION SPREADSHEET
##give full path
##sampleTableFile = 'YOUR_WIGTC_ANNOTATION.xls' #<- the .xls file in the seq data folder provided by WI
#dirpath = '' <- provide full path of folder containing raw seq files
##e.g. /ark/home/jr246/raw/130925_..../QualityScore/
##bamPath <- where we store our bams. Must have write access if you want to call bowtie
##e.g. /ark/home/jr246/bam/
#bamPath = '/ark/home/jr246/bam/'
#pipeline_dfci.makePipelineTable(sampleTableFile,dirPath,bamPath,dataFile)
#dataDict = pipeline_dfci.loadDataTable(dataFile)
#namesList = dataDict.keys()
#print(namesList)
#==========================================================================
#=======================LOADING DATA ANNOTATION============================
#==========================================================================
##THIS SECTION LOADS A DATA TABLE. MUST BE UNCOMMENTED FOR REST OF CODE TO WORK
#LOADING THE DATA TABLE
dataDict = pipeline_dfci.loadDataTable(dataFile)
print(dataDict.keys())
#==========================================================================
#==========================CALLING BOWTIE==================================
#==========================================================================
##THIS SECTION CALLS BOWTIE ON RAW READ FILES TO GENERATE SORTED AND INDEXED BAMS IN THE BAM FOLDER
#namesList = [] <- fill this in if you want to only map a subset of the data. otherwise leave blank
##SET LAUNCH TO False to debug
#pipeline_dfci.makeBowtieBashJobs(dataFile,namesList,launch=True)
#==========================================================================
#=============================CALL MACS====================================
#==========================================================================
##THIS SECTION CALLS THE MACS ERROR MODEL
#namesList = dataDict.keys()
#print(namesList)
#pipeline_dfci.callMacs(dataFile,macsFolder,namesList,overwrite=False,pvalue='1e-9')
#==========================================================================
#=======================FORMAT MACS OUTPUT=================================
#==========================================================================
##THIS SECTION FORMATS THE OUTPUT FROM MACS, CREATES THE MACSENRICHED FOLDER AND MOVES WIGGLES TO THE DESTINATION
#pipeline_dfci.formatMacsOutput(dataFile,macsFolder,macsEnrichedFolder,wiggleFolder,wigLink='/ark/wiggles/')
#==========================================================================
#====================ADDITIONAL PIPELINE ANALYSIS==========================
#==========================================================================