| 1 | package Bio::MUST::Core::Constants; | ||
| 2 | # ABSTRACT: Distribution-wide constants for Bio::MUST::Core | ||
| 3 | 18 | $Bio::MUST::Core::Constants::VERSION = '0.252040'; | |
| 4 | 18 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 18 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 18 | ▶ | use Const::Fast; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 18 | ▶ | use Exporter::Easy ( |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 18 | OK => [ qw(:seqtypes :gaps :ncbi :seqids :files) ], | |
| 11 | TAGS => [ | ||
| 12 | seqtypes => [ qw($PROTLIKE $RNALIKE $NONPUREDNA) ], | ||
| 13 | gaps => [ qw($GAP $PROTMISS $DNAMISS | ||
| 14 | $GAPPROTMISS $GAPDNAMISS $FRAMESHIFT) ], | ||
| 15 | ncbi => [ qw($NCBIPART $NCBIACC $NCBIDBABBR | ||
| 16 | $NCBIPKEY $PKEYONLY $NCBIGCA $GCAONLY) ], | ||
| 17 | seqids => [ qw($NOID_CHARS $NEW_TAG $TAIL_42 | ||
| 18 | $DEF_ID $GI_ID $LCL_ID $GNL_ID $JGI_ID $PAC_ID) ], | ||
| 19 | files => [ qw($EMPTY_LINE $COMMENT_LINE $DEF_LINE | ||
| 20 | $DIM_LINE $PHY_LINE | ||
| 21 | $STK_COMMENT $STK_SEQ $END_LINE | ||
| 22 | $COUNT_LINE $ALI_SUFFIX) ], | ||
| 23 | dirs => [ qw(%SUFFICES_FOR) ], | ||
| 24 | ], | ||
| 25 | 18 | ); | |
| 26 | |||
| 27 | |||
| 28 | # regexes for determining sequence type | ||
| 29 | 18 | const our $PROTLIKE => qr{[EFILPQefilpq]}xms; | |
| 30 | 18 | const our $RNALIKE => qr{[Uu]}xms; | |
| 31 | 18 | const our $NONPUREDNA => qr{[^ACGTacgt]}xms; | |
| 32 | |||
| 33 | # regexes for gap and missing symbols | ||
| 34 | # see also Bio::MUST::Core::Types for "more" gaps | ||
| 35 | # Note the 2-step definition of char classes for maximal regex speed | ||
| 36 | 18 | const my $GAPCHCL => q{\*\-\ }; | |
| 37 | 18 | const my $PROTMISSCHCL => q{\?Xx}; | |
| 38 | 18 | const my $DNAMISSCHCL => q{\?XxNn}; | |
| 39 | 18 | const my $PROTAMBIGCHCL => q{BJOUZbjouz}; # O/U actually are not ambiguous... | |
| 40 | 18 | const my $DNAAMBIGCHCL => q{BDHKMRSVWYbdhkmrsvwy}; | |
| 41 | |||
| 42 | 18 | const our $GAP => qr{[$GAPCHCL]}xms; | |
| 43 | 18 | const our $PROTMISS => qr{[$PROTMISSCHCL$PROTAMBIGCHCL]}xms; | |
| 44 | 18 | const our $DNAMISS => qr{[$DNAMISSCHCL$DNAAMBIGCHCL]}xms; | |
| 45 | |||
| 46 | 18 | const our $GAPPROTMISS => qr{[$GAPCHCL$PROTMISSCHCL$PROTAMBIGCHCL]}xms; | |
| 47 | 18 | const our $GAPDNAMISS => qr{[$GAPCHCL$DNAMISSCHCL$DNAAMBIGCHCL]}xms; | |
| 48 | |||
| 49 | 18 | const our $FRAMESHIFT => 'x'; | |
| 50 | |||
| 51 | # regexes for NCBI id components | ||
| 52 | 18 | const our $NCBIPART => qr{[^\|\s]+}xms; | |
| 53 | 18 | const our $NCBIACC => qr{[A-Z0-9\.\_]+}xms; | |
| 54 | 18 | const our $NCBIDBABBR => qr{[a-z]{2,}}xms; | |
| 55 | 18 | const our $NCBIPKEY => qr{[1-9]\d*}xms; | |
| 56 | |||
| 57 | 18 | const our $PKEYONLY => qr{\A $NCBIPKEY \z}xms; | |
| 58 | |||
| 59 | # http://www.ncbi.nlm.nih.gov/assembly/model/ | ||
| 60 | # The assembly accession starts with a three letter prefix, GCA for GenBank | ||
| 61 | # assemblies and GCF for RefSeq assemblies. This is followed by an underscore | ||
| 62 | # and 9 digits. A version is then added to the accession. For example, the | ||
| 63 | # assembly accession for the GenBank version of the current public human | ||
| 64 | # reference assembly ( GRCh37.p2 ) is GCA_000001405.3. | ||
| 65 | |||
| 66 | 18 | const our $NCBIGCA => qr{GC[AF]_\d{9} \. \d+}xms; | |
| 67 | 18 | const our $GCAONLY => qr{\A $NCBIGCA \z}xms; | |
| 68 | |||
| 69 | # regexes for parsing seq_ids | ||
| 70 | 18 | const our $NOID_CHARS => qr{[,;:]}xms; | |
| 71 | 18 | const our $NEW_TAG => qr{\#NEW\#}xms; | |
| 72 | 18 | const our $TAIL_42 => qr{(?: \.H\d+\.\d+ | \.E\.bf | \.E\.lc) $NEW_TAG? \z}xms; | |
| 73 | 18 | const our $DEF_ID => qr{\A (\S+) }xms; | |
| 74 | 18 | const our $GI_ID => qr{\A gi \| ($NCBIPKEY) }xms; | |
| 75 | 18 | const our $LCL_ID => qr{\A lcl \| (\S+) }xms; | |
| 76 | 18 | const our $GNL_ID => qr{\A gnl \| $NCBIPART \| ($NCBIPART) }xms; | |
| 77 | 18 | const our $JGI_ID => qr{\A jgi \| $NCBIPART \| (\d+) }xms; | |
| 78 | 18 | const our $PAC_ID => qr{\| PACid: (\d+) }xms; | |
| 79 | |||
| 80 | # regexes for parsing files | ||
| 81 | |||
| 82 | # common | ||
| 83 | 18 | const our $EMPTY_LINE => qr{\A \s* \z}xms; | |
| 84 | 18 | const our $COMMENT_LINE => qr{\A (\#)\s*(.*)}xms; | |
| 85 | |||
| 86 | # FASTA-like | ||
| 87 | 18 | const our $DEF_LINE => qr{\A >(.*)}xms; | |
| 88 | |||
| 89 | # PHYLIP-related | ||
| 90 | 18 | const our $DIM_LINE => qr{\A \s*(\d+)\s+(\d+)\s* \z}xms; | |
| 91 | 18 | const our $PHY_LINE => qr{\A (?:(\S+)\s)? \s* (.*) }xms; | |
| 92 | |||
| 93 | # STOCKHOLM-related | ||
| 94 | 18 | const our $STK_COMMENT => qr{\A (\#=GF)\s*(.*)}xms; | |
| 95 | 18 | const our $STK_SEQ => qr{\A (\S+)\s+(.*)}xms; | |
| 96 | 18 | const our $END_LINE => qr{\A //}xms; | |
| 97 | |||
| 98 | # MUST-related | ||
| 99 | 18 | const our $COUNT_LINE => qr{\A (\d+) \z}xms; | |
| 100 | 18 | const our $ALI_SUFFIX => qr{\.ali \z}xmsi; | |
| 101 | |||
| 102 | # regexes for traversing directories | ||
| 103 | # Note: hash values correspond to -name arg in File::Find::Rule constructor | ||
| 104 | |||
| 105 | 18 | const our %SUFFICES_FOR => ( | |
| 106 | Ali => qr{\. (?: ali|fasta|fas|fa|faa|fna ) \z}xmsi, | ||
| 107 | Tree => qr{\. (?: arb|nexus|nex|treefile|tree|tre ) \z}xmsi, | ||
| 108 | ); | ||
| 109 | |||
| 110 | 18 | 1; | |
| 111 | |||
| 112 | __END__ | ||