Skip to content

Instantly share code, notes, and snippets.

@holgerbrandl
Last active March 20, 2018 09:52
Show Gist options
  • Save holgerbrandl/4b4755e6f314f4e7e34571d48d12b7e0 to your computer and use it in GitHub Desktop.
Save holgerbrandl/4b4755e6f314f4e7e34571d48d12b7e0 to your computer and use it in GitHub Desktop.
Filter fastq with id list
//DEPS de.mpicbg.scicomp:kutils:0.7
//KOTLIN_OPTS -J-Xmx10g -J-server
import de.mpicbg.scicomp.bioinfo.openFastq
import java.io.File
//val args = listOf("ID.txt", "../lanereps_pooled/s1_WT_A_R1_paired.fastq")
val filterIds = File(args[0]).readLines().map{ "@" + it}
openFastq(args[1]).
filter { filterIds.contains(it.id.split(" ")[0]) }.
// size
// first()
forEach { print(it.toEntryString()) }
@holgerbrandl
Copy link
Author

Usage

fastqFile=../lanereps_pooled/s1_WT_A_R1_paired.fastq

kscript https://git.io/vxZnq ID.txt ${fastqFile} > ~/Desktop/$(basename $fastqFile .fastq).filt.fastq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment