gff3
ensembl.io.genomio.gff3
¶
GFF3 files processing module.
Annotation = Dict[str, Any]
module-attribute
¶
AnnotationError
¶
Bases: Exception
If anything wrong happens when recording annotations.
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
51 52 |
|
ArgumentParser
¶
Bases: ArgumentParser
Extends argparse.ArgumentParser
with additional methods and functionality.
The default behaviour of the help text will be to display the default values on every non-required
argument, i.e. optional arguments with required=False
.
Source code in ensembl/utils/argparse.py
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 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 |
|
formatter_class = argparse.ArgumentDefaultsHelpFormatter
instance-attribute
¶
add_argument(*args, **kwargs)
¶
Extends the parent function by excluding the default value in the help text when not provided.
Only applied to required arguments without a default value, i.e. positional arguments or optional
arguments with required=True
.
Source code in ensembl/utils/argparse.py
132 133 134 135 136 137 138 139 140 141 |
|
add_argument_dst_path(*args, exists_ok=True, **kwargs)
¶
Adds pathlib.Path
argument, checking if it is writable at parsing time.
If "metavar" is not defined it is added with "PATH" as value to improve help text readability.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exists_ok
|
bool
|
Do not raise an error if the destination path already exists. |
True
|
Source code in ensembl/utils/argparse.py
153 154 155 156 157 158 159 160 161 162 163 164 |
|
add_argument_src_path(*args, **kwargs)
¶
Adds pathlib.Path
argument, checking if it exists and it is readable at parsing time.
If "metavar" is not defined, it is added with "PATH" as value to improve help text readability.
Source code in ensembl/utils/argparse.py
143 144 145 146 147 148 149 150 151 |
|
add_argument_url(*args, **kwargs)
¶
Adds sqlalchemy.engine.URL
argument.
If "metavar" is not defined it is added with "URI" as value to improve help text readability.
Source code in ensembl/utils/argparse.py
166 167 168 169 170 171 172 173 174 |
|
add_log_arguments(add_log_file=False)
¶
Adds the usual set of arguments required to set and initialise a logging system.
The current set includes a mutually exclusive group for the default logging level: --verbose
,
--debug
or --log LEVEL
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
add_log_file
|
bool
|
Add arguments to allow storing messages into a file, i.e. |
False
|
Source code in ensembl/utils/argparse.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
|
add_numeric_argument(*args, type=float, min_value=None, max_value=None, **kwargs)
¶
Adds a numeric argument with constrains on its type and its minimum or maximum value.
Note that the default value (if defined) is not checked unless the argument is an optional argument and no value is provided in the command line.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type
|
Callable[[str], int | float]
|
Type to convert the argument value to when parsing. |
float
|
min_value
|
int | float | None
|
Minimum value constrain. If |
None
|
max_value
|
int | float | None
|
Maximum value constrain. If |
None
|
Source code in ensembl/utils/argparse.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
add_server_arguments(prefix='', include_database=False, help=None)
¶
Adds the usual set of arguments needed to connect to a server, i.e. --host
, --port
, --user
and --password
(optional).
Note that the parser will assume this is a MySQL server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix
|
str
|
Prefix to add the each argument, e.g. if prefix is |
''
|
include_database
|
bool
|
Include |
False
|
help
|
str | None
|
Description message to include for this set of arguments. |
None
|
Source code in ensembl/utils/argparse.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
parse_args(*args, **kwargs)
¶
Extends the parent function by adding a new URL argument for every server group added.
The type of this new argument will be sqlalchemy.engine.URL
. It also logs all the parsed
arguments for debugging purposes when logging arguments have been added.
Source code in ensembl/utils/argparse.py
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 |
|
DuplicateIdError
¶
Bases: Exception
Trying to add a feature with an ID already in use.
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
43 44 |
|
FunctionalAnnotations
¶
List of annotations extracted from a GFF3 file.
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 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 |
|
annotations = []
instance-attribute
¶
features = {'gene': {}, 'transcript': {}, 'translation': {}, 'transposable_element': {}}
instance-attribute
¶
ignored_xrefs = {'go', 'interpro', 'uniprot'}
class-attribute
instance-attribute
¶
parents = {'gene': {}, 'transcript': {}}
instance-attribute
¶
provider_name = provider_name
instance-attribute
¶
add_feature(feature, feat_type, parent_id=None, all_parent_ids=None)
¶
Add annotation for a feature of a given type. If a parent_id is provided, record the relationship.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feature
|
GFFSeqFeature
|
The feature to create an annotation. |
required |
feat_type
|
str
|
Type of the feature to annotate. |
required |
parent_id
|
Optional[str]
|
Parent ID of this feature to keep it linked. |
None
|
all_parent_ids
|
Optional[List[str]]
|
All parent IDs to remove from non-informative descriptions. |
None
|
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
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 |
|
add_parent_link(parent_type, parent_id, child_id)
¶
Record a parent-child IDs relationship for a given parent biotype.
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
109 110 111 112 113 114 |
|
get_features(feat_type)
¶
Get all feature annotations for the requested type.
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
102 103 104 105 106 107 |
|
get_parent(parent_type, child_id)
¶
Returns the parent ID of a given child for a given parent biotype.
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
116 117 118 119 120 121 122 123 124 125 126 |
|
get_xrefs(feature)
¶
Get the xrefs from the Dbxref field.
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
product_is_informative(product, feat_ids=None)
staticmethod
¶
Returns True if the product name contains informative words, False otherwise.
It is considered uninformative when the description contains words such as "hypothetical" or or "putative". If feature IDs are provided, consider it uninformative as well (we do not want descriptions to be just the ID).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
product
|
str
|
A product name. |
required |
feat_ids
|
Optional[List[str]]
|
List of feature IDs. |
None
|
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
|
store_gene(gene)
¶
Record the functional_annotations of a gene and its children features.
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
319 320 321 322 323 324 325 326 327 328 329 |
|
to_json(out_path)
¶
Print out the current annotation list in a json file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
out_path
|
PathLike
|
JSON file path where to write the data. |
required |
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
308 309 310 311 312 313 314 315 316 317 |
|
transfer_descriptions()
¶
Transfers the feature descriptions in 2 steps: - from translations to transcripts (if the transcript description is empty) - from transcripts to genes (same case)
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
208 209 210 211 212 213 214 215 |
|
GFFGeneMerger
¶
Specialized class to merge split genes in a GFF3 file, prior to further parsing.
Source code in src/python/ensembl/io/genomio/gff3/gene_merger.py
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 |
|
merge(in_gff_path, out_gff_path)
¶
Merge genes in a gff that are split in multiple lines.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
in_gff_path
|
PathLike
|
Input GFF3 that may have split merge. |
required |
out_gff_path
|
PathLike
|
Output GFF3 with those genes merged. |
required |
Returns:
Type | Description |
---|---|
List[str]
|
List of all merged genes, each represented as a string of the GFF3 lines of all their parts. |
Source code in src/python/ensembl/io/genomio/gff3/gene_merger.py
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 |
|
GFFSimplifier
¶
Parse a GGF3 file and output a cleaned up GFF3 + annotation json file.
Raises:
Type | Description |
---|---|
GFFParserError
|
If an error cannot be automatically fixed. |
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 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 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
|
allow_pseudogene_with_cds = allow_pseudogene_with_cds
instance-attribute
¶
annotations = FunctionalAnnotations(self.get_provider_name())
instance-attribute
¶
exclude_seq_regions = []
instance-attribute
¶
fail_types = set()
instance-attribute
¶
genome = json.load(genome_fh)
instance-attribute
¶
records = Records()
instance-attribute
¶
refseq = False
instance-attribute
¶
skip_unrecognized = skip_unrecognized
instance-attribute
¶
stable_ids = StableIDAllocator()
instance-attribute
¶
clean_gene(gene)
¶
Return the same gene without qualifiers unrelated to the gene structure.
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
create_gene_for_lone_cds(feat)
¶
Returns a gene created for a lone CDS.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feat
|
GFFSeqFeature
|
The CDS for which we want to create a gene. |
required |
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
|
create_gene_for_lone_transcript(feat)
¶
Returns a gene for lone transcripts: 'gene' for tRNA/rRNA/mRNA, and 'ncRNA_gene' for all others.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feat
|
GFFSeqFeature
|
The transcript for which we want to create a gene. |
required |
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
format_gene_segments(transcript)
¶
Returns the equivalent Ensembl biotype feature for gene segment transcript features.
Supported features: "C_gene_segment" and "V_gene_segment".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transcript
|
GFFSeqFeature
|
Gene segment transcript feature. |
required |
Raises:
Type | Description |
---|---|
GeneSegmentError
|
Unable to get the segment type information from the feature. |
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
|
get_provider_name()
¶
Returns the provider name for this genome.
If this information is not available, will try to infer it from the assembly accession. Will return "GenBank" otherwise.
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
normalize_gene(gene)
¶
Returns a normalized gene structure, separate from the functional elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gene
|
GFFSeqFeature
|
Gene object to normalize. |
required |
functional_annotation
|
List of feature annotations (appended by this method). |
required |
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
|
normalize_mirna(gene)
¶
Returns gene representations from a miRNA gene that can be loaded in an Ensembl database.
Change the representation from the form gene[ primary_transcript[ exon, miRNA[ exon ] ] ]
to ncRNA_gene[ miRNA_primary_transcript[ exon ] ]
and gene[ miRNA[ exon ] ]
Raises:
Type | Description |
---|---|
GFFParserError
|
If gene has more than 1 transcript, the transcript was not formatted correctly or there are unknown sub-features. |
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
|
normalize_non_gene(feat)
¶
Returns a normalised "non-gene" or None
if not applicable.
Only transposable elements supported at the moment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feat
|
GFFSeqFeature
|
Feature to normalise. |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
If the feature is a not supported non-gene. |
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
normalize_pseudogene(gene)
¶
Normalize CDSs if allowed, otherwise remove them.
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
367 368 369 370 371 372 373 374 375 |
|
normalize_transcripts(gene)
¶
Normalizes a transcript.
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
|
simpler_gff3(in_gff_path)
¶
Loads a GFF3 from INSDC and rewrites it in a simpler version, whilst also writing a functional annotation file.
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
simpler_gff3_feature(gene)
¶
Creates a simpler version of a GFF3 feature.
Raises:
Type | Description |
---|---|
IgnoredFeatureError
|
If the feature type is ignored. |
UnsupportedFeatureError
|
If the feature type is not supported. |
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
InvalidStableID
¶
Bases: ValueError
Raised when there is a problem with an stable ID.
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
27 28 |
|
MissingParentError
¶
Bases: Exception
Trying to add a feature without an expected parent.
Source code in src/python/ensembl/io/genomio/gff3/extract_annotation.py
47 48 |
|
Records
¶
Bases: list
List of GFF3 SeqRecords.
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
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 |
|
from_gff(in_gff_path, excluded=None)
¶
Loads records from a GFF3 file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
in_gff_path
|
PathLike
|
Input GFF3 file path. |
required |
excluded
|
Optional[List[str]]
|
Record IDs to not load from the GFF3 file. |
None
|
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
to_gff(out_gff_path)
¶
Writes the current list of records in a GFF3 file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
out_gff_path
|
PathLike
|
Path to GFF3 file where to write the records. |
required |
Source code in src/python/ensembl/io/genomio/gff3/simplifier.py
65 66 67 68 69 70 71 72 |
|
StableIDAllocator
dataclass
¶
Set of tools to check and allocate stable IDs.
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
current_id_number = 0
class-attribute
instance-attribute
¶
make_missing_stable_ids = True
class-attribute
instance-attribute
¶
min_id_length = 7
class-attribute
instance-attribute
¶
prefix = 'TMP_'
class-attribute
instance-attribute
¶
skip_gene_id_validation = False
class-attribute
instance-attribute
¶
generate_gene_id()
¶
Returns a new unique gene stable_id with a prefix.
The ID is made up of a prefix and a number, which is auto incremented.
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
53 54 55 56 57 58 59 60 61 |
|
generate_transcript_id(gene_id, number)
staticmethod
¶
Returns a formatted transcript ID generated from a gene ID and number. Args: gene_id: Gene stable ID. number: Positive number. Raises: ValueError: If the number provided is not greater than zero.
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
is_valid(stable_id)
¶
Checks that the format of a stable ID is valid. Args: stable_id: Stable ID to validate.
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
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 |
|
normalize_cds_id(cds_id)
¶
Returns a normalized version of the provided CDS ID.
The normalisation implies to remove any unnecessary prefixes around the CDS ID. However, if the CDS ID is still not proper, an empty string will be returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cds_id
|
str
|
CDS ID to normalize. |
required |
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
normalize_gene_id(gene, refseq=False)
¶
Returns a normalized gene stable ID.
Removes any unnecessary prefixes, but will generate a new stable ID if the normalized one is not recognized as valid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gene
|
GFFSeqFeature
|
Gene feature to normalize. |
required |
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
normalize_pseudogene_cds_id(pseudogene)
¶
Normalizes every CDS ID of the provided pseudogene.
Ensure each CDS from a pseudogene has a proper ID: - Different from the gene - Derived from the gene if it is not proper
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pseudogene
|
GFFSeqFeature
|
Pseudogene feature. |
required |
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
remove_prefix(stable_id, prefixes)
staticmethod
¶
Returns the stable ID after removing its prefix (if any).
If more than one prefix may be found, only the first one is removed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stable_id
|
str
|
Stable ID to process. |
required |
prefixes
|
List[str]
|
List of prefixes to search for. |
required |
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
set_prefix(genome)
¶
Sets the ID prefix using the organism abbrev if it exists in the genome metadata.
Source code in src/python/ensembl/io/genomio/gff3/id_allocator.py
43 44 45 46 47 48 49 50 51 |
|
get_intervals(record, genes_dict, seq_dict, seq_name)
¶
Extract start/stop feature coordinates for use in creating intervaltree object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
record
|
SeqRecord
|
Individual sequence record. |
required |
genes_dict
|
dict
|
Genes. |
required |
seq_dict
|
dict
|
Sequences. |
required |
seq_name
|
str
|
Feature sequence name. |
required |
Source code in src/python/ensembl/io/genomio/gff3/overlaps.py
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 |
|
identify_feature_overlaps(gff_in, output_file, isolate_feature)
¶
Detect overlapping GFF3 SeqFeature objects and dump to a report.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gff_in
|
Path
|
User supplied GFF3 input file. |
required |
output_file
|
Path
|
Output file to write feature overlaps. |
required |
isolate_feature
|
str
|
Sequence feature type to filter by. |
required |
Source code in src/python/ensembl/io/genomio/gff3/overlaps.py
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 |
|
init_logging_with_args(args)
¶
Processes the Namespace object provided to call init_logging()
with the correct arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args
|
Namespace
|
Namespace populated by an argument parser. |
required |
Source code in ensembl/utils/logging.py
98 99 100 101 102 103 104 105 106 107 |
|
main()
¶
Main script entry-point.
Source code in src/python/ensembl/io/genomio/gff3/process.py
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 |
|
scan_tree(feature_intervals)
¶
Construct an interval tree using supplied genomic intervals, check all elements on the tree against itself and return any that hit 2 or more intervals (i.e. itself + 1 other)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feature_intervals
|
list
|
Genome features to examine for coordinate (start/end) overlaps. |
required |
Return
Set of intervals identified in the input GFF3 file that overlap with 2 or more intervals.
Source code in src/python/ensembl/io/genomio/gff3/overlaps.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
summarize_feature_stats(gff_in)
¶
Analyse a GFF3 file and produce a summary of its feature types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gff_in
|
Path
|
User supplied GFF3 input file. |
required |
Source code in src/python/ensembl/io/genomio/gff3/overlaps.py
41 42 43 44 45 46 47 48 49 50 51 52 53 |
|