| 1 |
SET GLOBALS, if not already set, and if using samespecies, parameter set 1 |
| 2 |
obj.globals["heavyChainsOn"] = "1" |
| 3 |
obj.globals["matchExtenderOn"] = "1" |
| 4 |
obj.globals["uniqueFilterOn"] = "1" |
| 5 |
obj.globals["fillIntraRunGapsOn"] = "1" |
| 6 |
obj.globals["numsegments"] = "1" |
| 7 |
|
| 8 |
RUN BRIATAC HERE |
| 9 |
|
| 10 |
MAKE SURE MATCHES ARE IN ATAC FORMAT |
| 11 |
|
| 12 |
RUN HEAVYCHAINS, if enabled |
| 13 |
-g /assemblyId1=XXXX |
| 14 |
-g /assemblyId2=XXXX |
| 15 |
-g /heavyMaxJump=XXXX (100000) |
| 16 |
-g /heavyMinFill=XXXX (100) |
| 17 |
|
| 18 |
RUN GLOBAL CHAINING, if enabled |
| 19 |
# /work/assembly/floreald/ASM/src/Ross/chain-global |
| 20 |
# /work/assembly/floreald/ASM/src/break-chains |
| 21 |
|
| 22 |
All %s's are the prefix |
| 23 |
|
| 24 |
chain-global %s -M 30 -p DP > %s.M30.dp 2> %s.M30.dp.errs" |
| 25 |
break-chains %s.M30.dp -D 0 -M 10 -p DPR | grep -v 'M r ' > %s.M30.dp.runs 2> %s.M30.dp.runs.errs" |
| 26 |
|
| 27 |
RUN CHAIN CONSERVATION(?), if enabled |
| 28 |
# /work/assembly/floreald/ASM/src/Ross/chain-consv |
| 29 |
# /work/assembly/floreald/ASM/src/break-chains |
| 30 |
|
| 31 |
chain-consv %s -p CS > %s.cons 2> %s.cons.errs" % (inpname,inpname,inpname) |
| 32 |
break-chains %s.cons -diffrun -D 0 -M 10 -p TMP > %s.cons.runs.tmp 2> %s.cons.runs.tmp.errs" % (inpname,inpname,inpname) |
| 33 |
break-chains %s.cons.runs.tmp -D 0 -M 10 -p CSR | grep -v 'M r ' > %s.cons.runs 2> %s.cons.runs.errs" % (inpname,inpname,inpname) |
| 34 |
|
| 35 |
RUN CHAIN GREEDY, if enabled |
| 36 |
# /work/assembly/floreald/ASM/src/Ross/chain-greedy |
| 37 |
# /work/assembly/floreald/ASM/src/break_chains |
| 38 |
|
| 39 |
chain-greedy %s -p GR -M 10 -W 500 > %s.greedy 2> %s.greedy.errs" % (inpname, inpname, inpname) |
| 40 |
break-chains %s.greedy -D 0 -M 10 -p GRR | grep -v 'M r ' > %s.greedy.runs 2> %s.greedy.runs.errs" % (inpname, inpname, inpname) |
| 41 |
|
| 42 |
RUN MATCH EXTENDER, if enabled |
| 43 |
matchextender inpname outname |
| 44 |
|
| 45 |
SET SOME DEFAULTS (unless already set) |
| 46 |
obj.globals['rawMatchMerSize'] = 20 |
| 47 |
obj.globals['rawMatchMerMaxDegeneracy'] = 1 |
| 48 |
obj.globals['rawMatchMinSize'] = obj.globals['rawMatchMerSize'] |
| 49 |
|
| 50 |
# Many 2*rawMatchMerSize-1 matches are due to isolated single |
| 51 |
# nucleotide mutations in otherwise perfect repeats. |
| 52 |
# |
| 53 |
obj.globals['globalMatchMinSize'] = 2*int(obj.globals['rawMatchMerSize']) |
| 54 |
|
| 55 |
obj.globals['globalPerfectRunMinLen'] = 100 |
| 56 |
obj.globals['globalPerfectRunMaxGapLen'] = 100000 |
| 57 |
obj.globals['intraRunGapIsolatedMismatchLen'] = 20 |
| 58 |
|
| 59 |
RUN OLD |
| 60 |
self.globals['atacAlgorithmVersion'] = str(17) |
| 61 |
print >>STDERR, "runName = %s\n" % self.runName |
| 62 |
|
| 63 |
# The ATAC globals used by this script: |
| 64 |
opt_t = int(self.globals['globalMatchMinSize']) |
| 65 |
opt_l = int(self.globals['globalPerfectRunMinLen']) |
| 66 |
maxdiff = int(self.globals['globalPerfectRunMaxGapLen']) |
| 67 |
|
| 68 |
assemblyId1 = self.globals['assemblyId1'] |
| 69 |
assemblyId2 = self.globals["assemblyId2"] |
| 70 |
|
| 71 |
assemblyFilePrefix1 = self.globals['assemblyFilePrefix1'] |
| 72 |
assemblyFilePrefix2 = self.globals['assemblyFilePrefix2'] |
| 73 |
|
| 74 |
# Deprecated for same species comparisons 2003/09/09. |
| 75 |
boxRecoveryOn = 0 |
| 76 |
if(self.globals.has_key("boxRecoveryOn")): |
| 77 |
boxRecoveryOn = int(self.globals["boxRecoveryOn"]) |
| 78 |
|
| 79 |
BUILD IDXSTORE (assemblyIdx1) for the files |
| 80 |
|
| 81 |
GENERALLY, after each step, the outfile replaces self.matches |
| 82 |
|
| 83 |
STEP |
| 84 |
RUN UNIQUE FILTER |
| 85 |
UniqueFilter.main( self.matches, outfile) |
| 86 |
|
| 87 |
STEP |
| 88 |
RUN FILTER BY MATCH LENGTH |
| 89 |
only keep those M records with both pieces at least as long as opt_t |
| 90 |
|
| 91 |
STEP |
| 92 |
RUN TRIMMING for bp one-to-one-ness (rewrite-trimMatches) |
| 93 |
inpfile = self.matches |
| 94 |
trim_subtype = 'u' |
| 95 |
|
| 96 |
gp = MyFile.myfile() |
| 97 |
MatchRecord.sortInXorderAP(inpfile,gp) |
| 98 |
|
| 99 |
# The following coalescing assumes perfect runs. |
| 100 |
# this is the same as rewrite-coalesceMatches |
| 101 |
|
| 102 |
hp = MyFile.myfile() |
| 103 |
coalesceMatches( gp, hp, ((trim_subtype == 'x') or (trim_subtype == 'u')) ) |
| 104 |
|
| 105 |
gp = MyFile.myfile() |
| 106 |
trimMatchOverlapsInX(hp,gp,trim_subtype) |
| 107 |
|
| 108 |
hp = MyFile.myfile() |
| 109 |
MatchRecord.sortInYorderAP(gp,hp) |
| 110 |
|
| 111 |
trimMatchOverlapsInY(hp,outfile,trim_subtype) |
| 112 |
|
| 113 |
|
| 114 |
if boxRecoveryOn, save these self.matches (outfile from last step) for later |
| 115 |
|
| 116 |
|
| 117 |
STEP |
| 118 |
FORM PERFECT RUNS (rewrite-perfectRuns) |
| 119 |
tempdata = PerfectRuns.formPerfectRuns(self.matches, |
| 120 |
MatchRecord.sortInXorderAP, |
| 121 |
MatchRecord.sortInYorderAP, |
| 122 |
maxdiff, |
| 123 |
'r') |
| 124 |
|
| 125 |
STEP |
| 126 |
ONLY KEEP LONG RUNS |
| 127 |
tempdata = onlyKeepLongRuns( self.matches, outprefix, opt_l) |
| 128 |
|
| 129 |
description: find all runs (matches with the same run id) |
| 130 |
that have a sum of lengths larger than opt_l |
| 131 |
|
| 132 |
details: |
| 133 |
if there is a last match, and it is a different runid |
| 134 |
than this match, dump all the saved matches, reset |
| 135 |
the length to zero |
| 136 |
|
| 137 |
add in the length of this match to the length |
| 138 |
|
| 139 |
if the length we've seen so far is |
| 140 |
less than lengthThreshold, save this match |
| 141 |
|
| 142 |
otherwise (the length is bigger) print all |
| 143 |
saved matches, and this match. clear the list |
| 144 |
of saved matches, but do not clear the length |
| 145 |
|
| 146 |
remember the runid of this match (call it lastId) |
| 147 |
|
| 148 |
|
| 149 |
STEP |
| 150 |
'HEAL' THE PERFECT RUNS (rewrite-perfectRuns) |
| 151 |
tempdata = PerfectRuns.formPerfectRuns(self.matches, |
| 152 |
MatchRecord.sortInYorderAP, |
| 153 |
MatchRecord.sortInXorderAP, maxdiff, 'r') |
| 154 |
|
| 155 |
STEP |
| 156 |
DO BOX RECOVERY, if enabled (rewrite-boxRecovery) |
| 157 |
print >>STDERR, "Make sorted raw matches" |
| 158 |
outfile = MyFile.myfile() |
| 159 |
MatchRecord.sortInXorderAP( rawfile, outfile) |
| 160 |
rawfile = outfile |
| 161 |
|
| 162 |
print >>STDERR, "perform box recovery" |
| 163 |
tempdata = boxRecovery( self.matches, rawfile, outprefix) |
| 164 |
|
| 165 |
form perfect runs again |
| 166 |
tempdata = PerfectRuns.formPerfectRuns(self.matches, |
| 167 |
MatchRecord.sortInXorderAP, |
| 168 |
MatchRecord.sortInYorderAP, maxdiff, 'r') |
| 169 |
|
| 170 |
STEP |
| 171 |
SQUEEZE INTRA RUN GAPS |
| 172 |
squeezeIntraRunGaps.squeezeIntraRunGaps( |
| 173 |
self.matches, |
| 174 |
tempdata, |
| 175 |
assemblyIdx1, assemblyIdx2) |
| 176 |
|
| 177 |
tempy = MyFile.myfile() |
| 178 |
|
| 179 |
# Beware the current match subtypes are 'x', 'L', and 'R'! |
| 180 |
|
| 181 |
coalesceMatches( tempdata, tempy, 1) |
| 182 |
|
| 183 |
self.matches = tempy |
| 184 |
|
| 185 |
STEP |
| 186 |
TRIMMING FOR bp one-to-one-ness |
| 187 |
# THIS IS ALSO DONE ABOVE! trimMatchOverlapsInBoth was a metafunction |
| 188 |
TrimMatchOverlaps.trimMatchOverlapsInBoth(self.matches,tempdata,'u') |
| 189 |
|
| 190 |
STEP |
| 191 |
PERFECT RUNS AS MATCHES (rewrite-runsAsMatches) |
| 192 |
self.runs = PerfectRuns.runsAsMatches( self.matches) |
| 193 |
|
| 194 |
STEP |
| 195 |
FILL INTRA RUN GAPS, if enabled |
| 196 |
|
| 197 |
set defaults if not set |
| 198 |
self.globals['fillIntraRunGapsErate'] = 0.10 |
| 199 |
self.globals['fillIntraRunGapsMaxGap'] = 100000 |
| 200 |
|
| 201 |
fillIntraRunGapsErate = float(self.globals['fillIntraRunGapsErate']) |
| 202 |
fillIntraRunGapsMaxGap = int(self.globals['fillIntraRunGapsMaxGap']) |
| 203 |
|
| 204 |
fillIntraRunGaps.mainLoop( self.matches, tempdata, |
| 205 |
assemblyIdx1, assemblyIdx2, |
| 206 |
fillIntraRunGapsMaxGap, fillIntraRunGapsErate) |
| 207 |
|
| 208 |
print >>STDERR, "trim the overlaps" |
| 209 |
TrimMatchOverlaps.trimMatchOverlapsInBoth(self.matches,tempdata,'u') |
| 210 |
|
| 211 |
self.matches = tempdata |
| 212 |
|
| 213 |
STEP |
| 214 |
COUNT NUMBER OF SUBSTITUTIONS |
| 215 |
countMisMatches.countMisMatches(self.matches, tempdata, assemblyIdx1, assemblyIdx2) |
| 216 |
|
| 217 |
ALL DONE |