annotate SMART/DiffExpAnal/gsnap_parallel_unSQL.py @ 31:0ab839023fe4

Uploaded
author m-zytnicki
date Tue, 30 Apr 2013 14:33:21 -0400
parents 94ab73e8a190
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
1 #!/usr/bin/env python
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
2
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3 import optparse, os, shutil, subprocess, sys, tempfile, fileinput, tarfile, glob
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4 import time
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5 from commons.core.launcher.Launcher import Launcher
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6 from commons.core.sql.TableJobAdaptatorFactory import TableJobAdaptatorFactory
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7 from commons.core.utils.FileUtils import FileUtils
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8 from optparse import OptionParser
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10 def stop_err( msg ):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11 sys.stderr.write( "%s\n" % msg )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12 sys.exit()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14 def toTar(tarFileName, accepted_hits_outputNames):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15 tfile = tarfile.open(tarFileName + ".tmp.tar", "w")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16 currentPath = os.getcwd()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17 os.chdir(dir)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18 for file in accepted_hits_outputNames:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19 relativeFileName = os.path.basename(file)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20 tfile.add(relativeFileName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21 os.system("mv %s %s" % (tarFileName + ".tmp.tar", tarFileName))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 tfile.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23 os.chdir(currentPath)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25 def joinSAM(dCutOut2Out):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26 for key in dCutOut2Out.keys():
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27 FileUtils.catFilesFromList(dCutOut2Out[key],key, False)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
28
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
29 def _map(iLauncher, cmd, cmdStart, cmdFinish ):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
30 lCmds = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
31 lCmds.extend(cmd)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
32 lCmdStart = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
33 lCmdStart.extend(cmdStart)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
34 lCmdFinish = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
35 lCmdFinish.extend(cmdFinish)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
36 return(iLauncher.prepareCommands_withoutIndentation(lCmds, lCmdStart, lCmdFinish))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
37
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
38 def _createGsnapSplicingOptions(options):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
39 lArgs = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
40 lArgs.append("-N %s" % options.novelsplicing)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
41 if options.useSplicing:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
42 lArgs.append("-s %s" % options.useSplicing)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
43 lArgs.append("-w %s" % options.localsplicedist)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
44 lArgs.append("-e %s" % options.localSplicePenality)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
45 lArgs.append("-E %s" % options.distantSplicePenality)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
46 lArgs.append("-K %s" % options.distantSpliceEndlength)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
47 lArgs.append("-l %s" % options.shortendSpliceEndlength)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
48
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
49
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
50 return lArgs
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
51
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
52 def _createGsnapPairedEndOptions(options):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
53 lArgs = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
54 if not(options.useSplicing or options.pairedEndFile):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
55 lArgs.append("--pairmax-dna %s" % options.pairmaxRna)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
56 if options.useSplicing or options.pairedEndFile:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
57 lArgs.append("--pairmax-rna %s" % options.pairmaxRna)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
58 lArgs.append("--pairexpect=%s" % options.pairexpect)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
59 lArgs.append("--pairdev=%s" % options.pairedev)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
60
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
61
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
62
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
63 def _createGsnapCommand(iLauncher, options, workingDir, inputFileNames, inputRevFilesNames, outputFileName, batchNumber, numberOfBatch):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
64 lArgs = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
65 lArgs.append("-d %s" % options.genomeName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
66 lArgs.append("-k %s" % options.kmer)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
67 lArgs.append("-D %s" % workingDir)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
68 lArgs.append("-A %s" % options.outputFormat)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
69 lArgs.append("-q %s/%s" % (batchNumber, numberOfBatch))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
70 lArgs.append("--no-sam-headers")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
71 lArgs.append(inputFileNames)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
72 print 'N option: %s, pairedEndFile option: %s' %(options.novelsplicing, options.pairedEndFile)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
73 if options.pairedEndFile:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
74 lArgs.append(inputRevFilesNames)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
75 if options.novelsplicing == '1':
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
76 lArgs.extend(_createGsnapSplicingOptions(options))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
77 elif options.pairedEndFile:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
78 lArgs.extend(_createGsnapPairedEndOptions(options))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
79
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
80 lArgs.append("> %s" % outputFileName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
81 return iLauncher.getSystemCommand("gsnap", lArgs)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
82
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
83 def __main__():
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
84 #Parse Command Line
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
85 description = "GMAP/GSNAP version:2012-12-20."
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
86 parser = OptionParser(description = description)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
87 parser.add_option('-o', '--outputTxtFile', dest='outputTxtFile', help='for Differential expression analysis pipeline, new output option gives a txt output containing the list of mapping results.')
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
88 parser.add_option("-q", "--inputTxt", dest="inputTxt", action="store", type="string", help="input, a txt file for a list of input reads files [compulsory]")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
89 parser.add_option('-t', '--tar', dest='outputTar', default=None, help='output all accepted hits results in a tar file.' )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
90 parser.add_option("-d", "--genomeName", dest="genomeName", help="Define the reference genome name.[compulsory]")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
91 # parser.add_option("-o", "--outputFile", dest="outputfile", help="output[compulsory]")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
92 parser.add_option("-k", "--kmer", dest="kmer", default=12, help="Choose kmer value (<=16), a big kmer value can take more RAM(4Go).[compulsory]")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
93 parser.add_option("-i", "--inputFasta", dest="inputFastaFile", help="Reference genome file, fasta format.[compulsory]")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
94 parser.add_option("-p", "--pairedEnd", dest="pairedEndFile", default=None, help="Input paired-end fastq file.")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
95 parser.add_option("-A", "--outputFormat", dest="outputFormat", default="sam", help="Choose an output format [sam, goby (need to re-compile with appropriate options)].")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
96 #Splicing options for RNA-Seq
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
97 parser.add_option("-N","--novelsplicing", dest="novelsplicing", default=0, help="Look for novel splicing (0=no (default), 1=yes)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
98 parser.add_option("-s","--use-splicing", dest="useSplicing",action="store", type="string", help="Look for splicing involving known sites or known introns (in <STRING>.iit), at short or long distances")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
99 parser.add_option("-w","--localsplicedist", dest="localsplicedist", default=200000, help="Definition of local novel splicing event (default 200000)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
100 parser.add_option("-e","--local-splice-penality", dest="localSplicePenality", default=0, help="Penalty for a local splice (default 0). Counts against mismatches allowed")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
101 parser.add_option("-E","--distant-splice-penality", dest="distantSplicePenality", default=1, help="Penalty for a distant splice (default 1). A distant splice is one where the intron length exceeds the value of -w, or --localsplicedist, or is an inversion, scramble, or translocation between two different chromosomes Counts against mismatches allowed")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
102 parser.add_option("-K","--distant-splice-endlength", dest="distantSpliceEndlength", default=16, help="Minimum length at end required for distant spliced alignments (default 16, min allowed is the value of -k, or kmer size)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
103 parser.add_option("-l","--shortend-splice-endlength", dest="shortendSpliceEndlength", default=2, help="Minimum length at end required for short-end spliced alignments (default 2, but unless known splice sites are provided with the -s flag, GSNAP may still need the end length to be the value of -k, or kmer size to find a given splice")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
104
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
105 #Specific paired-ends reads
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
106 parser.add_option("--pairmax-dna", dest="pairmaxDna", default=1000, help="Max total genomic length for DNA-Seq paired reads, or other reads without splicing (default 1000).")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
107 parser.add_option("--pairmax-rna", dest="pairmaxRna", default=2000, help="Max total genomic length for RNA-Seq paired reads, or other reads that could have a splice (default 200000).")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
108 parser.add_option("--pairexpect", dest="pairexpect", default=200, help="Expected paired-end length, used for calling splices in medial part of paired-end reads (default 200)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
109 parser.add_option("--pairdev", dest="pairdev", default=25, help="Allowable deviation from expected paired-end length, used for calling splices in medial part of paired-end reads (default 25)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
110
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
111 (options, args) = parser.parse_args()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
112
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
113 workingDir = os.path.dirname(options.inputFastaFile)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
114
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
115 file = open(options.inputTxt,"r")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
116 lines = file.readlines()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
117 inputFileNames = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
118 gsnapOutputNames = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
119 outputName = options.outputTxtFile
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
120 resDirName = os.path.dirname(outputName) + '/'
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
121 out = open(outputName, "w")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
122 for line in lines:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
123 timeId = time.strftime("%Y%m%d%H%M%S")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
124 tab = line.split()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
125 inputFileNames.append(tab[1])
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
126 OutputName = resDirName + tab[0] + '_samOutput_%s.sam' % timeId
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
127 gsnapOutputNames.append(OutputName)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
128 out.write(tab[0] + '\t' + OutputName + '\n')
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
129 file.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
130 out.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
131
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
132 if options.pairedEndFile:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
133 revFile = open(options.pairedEndFile,"r")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
134 lines = revFile.readlines()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
135 inputRevFileNames = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
136 for line in lines:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
137 revTab = line.split()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
138 inputRevFileNames.append(revTab[1])
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
139 revFile.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
140
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
141 #Create gsnap make
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
142 lCmdsTuples =[]
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
143 acronym = "gsnap_make"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
144 jobdb = TableJobAdaptatorFactory.createJobInstance()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
145 iLauncher = Launcher(jobdb, os.getcwd(), "", "", os.getcwd(), os.getcwd(), "jobs", "", acronym, acronym, False, True)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
146 cmds = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
147 cmd_setup = "gmap_setup -d %s -D %s -k %s %s;" % (options.genomeName, workingDir, options.kmer, options.inputFastaFile)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
148 cmds.append(cmd_setup)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
149 cmd_make_coords = "make -f Makefile.%s coords;" % options.genomeName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
150 cmds.append(cmd_make_coords)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
151 cmd_make_gmapdb = "make -f Makefile.%s gmapdb;" % options.genomeName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
152 cmds.append(cmd_make_gmapdb)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
153 cmd_make_install = "make -f Makefile.%s install;" % options.genomeName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
154 cmds.append(cmd_make_install)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
155 cmd_index = iLauncher.getSystemCommand("", cmds)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
156 cmd2Launch = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
157 cmdStart = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
158 cmdFinish = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
159 cmd2Launch.append(cmd_index)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
160 lCmdsTuples.append(_map(iLauncher, cmd2Launch, cmdStart, cmdFinish))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
161 iLauncher.runLauncherForMultipleJobs(acronym, lCmdsTuples, True)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
162
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
163 acronym = "gsnap"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
164 jobdb = TableJobAdaptatorFactory.createJobInstance()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
165 iLauncher = Launcher(jobdb, os.getcwd(), "", "", os.getcwd(), os.getcwd(), "jobs", "", acronym, acronym, False, True)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
166 lCmdsTuples = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
167 dCutOut2Out = {}
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
168 lAllFile2remove = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
169 numberOfBatch = 20 #usually for testing, working on to find a value for default launch on galaxy
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
170 for i in range(len(inputFileNames)):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
171 lCutOutput = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
172 for j in range(numberOfBatch):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
173 cutOutput = "%s_out_%s" % (inputFileNames[i], j)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
174 lCutOutput.append(cutOutput)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
175 lAllFile2remove.extend(lCutOutput)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
176 cmd2Launch = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
177 if options.pairedEndFile:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
178 inputRevFile = inputRevFileNames[i]
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
179 else:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
180 inputRevFile = ""
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
181 cmd2Launch.append(_createGsnapCommand(iLauncher, options, workingDir, inputFileNames[i], inputRevFile, cutOutput, j, numberOfBatch))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
182 cmdStart = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
183 cmdFinish = []
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
184 lCmdsTuples.append(_map(iLauncher, cmd2Launch, cmdStart, cmdFinish))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
185 dCutOut2Out[gsnapOutputNames[i]] = lCutOutput
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
186 iLauncher.runLauncherForMultipleJobs(acronym, lCmdsTuples, True)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
187
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
188 joinSAM(dCutOut2Out)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
189 FileUtils.removeFilesFromListIfExist(lAllFile2remove)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
190
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
191 if options.outputTar != None:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
192 toTar(options.outputTar, gsnapOutputNames)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
193
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
194
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
195 if __name__=="__main__": __main__()