Skip to content

Commit

Permalink
docs: add docstrings to functions in TrueConsense.Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
florianzwagemaker authored and KHajji committed Apr 14, 2022
1 parent 4e8a138 commit 47d8c89
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions TrueConsense/Coverage.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
def BuildCoverage(iDict, output):
"""This function takes a dictionary of dictionaries and an output file name as input, and writes the
coverage of each position to the output file.
Parameters
----------
iDict
a dictionary of with pileup contents per position
output
the name of the output file
"""
with open(output, "w") as outfile:
for i in range(len(iDict)):
cov = iDict[i + 1].get("coverage")
outfile.write(str(i + 1) + "\t" + str(cov) + "\n")


def GetCoverage(iDict, position):
"""Takes a dictionary and a position as input, and returns the coverage of that position
Parameters
----------
iDict
A dictionary with pileup contents per position
position
the position in the genome that you want to get the coverage for
Returns
-------
The coverage of the position.
"""
return iDict[position].get("coverage")

0 comments on commit 47d8c89

Please sign in to comment.