-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add docstrings to functions in
TrueConsense.Coverage
- Loading branch information
1 parent
4e8a138
commit 47d8c89
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |