.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.08) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "SWISS::TextFunc 3pm" .TH SWISS::TextFunc 3pm "2006-08-31" "perl v5.10.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SWISS::TextFunc .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is designed to be a repository of functions that are repeatedly used during parsing and formatting of \s-1SWISS\-PROT/TREMBL\s0 lines. If more than two line types need to do aproximately the same thing then it is probably in here. .PP All functions expect to be called as package\->function(param list) .IP "listFromText" 4 .IX Item "listFromText" Takes a piece of text, a seperator regex and a seperator that may appear at the end. Returns an array of items that were seperated in the text by that seperator. Takes care of null items (looses them for you). .IP "textFromList" 4 .IX Item "textFromList" Takes an array of items, a separator, a terminating string, and a line width. Returns an array of strings, each ending with the separator or the terminator with a width less than or equal to the width specified. .Sp Seems to do the wrong thing for references \- not sure why. Don't use it for that. .IP "wrapText" 4 .IX Item "wrapText" Takes a string and a length. Returns an array of strings which are shorter or equal in length to length, spliting the string on white space. .ie n .IP "wrapOn ($firstLinePrefix, $linePrefix, $colums, $text[, @separators])" 4 .el .IP "wrapOn ($firstLinePrefix, \f(CW$linePrefix\fR, \f(CW$colums\fR, \f(CW$text\fR[, \f(CW@separators\fR])" 4 .IX Item "wrapOn ($firstLinePrefix, $linePrefix, $colums, $text[, @separators])" Wraps \f(CW$text\fR into lines with at most \f(CW$colums\fR colums. Prepends the prefixes to the lines. \f(CW@separators\fR is a list of expressions on which to wrap. The expression itself is part of the upper line. .Sp If no \f(CW@separators\fR are provided, the \f(CW$text\fR is wrapped at whitespace except in \s-1EC/TC\s0 numbers or at dashes that separate words. .Sp First tries to wrap on the first item of \f(CW@separators\fR, then the next etc. If no wrap on any element of \f(CW@separators\fR or whitespaces is possible, wraps into lines of exactly length \f(CW$colums\fR. .Sp A special case is that the first item of \f(CW@separators\fR may be a reference to an array. This is used internally for wrapping \s-1FT\s0 VARIANT-like lines. .Sp Example: .Sp .Vb 10 \& wrapOn(\*(AqDE \*(Aq, \*(AqDE \*(Aq, 40, \& \*(Aq14\-3\-3 PROTEIN BETA/ALPHA (PROTEIN KINASE C INHIBITOR PROTEIN\-1)\*(Aq, \& \*(Aq\es+\*(Aq) \& returns [\*(Aq14\-3\-3 PROTEIN BETA/ALPHA (PROTEIN \*(Aq, \& \*(AqKINASE C INHIBITOR PROTEIN\-1)\*(Aq] \& wrapOn(\*(AqDE \*(Aq, \*(AqDE \*(Aq, 40, \& \*(Aq14\-3\-3 PROTEIN BETA/ALPHA (PROTEIN KINASE C INHIBITOR PROTEIN\-1)\*(Aq, \& \*(Aq (?=\e()\*(Aq, \*(Aq\es+\*(Aq) \& returns [\*(Aq14\-3\-3 PROTEIN BETA/ALPHA \*(Aq, \& \*(Aq(PROTEIN KINASE C INHIBITOR PROTEIN\-1)\*(Aq] .Ve .IP "cleanLine" 4 .IX Item "cleanLine" Remove the leading line Identifier and three blanks and trailing spaces from an \s-1SP\s0 line. .ie n .IP "joinWith ($text, $with, $noAddAfter, @list)" 4 .el .IP "joinWith ($text, \f(CW$with\fR, \f(CW$noAddAfter\fR, \f(CW@list\fR)" 4 .IX Item "joinWith ($text, $with, $noAddAfter, @list)" Concatenates \f(CW$text\fR and \f(CW@list\fR into one string. Adds \f(CW$with\fR between the original elements, unless the postfix of the current string is \f(CW$noAddAfter\fR. This is used to avoid inserting blanks after hyphens during concatenation. So unpleasant strings like '\s-1CALMODULIN\-\s0 \s-1DEPENDENT\s0' are avoided. Unfortunately a correct reassembly of strings like '\s-1CARBON\-DIOXIDE\s0' is not done. .ie n .IP "insertLineGroup ($textRef, $text, $pattern)" 4 .el .IP "insertLineGroup ($textRef, \f(CW$text\fR, \f(CW$pattern\fR)" 4 .IX Item "insertLineGroup ($textRef, $text, $pattern)" Inserts text block \f(CW$text\fR into the text referred to by \f(CW$textRef\fR. \f(CW$text\fR will replace the text block in \f(CW$textRef\fR matched by \f(CW$pattern\fR. .IP "uniqueList (@list)" 4 .IX Item "uniqueList (@list)" Returns a list in which all duplicates from \f(CW@list\fR have been removed. .IP "currentSpDate" 4 .IX Item "currentSpDate" returns the current date in SWISS-PROT format .ie n .IP "toMixedCase($text, @regexps)" 4 .el .IP "toMixedCase($text, \f(CW@regexps\fR)" 4 .IX Item "toMixedCase($text, @regexps)" Convert a text to mixed case, according to one or more regular expressions. In scalar context, returns the new text; in array context, also returns the regexp with which the change was performed, or undef on failure. See corresponding item in \s-1SWISS::GN\s0 for more details.