Skip to content

Commit

Permalink
docs: add docstrings to functions in TrueConsense.Events
Browse files Browse the repository at this point in the history
  • Loading branch information
florianzwagemaker authored and KHajji committed Apr 14, 2022
1 parent 47d8c89 commit 6d754e3
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions TrueConsense/Events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@


def ListInserts(iDict, mincov, bam):
"""This function takes a dictionary pileup contents, a minimum coverage value, and a bam file.
returns a boolean and a dictionary of insert positions.
Parameters
----------
iDict
This is the dictionary that contains pileup information including coverage and insertions for each position.
mincov
minimum coverage to take into account
bam
the bam file
Returns
-------
A boolean value and a dictionary of positions with the insert size and nucleotide sequence
"""
positions = {}

for k in iDict.keys():
Expand All @@ -28,6 +45,21 @@ def ListInserts(iDict, mincov, bam):


def ExtractInserts(bam, position):
"""It takes a bam file and a position and returns the most common insert sequence and the size of the
insert
Parameters
----------
bam
the bam file
position
the position in the reference genome to extract
Returns
-------
the most common insert sequence and the size of the insert.
"""
rname = bam.references[0]
start = position - 1
end = position
Expand All @@ -51,6 +83,20 @@ def ExtractInserts(bam, position):


def MinorityDel(index, p):
"""If the percentage of deletions on a position is greater than 15%, then return True
Parameters
----------
index
The dictionary with pileup contents per position
p
position in the genome
Returns
-------
True or False
"""
cov = index[p].get("coverage")
dels = index[p].get("X")
perc = (dels / cov) * 100
Expand Down

0 comments on commit 6d754e3

Please sign in to comment.