def fetch_cluster_se(data, samfile, chrom, rstart, rend):
<EOL>overlap_buffer = data._hackersonly["<STR_LIT>"]<EOL>rstart_buff = rstart + overlap_buffer<EOL>rend_buff = rend - overlap_buffer<EOL>if rstart_buff > rend_buff:<EOL><INDENT>tmp = rstart_buff<EOL>rstart_buff = rend_buff<EOL>rend_buff = tmp<EOL><DEDENT>if rstart_buff == rend_buff:<EOL><INDENT>rend_buff += <NUM_LIT:1><EOL><DEDENT>rdict = {}<EOL>clust = []<EOL>iterreg = []<EOL>iterreg = samfile.fetch(chrom, rstart_buff, rend_buff)<EOL>for read in iterreg:<EOL><INDENT>if read.qname not in rdict:<EOL><INDENT>rdict[read.qname] = read<EOL><DEDENT><DEDENT>sfunc = lambda x: int(x.split("<STR_LIT>")[<NUM_LIT:1>].split("<STR_LIT:;>")[<NUM_LIT:0>])<EOL>rkeys = sorted(rdict.keys(), key=sfunc, reverse=True)<EOL>try:<EOL><INDENT>read1 = rdict[rkeys[<NUM_LIT:0>]]<EOL><DEDENT>except ValueError:<EOL><INDENT>LOGGER.error("<STR_LIT>".format(rkeys[<NUM_LIT:0>], rdict))<EOL>return "<STR_LIT>"<EOL><DEDENT>poss = read1.get_reference_positions(full_length=True)<EOL>seed_r1start = min(poss)<EOL>seed_r1end = max(poss)<EOL>if read1.is_reverse:<EOL><INDENT>seq = revcomp(read1.seq)<EOL><DEDENT>else:<EOL><INDENT>seq = read1.seq<EOL><DEDENT>size = sfunc(rkeys[<NUM_LIT:0>])<EOL>clust.append("<STR_LIT>".format(chrom, seed_r1start, seed_r1end, size, seq))<EOL>if len(rkeys) > <NUM_LIT:1>:<EOL><INDENT>for key in rkeys[<NUM_LIT:1>:]:<EOL><INDENT>skip = False<EOL>try:<EOL><INDENT>read1 = rdict[key]<EOL><DEDENT>except ValueError:<EOL><INDENT>read1 = rdict[key][<NUM_LIT:0>]<EOL>skip = True<EOL><DEDENT>if not skip:<EOL><INDENT>poss = read1.get_reference_positions(full_length=True)<EOL>minpos = min(poss)<EOL>maxpos = max(poss)<EOL>if read1.is_reverse:<EOL><INDENT>seq = revcomp(read1.seq)<EOL><DEDENT>else:<EOL><INDENT>seq = read1.seq<EOL><DEDENT>size = sfunc(key)<EOL>clust.append("<STR_LIT>".format(chrom, minpos, maxpos, size, seq))<EOL><DEDENT>else:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>return clust<EOL>
Builds a single end cluster from the refmapped data.