Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A kscript/kotlin tool to filter fasta files by length
//DEPS de.mpicbg.scicomp:kutils:0.4
//KOTLIN_OPTS -J-Xmx5g
import de.mpicbg.scicomp.bioinfo.openFasta
import java.io.File
import kotlin.system.exitProcess
if (args.size != 2) {
System.err.println("Usage: fasta_filter <fasta> <length_cutoff>")
exitProcess(-1)
}
val fastaFile = File(args[0])
val lengthCutoff = args[1].toInt()
openFasta(fastaFile).
filter { it.sequence.length >= lengthCutoff }.
forEach { print(it.toEntryString()) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment