FIRST IMPROVEMENT
​
The calculation for multiplexerSpecs need not be repeated for every primer.
​
kernelCount=9;(*dependsonnumberofCPUcores,installedRAM,andWolframlicense*)​​multiplexerSpecs=regexMultiplexerSpecs[primers];(*producesspecsfor
ϵ
accept
=4,5,...*)​​Do[​​ chrSequence=Import[chrFileSpec];​​ Do[​​ regexSpecifications=multiplexer[primer,multiplexerSpecs];​​ (*typically~70,occasionally200,rarelyafew1000*)​​ InitKernels[kernelCount];​​ ParallelDo[​​ regexString=Spec2String[regexSpec];​​ positions=StringPosition[chrSequence,RegularExpression[regexString]];​​ (*1000'swillbereturned*)​​ vettedCandidates=OrderedPartsCalc[positions,regexSpec,chrSequence];​​ exportFile=ExportFileCalc[regexSpec];​​ Export[exportFile,vettedCandidates],​​ {regexSpec,regexSpecifications},Method"CoarsestGrained"​​ ];​​ CloseKernels[];​​ regexSpecifications=Null;​​ Pause[1],​​ {primer,primers}(*afewtoafew1000*)​​ ];​​ chrSequence=Null,​​ {chrFileSpec,chromosomeFiles}(*typicallyaboutadozen*)​​];​​