Style classes for VARNA operations
Two helper class groups can be imported from python varnaapi.param
for two VARNA operations, add_annotation and add_bases_style.
Annotation
An Annotation
object represents a textual annotation added to a VARNA drawing.
The object stores the text and other informtation needed.
One can add Annotation
to drawing using BasicDraw.add_annotation.
Four annotation types allowed in VARNA are represented by four objects below.
BaseAnnotation
Bases: _Annotation
Annoation on a base.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
Annotation caption |
required |
anchor |
int
|
Index of base to annotate |
required |
color |
color
|
Annotation color |
'#000000'
|
size |
int
|
Font size |
12
|
Source code in src/varnaapi/param.py
405 406 407 408 409 410 411 412 413 414 415 |
|
HelixAnnotation
Bases: _Annotation
Same as BaseAnnotation but on an helix.
Argument anchor
can be index of any base in the helix of interest.
Source code in src/varnaapi/param.py
424 425 426 427 428 429 |
|
LoopAnnotation
Bases: _Annotation
Same as BaseAnnotation but on a loop.
Argument anchor
can be index of any base in the loop of interest.
Source code in src/varnaapi/param.py
417 418 419 420 421 422 |
|
StaticAnnotation
Bases: _Annotation
Annotation on a specified position in VARNA drawing.
Unlike BaseAnnotation, argument anchor
is omitted.
However, arguments x
and y
are needed to specify annotation position.
Danger
It is unrecommended to use static annotation unless you know what you're doing
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
int
|
x-coordinate of position |
required |
y |
int
|
y-ccordinate of position |
required |
Examples:
>>> sa = StaticAnnotation("Hello World", 100, 150, color="#FF0000")
Source code in src/varnaapi/param.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
|
BasesStyle
Bases: _DefaultObj
Defines a custom base-style, to be applied later to a set of bases. A BasesStyle style contains colors used for different components of a base. BasesStyle is constructed from given colors for different components.
Error
At least one argument should be given.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fill |
color
|
color of inner part of base |
None
|
outline |
color
|
color of outline of base |
None
|
label |
color
|
base text (name) color |
None
|
number |
color
|
base number color |
None
|
Examples:
>>> style = BasesStyle(fill='#FF0000', outline='#00FF00')
See Also: BasicDraw.add_bases_style
Source code in src/varnaapi/param.py
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 |
|