@@ -0,0 +1,747 @@
+import os%0Afrom bcbio.utils import splitext_plus%0Afrom bcbio.distributed import do%0A%0AADAPTER = %22AATGATACGGCGA%22%0A%0A%0Adef remove(data, args):%0A    work_dir = data%5B%22sample_id%22%5D%0A    in_file = data%5B%22fastq%22%5D%0A    out_dir = os.path.join(work_dir, %22adapter%22)%0A    out_file = os.path.join(out_dir, splitext_plus(os.path.basename(in_file))%5B0%5D + %22_clean.fastq%22)%0A    out_noadapter_file = os.path.join(out_dir, splitext_plus(os.path.basename(in_file))%5B0%5D + %22_fragments.fastq%22)%0A    cmd = _cmd_cutadapt()%0A    do.run(cmd.format(**locals()))%0A    data%5B%22clean_fastq%22%5D = out_file%0A    return data%0A%0A%0Adef _cmd_cutadapt():%0A    cmd = %22cutadapt --adapter=%7Badapter%7D --minimum-length=8 --untrimmed-output=%7Bout_noadapter_file%7D -o %7Bout_file%7D -m 17 --overlap=8 %7Bin_file%7D%22%0A    return cmd%0A

add adapter removal command