

@follows(mkdir('fasta.dir'))
@transform(SEQUENCEFILES, SEQUENCEFILES_REGEX, 'fasta.dir/\\1.fa')
def preprocessReads(infile, outfile):
    '\n    create merged fasta file for use with metaphlan \n    '
    if infile.endswith('.fastq.gz'):
        E.info('converting fastq file to fasta file')
        outf = open(outfile, 'w')
        for fastq in Fastq.iterate(IOTools.openFile(infile)):
            outf.write(('%s\n%s\n' % (('>' + fastq.identifier), fastq.seq)))
        outf.close()
    elif outfile.endswith('.1.gz'):
        read2 = (P.snip(infile, '.1.gz') + '.2.gz')
        assert os.path.exists(read2), ('file does not exist %s' % read2)
        log = infile.replace('fastq.', '')
        statement = 'python %(scriptsdir)s/fastqs2fasta.py \n                   -a %(infile)s \n                   -b %(read2)s \n                   --log=%(log)s.log \n                   > %(outfile)s'
        P.run()

dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_metagenomecommunities.py preprocessReads/VarMisuse@108/189 `infile`->`outfile`