Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ignaciot committed Feb 6, 2019
1 parent 91706c2 commit c5a06b1
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions bin/rcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ def calmp(num_of_reads, total_reads):


def gettotalreadsfromflagstat(flagstatfile):
f = open(flagstatfile)
f = open(flagstatfile)
lines = f.readlines()
mapped_reads = lines[0]
# mapped_reads = int(x[0])
print "mapped_reads", mapped_reads
return mapped_reads
# print "mapped_reads", mapped_reads
return mapped_reads


def main(Bedgraphfile, flagstatfile, readcountcorrBedgraphfile):
total_reads = gettotalreadsfromflagstat(flagstatfile)
wf = open(readcountcorrBedgraphfile, "w")
f = open(Bedgraphfile)
for line in f:
line = line.strip("\n")
line = line.split("\t")
num_of_reads = line[-1]
mp = calmp(num_of_reads, total_reads)
line[-1] = mp
wf.write("\t".join(map(str,line))+"\n")
wf.close()
f.close()
total_reads = gettotalreadsfromflagstat(flagstatfile)
wf = open(readcountcorrBedgraphfile, "w")
f = open(Bedgraphfile)
for line in f:
line = line.strip("\n")
line = line.split("\t")
num_of_reads = line[-1]
mp = calmp(num_of_reads, total_reads)
line[-1] = mp
wf.write("\t".join(map(str,line))+"\n")
wf.close()
f.close()


if __name__=="__main__":
Bedgraphfile, flagstatfile, readcountcorrBedgraphfile = sys.argv[1],sys.argv[2], sys.argv[3]
main(Bedgraphfile, flagstatfile, readcountcorrBedgraphfile)
Bedgraphfile, flagstatfile, readcountcorrBedgraphfile = sys.argv[1],sys.argv[2], sys.argv[3]
main(Bedgraphfile, flagstatfile, readcountcorrBedgraphfile)

0 comments on commit c5a06b1

Please sign in to comment.