-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhict.api.ContactMatrixFacet.html
More file actions
179 lines (156 loc) · 16.7 KB
/
hict.api.ContactMatrixFacet.html
File metadata and controls
179 lines (156 loc) · 16.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!--
~ MIT License
~
~ Copyright (c) 2021-2026. Aleksandr Serdiukov, Anton Zamyatin, Aleksandr Sinitsyn, Vitalii Dravgelis and Computer Technologies Laboratory ITMO University team.
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module hict.api.ContactMatrixFacet</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="hict.html"><font color="#ffffff">hict</font></a>.<a href="hict.api.html"><font color="#ffffff">api</font></a>.ContactMatrixFacet</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:c%3A%5Cusers%5Ctux%5Cdocuments%5Chict%5Chict%5Chict%5Capi%5Ccontactmatrixfacet.py">c:\users\tux\documents\hict\hict\hict\api\contactmatrixfacet.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="copy.html">copy</a><br>
</td><td width="25%" valign=top><a href="numpy.html">numpy</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="hict.api.ContactMatrixFacet.html#ContactMatrixFacet">ContactMatrixFacet</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="ContactMatrixFacet">class <strong>ContactMatrixFacet</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>This facet is designed to be the main API <a href="builtins.html#object">object</a> to interact with our files and model without using the model methods directly.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Static methods defined here:<br>
<dl><dt><a name="ContactMatrixFacet-close_file"><strong>close_file</strong></a>(f: hict.core.chunked_file.ChunkedFile, need_save: bool = True) -> None</dt><dd><tt>Close file using descriptor and save pending changes.<br>
<br>
:param f: File descriptor.<br>
:param need_save: Whether to store unsaved changes in file or not.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-get_dense_submatrix"><strong>get_dense_submatrix</strong></a>(f: hict.core.chunked_file.ChunkedFile, resolution: numpy.int64, x0: numpy.int64, y0: numpy.int64, x1: numpy.int64, y1: numpy.int64, units: hict.core.common.QueryLengthUnit = <QueryLengthUnit.PIXELS: 2>, exclude_hidden_contigs: bool = True) -> numpy.ndarray</dt><dd><tt>Fetches requested area from contact matrix in the given resolution.<br>
<br>
:param f: File descriptor.<br>
:param resolution: Experiment resolution.<br>
:param x0: Start column of query expressed in given units (inclusive).<br>
:param y0: Start row of query expressed in given units (inclusive).<br>
:param x1: End column of query expressed in given units (exclusive).<br>
:param y1: End row of query expressed in given units (exclusive).<br>
:param units: Either QueryLengthUnit.PIXELS (0-indexed) or QueryLengthUnit.BASE_PAIRS (1-indexed). In both cases borders are inclusive.<br>
:return: Dense 2D numpy array which contains contact map submatrix for the given region.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-get_file_descriptor"><strong>get_file_descriptor</strong></a>(filepath: str, block_cache_size: int = 64) -> hict.core.chunked_file.ChunkedFile</dt><dd><tt>Create descriptor for working with files in our format.<br>
<br>
:param filepath: Path to the file relative to your working directory.<br>
:param block_cache_size: Size of cache for dense blocks (each at most max_dense_size*max_dense_size*sizeof(dtype) bytes).<br>
:return: File descriptor.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-get_matrix_size_bins"><strong>get_matrix_size_bins</strong></a>(f: hict.core.chunked_file.ChunkedFile, resolution: numpy.int64) -> numpy.int64</dt><dd><tt>Returns contact matrix size at the given resolution in bins. File should be opened.<br>
<br>
:param f: File descriptor.<br>
:param resolution: Resolution at which the contact matrix size is queried.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-get_matrix_size_px"><strong>get_matrix_size_px</strong></a>(f: hict.core.chunked_file.ChunkedFile, resolution: numpy.int64) -> numpy.int64</dt><dd><tt>Returns contact matrix size at the given resolution in pixels. File should be opened.<br>
<br>
:param f: File descriptor.<br>
:param resolution: Resolution at which the contact matrix size is queried.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-get_px_by_bp"><strong>get_px_by_bp</strong></a>(f: hict.core.chunked_file.ChunkedFile, x0_bp: numpy.int64, resolution: numpy.int64 = 0) -> hict.api.ContactMatrixFacet.ContactMatrixFacet.BasePairInPixelPosition</dt><dd><tt>Queries position of a given base pair in resolution.<br>
<br>
:param f: File descriptor.<br>
:param x0_bp: Position expressed in base pairs.<br>
:param resolution: Resolution for which the pixel is queried.<br>
:return: Position of a pixel which corresponds to the given base pair.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-get_resolutions_list"><strong>get_resolutions_list</strong></a>(f: hict.core.chunked_file.ChunkedFile) -> List[numpy.int64]</dt><dd><tt>Gets a list of resolutions that are stored in the given chunked file. File should be opened.<br>
<br>
:param f: File descriptor.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-group_selection_range_into_scaffold"><strong>group_selection_range_into_scaffold</strong></a>(f: hict.core.chunked_file.ChunkedFile, start_contig_id: numpy.int64, end_contig_id: numpy.int64, name: Optional[str] = None, spacer_length: int = 1000) -> None</dt><dd><tt>Groups segment between contigs with given IDs into the new scaffold, both bordering contigs are included in it. All scaffolds that intersect with given segment, would be fully added into the new scaffold (so its borders might actually be different from start_contig_id and end_contig_id).<br>
<br>
:param f: File descriptor.<br>
:param start_contig_id: ID of left bordering contig (inclulsive). If that contig happens to be inside some scaffold, the segment border is automatically extended to the left border of that scaffold.<br>
:param end_contig_id: ID of right bordering contig (inclusive). If that contig happens to be inside some scaffold, the segment border is automatically extended to the right border of that scaffold.<br>
:param name: New scaffold's name. If not provided, would be generaed automatically.<br>
:param spacer_length: How many spacers 'N' to include in the final FASTA assembly on the borders of this scaffold.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-load_assembly_from_agp"><strong>load_assembly_from_agp</strong></a>(f: hict.core.chunked_file.ChunkedFile, agp_filepath: pathlib.Path) -> None</dt><dd><tt>Loads assembly from specified AGP file.<br>
<br>
:param f: HiCT File descriptor.<br>
:param agp_filename: Path to the AGP file.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-move_selection_range"><strong>move_selection_range</strong></a>(f: hict.core.chunked_file.ChunkedFile, start_contig_id: numpy.int64, end_contig_id: numpy.int64, target_start_order: numpy.int64) -> None</dt><dd><tt>Moves contig segment between given start and end contigs (both are included). If any scaffold intersects with selection range, then selection range is extended to include this scaffold.<br>
<br>
:param f: File descriptor.<br>
:param start_contig_id: ID of the left bordering contig.<br>
:param end_contig_id: ID of the right bordering contig.<br>
:param target_start_order: Target index of the leftmost contig of selection range.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-open_file"><strong>open_file</strong></a>(f: hict.core.chunked_file.ChunkedFile) -> None</dt><dd><tt>Open file using file descriptor and build initial state of the model.<br>
<br>
:param f: File descriptor.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-reverse_selection_range"><strong>reverse_selection_range</strong></a>(f: hict.core.chunked_file.ChunkedFile, start_contig_id: numpy.int64, end_contig_id: numpy.int64) -> None</dt><dd><tt>Performs reversal of contig segment between given start and end contigs (both are included). Changes orientation of each contig on that segment and reverses their order. If any scaffold intersects with selection range, then selection range is extended to include this scaffold.<br>
<br>
:param f: File descriptor.<br>
:param start_contig_id: ID of the left bordering contig.<br>
:param end_contig_id: ID of the right bordering contig.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-save_changes"><strong>save_changes</strong></a>(f: hict.core.chunked_file.ChunkedFile) -> None</dt><dd><tt>Save pending changes into the file using its descriptor.<br>
<br>
:param f: File descriptor.</tt></dd></dl>
<dl><dt><a name="ContactMatrixFacet-ungroup_selection_range"><strong>ungroup_selection_range</strong></a>(f: hict.core.chunked_file.ChunkedFile, start_contig_id: numpy.int64, end_contig_id: numpy.int64, name: Optional[str] = None, spacer_length: int = 1000) -> None</dt><dd><tt>Takes selection range between contigs with given IDs and removes scaffolds that intersect with it.<br>
<br>
:param f: File descriptor.<br>
:param start_contig_id: ID of left bordering contig (inclulsive). If that contig happens to be inside some scaffold, the segment border is automatically extended to the left border of that scaffold.<br>
:param end_contig_id: ID of right bordering contig (inclusive). If that contig happens to be inside some scaffold, the segment border is automatically extended to the right border of that scaffold.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>BasePairInPixelPosition</strong> = <class 'hict.api.ContactMatrixFacet.ContactMatrixFacet.BasePairInPixelPosition'><dd><tt>A tuple that describes queried position in both bp and pixels.</tt></dl>
<dl><dt><strong>IncorrectFileStateError</strong> = <class 'hict.api.ContactMatrixFacet.ContactMatrixFacet.IncorrectFileStateError'><dd><tt>General exception that indicates file or model are in the incorrect state and require attention.</tt></dl>
<dl><dt><strong>IncorrectResolution</strong> = <class 'hict.api.ContactMatrixFacet.ContactMatrixFacet.IncorrectResolution'><dd><tt>An exception that indicates wrong resolution was queried (in a sense that it is not stored in file).</tt></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>List</strong> = typing.List<br>
<strong>Optional</strong> = typing.Optional</td></tr></table>
</body></html>