Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
subtable = table[key]
except KeyError:
subtable = table[key] = [0, 0, 0]
if record.flag & 0x40: # first of pair
subtable[1] += 1
elif record.flag & 0x80: # second of pair
subtable[2] += 1
else: # Singleton
subtable[0] += 1
references = bamfile.references
lengths = bamfile.lengths
with open(reroot_path(temp, self._outfile), "w") as table_file:
table_file.write("Group\tChr\tChrLen\tSingle\tFirst\tSecond\n")
for ((group, tid), subtable) in sorted(table.items()):
prefix = [group, references[tid], lengths[tid]]
row = [str(value) for value in (prefix + subtable)]
table_file.write("\t".join(row) + "\n")
move_file(reroot_path(temp, self._outfile), self._outfile)
subtable[0] += 1
references = bamfile.references
lengths = bamfile.lengths
with open(reroot_path(temp, self._outfile), "w") as table_file:
table_file.write("Group\tChr\tChrLen\tSingle\tFirst\tSecond\n")
for ((group, tid), subtable) in sorted(table.items()):
prefix = [group, references[tid], lengths[tid]]
row = [str(value) for value in (prefix + subtable)]
table_file.write("\t".join(row) + "\n")
move_file(reroot_path(temp, self._outfile), self._outfile)
def _run(self, _config, temp):
table = {}
for filename in self.input_files:
coverage.read_table(table, filename)
coverage.write_table(table, reroot_path(temp, self._output_file))
move_file(reroot_path(temp, self._output_file), self._output_file)
def _run(self, _config, temp):
table = {}
for filename in self.input_files:
coverage.read_table(table, filename)
coverage.write_table(table, reroot_path(temp, self._output_file))
move_file(reroot_path(temp, self._output_file), self._output_file)