Filters
The filter module defines a class named SNPFilter.
An app creates an instance of this class to act as an interface to the full set of SNPs.
The general workflow is:
- call the method that loads SNP data from a CSV file
- assign values for filtering criteria (block size, etc)
- call the
applymethod to apply the filters
SNPFilter(args)
A SNPFilter applies filtering criteria to SNPs in blocks identified by the
peak finder. Pass the constructor a dictionary that has settings filtering
critera. Call a method named apply to filter a data set.
| Attributes: |
|
|---|
Source code in src/xo/filters.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
chromosome
property
writable
Filtered SNPs must have names that match this pattern.
size_range
property
writable
Minimum and maximum block size (number of SNPs)
length_range
property
writable
Minimum and maximum block length (bp)
matched
property
writable
If True SNPs must have matching HMM state
coverage
property
writable
Minimum number of reads for a SNP
result
property
Filtered data
summary
property
Summary of filtered data
apply(df)
Apply the filtering criteria to a set of SNPs. The first step is to make a
subset of SNPs that pass the chromosome name, coverage, and match filters.
The resulting frame is then grouped by block.
The second step makes a separate summary frame based on size and location of each block. This frame is then filtered using the block size and block length filters.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/xo/filters.py
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 180 | |
NCOFilter(args)
An NCOFilter applies additional filtering criteria to blocks of SNPs.
Pass the constructor a dictionary that has settings filtering critera.
Call a method named apply to filter a data set.
| Attributes: |
|
|---|
Source code in src/xo/filters.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
min_z
property
writable
Minimum homozygosity for Type A blocks
delta_z
property
writable
Homozygosity range for Type B blocks
min_cover
property
writable
Minimum number of SNPs of each type
size
property
writable
Minimum block size
result
property
Filtered data
apply(df)
Apply the NCO filtering criteria to a set of SNPs in filtered blocks SNPs.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/xo/filters.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
_scan(block)
Scan a block for runs that have satisfy homozygosity requirements and have a minimum number of SNPs. Add a column to a block to show which SNPs might be part of an NCO.
Source code in src/xo/filters.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |