| 5439 | } |
| 5440 | |
| 5441 | private static long[] splitFastaByLength(String inFasta, String outLongFasta, String outShortFasta, int lengthThreshold) throws IOException { |
| 5442 | FastaReader fin = new FastaReader(inFasta); |
| 5443 | FastaWriter foutLong = new FastaWriter(outLongFasta, false); |
| 5444 | FastaWriter foutShort = new FastaWriter(outShortFasta, false); |
| 5445 | long numLong = 0; |
| 5446 | long numShort = 0; |
| 5447 | while(fin.hasNext()) { |
| 5448 | String[] nameCommentSeq = fin.nextWithComment(); |
| 5449 | |
| 5450 | String header = nameCommentSeq[0]; |
| 5451 | if (!nameCommentSeq[1].isEmpty()) { |
| 5452 | header += " " + nameCommentSeq[1]; |
| 5453 | } |
| 5454 | |
| 5455 | String seq = nameCommentSeq[2]; |
| 5456 | |
| 5457 | if (seq.length() >= lengthThreshold) { |
| 5458 | foutLong.write(header, seq); |
| 5459 | ++numLong; |
| 5460 | } |
| 5461 | else { |
| 5462 | foutShort.write(header, seq); |
| 5463 | ++numShort; |
| 5464 | } |
| 5465 | } |
| 5466 | foutLong.close(); |
| 5467 | foutShort.close(); |
| 5468 | fin.close(); |
| 5469 | |
| 5470 | return new long[]{numShort, numLong}; |
| 5471 | } |
| 5472 | |
| 5473 | private static boolean mergePooledAssemblies(RNABloom assembler, |
| 5474 | String outdir, String assemblyName, String[] sampleNames, |