def refmap_stats(data, sample):
<EOL>mapf = os.path.join(data.dirs.refmapping, sample.name+"<STR_LIT>")<EOL>umapf = os.path.join(data.dirs.refmapping, sample.name+"<STR_LIT>")<EOL>cmd1 = [ipyrad.bins.samtools, "<STR_LIT>", umapf]<EOL>proc1 = sps.Popen(cmd1, stderr=sps.STDOUT, stdout=sps.PIPE)<EOL>result1 = proc1.communicate()[<NUM_LIT:0>]<EOL>cmd2 = [ipyrad.bins.samtools, "<STR_LIT>", mapf]<EOL>proc2 = sps.Popen(cmd2, stderr=sps.STDOUT, stdout=sps.PIPE)<EOL>result2 = proc2.communicate()[<NUM_LIT:0>]<EOL>if "<STR_LIT>" in data.paramsdict["<STR_LIT>"]:<EOL><INDENT>sample.stats["<STR_LIT>"] = int(result1.split()[<NUM_LIT:0>]) / <NUM_LIT:2><EOL>sample.stats["<STR_LIT>"] = int(result2.split()[<NUM_LIT:0>]) / <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>sample.stats["<STR_LIT>"] = int(result1.split()[<NUM_LIT:0>])<EOL>sample.stats["<STR_LIT>"] = int(result2.split()[<NUM_LIT:0>])<EOL><DEDENT>sample_cleanup(data, sample)<EOL>
Get the number of mapped and unmapped reads for a sample
and update sample.stats