@collate(fastq_files, regex(r".*?([^/]+)(_1|_2)\.fastq.gz"), 
        [r"%s/\1.sam" % sambam_dir, r"%s/\1.bwaPE.Success" % sambam_dir])
def bwaPE(inputs, outputs):
    """
    Aligns two paired-end fastq files to a reference genome to produce a sam file.
    """
    seq1, seq2 = sorted(inputs)
    output, flag_file = outputs
    fastq_name = os.path.basename(seq1)
    sample = fastq_metadata[fastq_name]['sample']
    runID = fastq_metadata[fastq_name]['run_id']
    lane = fastq_metadata[fastq_name]['lane']
    readgroup_metadata = { 'PL': 'ILLUMINA',
                           'SM': sample,
                           'ID': "%s_%s_Lane%d" % (sample, runID, lane) }
    metadata_str = make_metadata_string(readgroup_metadata)
    print (os.path.basename(seq1), os.path.basename(seq2)) % "bwa-mem on %s and %s"
    runStageCheck('bwaMemPE', flag_file, metadata_str, ref_files['bwa_reference'], seq1, seq2, output)
dataset/ETHPy150Open vlsci/variant_calling_pipeline/pipeline.py/bwaPE/swapped operands of `%`