Skip to content

Commit

Permalink
Fixing redundant column in LinearCount output
Browse files Browse the repository at this point in the history
  • Loading branch information
tjakobi committed Jan 21, 2018
1 parent 9b6470c commit 11fda2c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions DCC/CombineCounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ def combine(self, Alist, col=7, circ=True):
res.setdefault(line_nr, ['\t'.join(line_split[:3]+[line_split[5]])]).append(line_split[col - 1])

else: # input are host gene counts
res.setdefault(line_nr, ['\t'.join(line_split[:3]+[line_split[5]])]).append(line_split[col - 1])

res.setdefault(line_nr, ['\t'.join(line_split[:3])]).append(line_split[col - 1])
return res

def writeouput(self, output, res, samplelist=None, header=False):
Expand All @@ -155,3 +154,12 @@ def writeouput(self, output, res, samplelist=None, header=False):
for line_nr in sorted(res):
outfile.write("%s\n" % '\t'.join(res[line_nr]))
outfile.close()

def writeouput_linear(self, output, res, samplelist=None, header=False):
# Sample list is a string with sample names seperated by \t.
outfile = open(output, 'w')
if header:
outfile.write('Chr\tStart\tEnd\t' + samplelist + '\n')
for line_nr in sorted(res):
outfile.write("%s\n" % '\t'.join(res[line_nr]))
outfile.close()
2 changes: 1 addition & 1 deletion DCC/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def main():

# Combine all to a individual sample host gene count to a single table
res = cm.combine(linearfiles, col=6, circ=False)
cm.writeouput(output_linear_counts, res, samplelist, header=True)
cm.writeouput_linear(output_linear_counts, res, samplelist, header=True)
logging.info("Finished combine individual linear gene expression counts")

if not options.temp:
Expand Down

0 comments on commit 11fda2c

Please sign in to comment.