use of com.milaboratory.core.io.sequence.fasta.FastaSequenceWriterWrapper in project mixcr by milaboratory.
the class ActionExportCloneReads method createWriter.
private static SequenceWriter createWriter(boolean paired, String fileName) throws IOException {
String[] split = fileName.split("\\.");
String ext = split[split.length - 1];
boolean gz = ext.equals("gz");
if (gz)
ext = split[split.length - 2];
if (ext.equals("fasta")) {
if (paired)
throw new IllegalArgumentException("Fasta does not support paired reads.");
return new FastaSequenceWriterWrapper(fileName);
} else if (ext.equals("fastq")) {
if (paired) {
String fileName1 = fileName.replace(".fastq", "_R1.fastq");
String fileName2 = fileName.replace(".fastq", "_R2.fastq");
return new PairedFastqWriter(fileName1, fileName2);
} else
return new SingleFastqWriter(fileName);
}
if (paired)
return new PairedFastqWriter(fileName + "_R1.fastq.gz", fileName + "_R2.fastq.gz");
else
return new SingleFastqWriter(fileName + ".fastq.gz");
}
Aggregations