Bio::T...attern(3pm)
π Bio::Tools::SeqPattern π
okay bestie, welcome to the manual page for Bio::Tools::SeqPattern β straight out of the User Contributed Perl Documentation section, page 3pm. this is part 1 and she's LONG, so hydrate and stay with me π«Ά
β¨ NAME β¨
Bio::Tools::SeqPattern β represent a sequence pattern or motif π
πΈ SYNOPSIS πΈ
look at her go, bestie:
use Bio::Tools::SeqPattern;
my $pat1 = 'T[GA]AA...TAAT';
my $pattern1 = Bio::Tools::SeqPattern->new(-SEQ =>$pat1, -TYPE =>'Dna');
my $pat2 = '[VILM]R(GXX){3,2}...[^PG]';
my $pattern2 = Bio::Tools::SeqPattern->new(-SEQ =>$pat2, -TYPE =>'Amino');
literally that's it, that's the whole vibe. two patterns, two objects, no drama β¨
π¦ DESCRIPTION π¦
so the Bio::Tools::SeqPattern module encapsulates generic data and methods for manipulating regular expressions that describe nucleic or amino acid sequence patterns (a.k.a. "motifs") β like the ones Bio::Tools::IUPAC produces.
Bio::Tools::SeqPattern is a concrete class that inherits from Bio::Seq. periodt.
this class grew out of a need to have a standard module for doing routine tasks with sequence patterns, such as:
-- Forming a reverse-complement version of a nucleotide sequence pattern
-- Expanding patterns containing ambiguity codes
-- Checking for invalid regexp characters
-- Untainting yet preserving special characters in the pattern
other features to look for in the future (aka the vision board π):
-- Full pattern syntax checking
-- Conversion between expanded and condensed forms of the pattern
π₯ MOTIVATIONS π₯
a key motivation for Bio::Tools::SeqPattern is to have a way to generate a reverse complement of a nucleotide sequence pattern. this makes possible simultaneous pattern matching on both sense and anti-sense strands of a query sequence. main character energy tbh π
in principle, one could do such a search more inefficiently by testing against both sense and anti-sense versions of a sequence. it is entirely equivalent to test a regexp containing both sense and anti-sense versions of the pattern against one copy of the sequence. the latter approach is much more efficient since:
- You need only one copy of the sequence.
- Only one regexp is executed.
- Regexp patterns are typically much smaller than sequences.
patterns can be quite complex and it is often difficult to generate the reverse complement pattern. the Bioperl SeqPattern.pm addresses this problem, providing a convenient set of tools for working with biological sequence regular expressions.
not all patterns have been tested. if you discover a pattern that is not handled properly by Bio::Tools::SeqPattern.pm, please send me some email (sac@bioperl.org). thanks π
π OTHER FEATURES π
𧬠Extended Alphabet Support π§¬
this module supports the same set of ambiguity codes for nucleotide sequences as supported by Bio::Seq. these ambiguity codes define the behavior of the expand method.
nucleic acid codes, gorgeous and complete:
------------------------------------------
Symbol Meaning Nucleic Acid
------------------------------------------
A A (A)denine
C C (C)ytosine
G G (G)uanine
T T (T)hymine
U U (U)racil
M A or C a(M)ino group
R A or G pu(R)ine
W A or T (W)eak bond
S C or G (S)trong bond
Y C or T p(Y)rimidine
K G or T (K)eto group
V A or C or G
H A or C or T
D A or G or T
B C or G or T
X G or A or T or C
N G or A or T or C
. G or A or T or C
and now the amino acid alphabet, no cap:
------------------------------------------
Symbol Meaning
------------------------------------------
A Alanine
C Cysteine
D Aspartic Acid
E Glutamic Acid
F Phenylalanine
G Glycine
H Histidine
I Isoleucine
K Lysine
L Leucine
M Methionine
N Asparagine
P Proline
Q Glutamine
R Arginine
S Serine
T Threonine
V Valine
W Tryptophan
Y Tyrosine
B Aspartic Acid, Asparagine
Z Glutamic Acid, Glutamine
X Any amino acid
. Any amino acid
π Multiple Format Support π
ultimately, this module should be able to build SeqPattern.pm objects using a variety of pattern formats such as ProSite, Blocks, Prints, GCG, etc. currently, this module only supports patterns using a grep-like syntax. it's giving "coming soon" energy π
πΈ USAGE πΈ
a simple demo script called seq_pattern.pl is included in the examples/ directory of the central Bioperl distribution. go run her πββοΈ
π«Ά SEE ALSO π«Ά
Bio::Seqβ Lightweight sequence object.Bio::Tools::IUPACβ The IUPAC code for degenerate residues and their conversion to a regular expression.
π FEEDBACK π
π¬ Mailing Lists π¬
user feedback is an integral part of the evolution of this and other Bioperl modules. send your comments and suggestions preferably to one of the Bioperl mailing lists. your participation is much appreciated, bestie π₯Ή
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
π Support π
please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. many experienced and reponsive experts will be able look at the problem and quickly address it. please include a thorough description of the problem with code and data examples if at all possible. (and yes, "reponsive" is spelled exactly like that in the original, I don't make the rules π)
π Reporting Bugs π
report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
π AUTHOR π
Steve Chervitz, sac-at-bioperl.org
β COPYRIGHT β
Copyright (c) 1997-8 Steve Chervitz. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π METHODS (okay this is where it gets juicy) π
new
- Title :
new - Usage :
my $seqpat = Bio::Tools::SeqPattern->new(); - Purpose : Verifies that the type is correct for superclass (
Bio::Seq.pm) and calls superclass constructor last. - Returns :
n/a - Argument : Parameters passed to
new() - Throws : Exception if the pattern string (seq) is empty.
- Comments : The process of creating a new
SeqPattern.pmobject ensures that the pattern string is untained. - See Also :
Bio::Root::Root::new,Bio::Seq::_initialize
alphabet_ok
- Title :
alphabet_ok - Usage :
$mypat->alphabet_ok; - Purpose : Checks for invalid regexp characters. Overrides
Bio::Seq::alphabet_ok()to allow additional regexp characters,.*()[]<>{}^$in addition to the standard genetic alphabet. Also untaints the pattern and sets the sequence object's sequence to the untained string. - Returns : Boolean (1 | 0)
- Argument :
n/a - Throws : Exception if the pattern contains invalid characters.
- Comments : Does not call the superclass method. Actually permits any alphanumeric, not just the standard genetic alphabet.
expand
- Title :
expand - Usage :
$seqpat_object->expand(); - Purpose : Expands the sequence pattern using special ambiguity codes.
- Example :
$pat = $seq_pat->expand(); - Returns : String containing fully expanded sequence pattern
- Argument :
n/a - Throws : Exception if sequence type is not recognized (i.e., is not one of [DR]NA, Amino)
- See Also : "Extended Alphabet Support",
_expand_pep(),_expand_nuc()
_expand_pep
- Title :
_expand_pep - Usage :
n/a; automatically called by expand() - Purpose : Expands peptide patterns
- Returns : String (the expanded pattern)
- Argument : String (the unexpanded pattern)
- Throws :
n/a - See Also :
expand(),_expand_nuc()
_expand_nuc
- Title :
_expand_nuc - Purpose : Expands nucleotide patterns
- Returns : String (the expanded pattern)
- Argument : String (the unexpanded pattern)
- Throws :
n/a - See Also :
expand(),_expand_pep()
revcom
- Title :
revcom - Usage :
revcom([1]); - Purpose : Forms a pattern capable of recognizing the reverse complement version of a nucleotide sequence pattern.
- Example :
$pattern_object->revcom();and$pattern_object->revcom(1); ## returns expanded rev complement pattern. - Returns : Object reference for a new
Bio::Tools::SeqPatterncontaining the revcom of the current pattern as its sequence. - Argument : (1) boolean (optional) (default= false)
- true : expand the pattern before rev-complementing.
- false: don't expand pattern before or after rev-complementing.
- Throws : Exception if called for amino acid sequence pattern.
- Comments : This method permits the simultaneous searching of both sense and anti-sense versions of a nucleotide pattern by means of a grep-type of functionality in which any number of patterns may be or-ed into the recognition pattern. Overrides
Bio::Seq::revcom()and calls it first thing. The order of_fixpat()calls is critical. - See Also :
Bio::Seq::revcom, "_fixpat_1", "_fixpat_2", "_fixpat_3", "_fixpat_4", "_fixpat_5"
backtranslate
- Title :
backtranslate - Usage :
backtranslate(); - Purpose : Produce a degenerate oligonucleotide whose translation would produce the original protein motif.
- Example :
$pattern_object->backtranslate(); - Returns : Object reference for a new
Bio::Tools::SeqPatterncontaining the reverse translation of the current pattern as its sequence. - Throws : Exception if called for nucleotide sequence pattern.
_fixpat_1
- Title :
_fixpat_1 - Usage :
n/a; called automatically by revcom() - Purpose : Utility method for
revcom()β Converts all{7,5} --> {5,7}(Part I) and[T^] --> [^T](Part II) and*N --> N*(Part III) - Returns : String (the new, partially reversed pattern)
- Argument : String (the expanded pattern)
- Throws :
n/a - See Also :
revcom()
_fixpat_2
- Title :
_fixpat_2 - Usage :
n/a; called automatically by revcom() - Purpose : Utility method for
revcom()β Converts all{5,7}Y ---> Y{5,7}and{10,}. ---> .{10,} - Returns : String (the new, partially reversed pattern)
- Argument : String (the expanded, partially reversed pattern)
- Throws :
n/a - See Also :
revcom()
okay bestie that's part 1, more is coming, don't go anywhere π¦
_fixpat_3 π
okay so this one is a utility method for revcom() and it gets called automatically, so you donβt gotta call it yourself. It flips the order of {5,7}(XXX) into (XXX){5,7}. iconic little rearrange, no cap.
- Title:
_fixpat_3 - Usage:
n/a; called automatically byrevcom() - Purpose: Utility method for
revcom()- Converts all
{5,7}(XXX)--->(XXX){5,7}
- Converts all
- Returns: String (the new, partially reversed pattern)
- Argument: String (the expanded, partially reversed pattern)
- Throws:
n/a - See Also:
revcom()
_fixpat_4 π
same energy, different bracket situation. this one is also a utility method for revcom() and also automatic. it takes {5,7}[XXX] and turns it into [XXX]{5,7}.
- Title:
_fixpat_4 - Usage:
n/a; called automatically byrevcom() - Purpose: Utility method for
revcom()- Converts all
{5,7}[XXX]--->[XXX]{5,7}
- Converts all
- Returns: String (the new, partially reversed pattern)
- Argument: String (the expanded, partially reversed pattern)
- Throws:
n/a - See Also:
revcom()
_fixpat_5 π
another revcom() helper, another automatic call. this one moves the star from the front to the back, like itβs walking the runway. converts *[XXX] into [XXX]*, and *(XXX) into (XXX)*.
- Title:
_fixpat_5 - Usage:
n/a; called automatically byrevcom() - Purpose: Utility method for
revcom()- Converts all
*[XXX]--->[XXX]* - and
*(XXX)--->(XXX)*
- Converts all
- Returns: String (the new, partially reversed pattern)
- Argument: String (the expanded, partially reversed pattern)
- Throws:
n/a - See Also:
revcom()
_fixpat_6 π
last of the _fixpat_ girlies for now. still a utility method for revcom(), still automatic. it takes the ? from the front and sends it to the back. three little glow-ups in one:
- Title:
_fixpat_6 - Usage:
n/a; called automatically byrevcom() - Purpose: Utility method for
revcom()- Converts all
?Y{5,7}--->Y{5,7}? - and
?(XXX){5,7}--->(XXX){5,7}? - and
?[XYZ]{5,7}--->[XYZ]{5,7}?
- Converts all
- Returns: String (the new, partially reversed pattern)
- Argument: String (the expanded, partially reversed pattern)
- Throws:
n/a - See Also:
revcom()
str π
bestie, this is just an accessor. it gets or sets the str value. thatβs the whole vibe.
- Title:
str - Usage:
$obj->str($newval) - Function: β (the original leaves this blank, so no invented lore, fr fr)
- Returns: value of
str - Args: newvalue (optional)
type π
same deal, different field. accessor for type. get it, set it, live your life.
- Title:
type - Usage:
$obj->type($newval) - Function: β (also blank in the source, periodt)
- Returns: value of
type - Args: newvalue (optional)
FOR DEVELOPERS ONLY π οΈ
Data Members π
Information about the various data members of this module is provided for those wishing to modify or understand the code. Two things to bear in mind:
- Do NOT rely on these in any code outside of this module. All data members are prefixed with an underscore to signify that they are private. Always use accessor methods. If the accessor doesnβt exist or is inadequate, create or modify an accessor (and let me know, too!).
- This documentation may be incomplete and out of date. It is easy for this documentation to become obsolete as this module is still evolving. Always double check this info and search for members not described here.
An instance of Bio::Tools::RestrictionEnzyme.pm is a blessed reference to a hash containing all or some of the following fields:
FIELD VALUE
------------------------------------------------------------------------
_rev : The corrected reverse complement of the fully expanded pattern.
INHERITED DATA MEMBERS:
_seq : (From Bio::Seq.pm) The original, unexpanded input sequence after untainting.
_type : (From Bio::Seq.pm) 'Dna' or 'Amino'
k love you bye π this tea was brewed by perl v5.32.1 on 2021-08-15, and the page itself is Bio::T...attern(3pm) β slay, no cap. π«Άβ¨
π¦ where this page comes from
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms