(String[] inputFastxPaths,
FastaWriter longSeqWriter,
FastaWriter shortSeqWriter,
FastaWriter repeatsSeqWriter,
Writer polyAReadNamesWriter,
String sampleReadLengthsPath,
int minKmerCov,
int maxErrCorrItr,
int numThreads,
int maxSampleSize,
int minSeqLen,
boolean reverseComplement,
boolean trimArtifact,
boolean storeReads)
| 3946 | */ |
| 3947 | |
| 3948 | public ArrayList<BitSequence> correctLongReadsMultithreaded(String[] inputFastxPaths, |
| 3949 | FastaWriter longSeqWriter, |
| 3950 | FastaWriter shortSeqWriter, |
| 3951 | FastaWriter repeatsSeqWriter, |
| 3952 | Writer polyAReadNamesWriter, |
| 3953 | String sampleReadLengthsPath, |
| 3954 | int minKmerCov, |
| 3955 | int maxErrCorrItr, |
| 3956 | int numThreads, |
| 3957 | int maxSampleSize, |
| 3958 | int minSeqLen, |
| 3959 | boolean reverseComplement, |
| 3960 | boolean trimArtifact, |
| 3961 | boolean storeReads) throws InterruptedException, IOException, Exception { |
| 3962 | |
| 3963 | int minNumSolidKmers = Math.max(0, (int) Math.floor(minSeqLen/100.0)); |
| 3964 | //int minNumSolidKmers = Math.max(0, (int) Math.floor((minSeqLen-k+1) * percentIdentity / k)); |
| 3965 | |
| 3966 | long numReads = 0; |
| 3967 | ArrayBlockingQueue<Sequence2> outputQueue = new ArrayBlockingQueue<>(maxSampleSize); |
| 3968 | |
| 3969 | LongReadCorrectionWorker[] correctionWorkers = new LongReadCorrectionWorker[numThreads]; |
| 3970 | Thread[] threads = new Thread[numThreads]; |
| 3971 | |
| 3972 | FastxSequenceIterator itr = new FastxSequenceIterator(inputFastxPaths, minAvgBaseQual, false); |
| 3973 | |
| 3974 | for (int i=0; i<numThreads; ++i) { |
| 3975 | LongReadCorrectionWorker worker = new LongReadCorrectionWorker(itr, outputQueue, maxErrCorrItr, minKmerCov, |
| 3976 | minNumSolidKmers, reverseComplement, trimArtifact); |
| 3977 | correctionWorkers[i] = worker; |
| 3978 | threads[i] = new Thread(worker); |
| 3979 | threads[i].start(); |
| 3980 | } |
| 3981 | //System.out.println("Initialized " + numThreads + " worker(s)."); |
| 3982 | |
| 3983 | CorrectedLongReadsWriterWorker2 writerWorker = new CorrectedLongReadsWriterWorker2(outputQueue, |
| 3984 | longSeqWriter, shortSeqWriter, repeatsSeqWriter, polyAReadNamesWriter, sampleReadLengthsPath, |
| 3985 | maxSampleSize, minSeqLen, storeReads); |
| 3986 | Thread writerThread = new Thread(writerWorker); |
| 3987 | writerThread.start(); |
| 3988 | //System.out.println("Initialized writer."); |
| 3989 | |
| 3990 | for (Thread t : threads) { |
| 3991 | t.join(); |
| 3992 | } |
| 3993 | |
| 3994 | writerWorker.terminateWhenInputExhausts(); |
| 3995 | writerThread.join(); |
| 3996 | |
| 3997 | // check for errors |
| 3998 | if (!writerWorker.isSucessful()) { |
| 3999 | throw writerWorker.getExceptionCaught(); |
| 4000 | } |
| 4001 | |
| 4002 | long numArtifacts = 0; |
| 4003 | long numDiscarded = 0; |
| 4004 | for (LongReadCorrectionWorker worker : correctionWorkers) { |
| 4005 | if (!worker.isSucessful()) { |
no test coverage detected