Build a CNV object.
Parameters: |
|
---|
Two initilization methods are available. One can either use the (chr, start, end) parameters to initilize the CNV object, or the more straight forward pos attribute. All the object are normalized to insure integrity.
Note
The pos kwarg is never stored as an attribute, but it can be retrieved using the cnv_struct.cnv.get_pos() function.
Gets the position string from the chr, start and end attributes.
Returns: | A position string of the form “chrXX:start-end”. |
---|---|
Return type: | str |
method of initialization.
All the missing attributes will be set to None, the type parameter will be inferred from the copy number, if available.
The CNV type is checked against expected values.
The chr, start and end are parsed from the pos if such an attribute is given.
given
Takes two family dicts (sample -> chromosome -> cnv list) and returns a new dict. corresponding to their intersection.
Parameters: |
|
---|---|
Returns: | A family dict with the intersection of the two CNV lists. |
Return type: | dict |
Takes two family dicts (sample -> chromosome -> cnv list) and returns a new dict. corresponding to their union.
Parameters: |
|
---|---|
Returns: | A family dict with the union of the two CNV lists. |
Return type: | dict |
Merges two CNVs into a new object spanning the whole region.
Parameters: |
|
---|---|
Returns: | The merged CNV object. |
Return type: |
Checks the overlap between two CNVs.
Parameters: |
|
---|---|
Returns: | Either returns a tuple of overlap ratios for both CNVs or, if a theshold is provided, a bool that is True if the overlap is sufficiently high. |
Takes a cnv and finds the reciprocal overlap with the best matching cnv in the provided list. :param cnv: A cnv (e.g. from a twin) :type cnv: cnv.
Parameters: | li (list.) – A list of cnv to find the best reciprocal overlapping cnv. |
---|---|
Returns: | Returns a 2-uple of the respective overlaps for both cnvs. |
Since there is rarely more than 1000 CNV per chromosome per sample, it is not necessary to sort the CNV list. A simple brute-force approach is deemed acceptable.