File: TextFunc.html

package info (click to toggle)
swissknife 1.75-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,888 kB
  • sloc: perl: 8,520; makefile: 2
file content (130 lines) | stat: -rw-r--r-- 4,948 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
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
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SWISS::TextFunc</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:operations@isb-sib.ch" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>SWISS::TextFunc</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This module is designed to be a repository of functions that are
repeatedly used during parsing and formatting of SWISS-PROT/TREMBL lines.
If more than two line types need to do aproximately the same thing
then it is probably in here.</p>
<p>All functions expect to be called as package-&gt;function(param list)</p>
<dl>
<dt><strong><a name="listfromtext" class="item">listFromText</a></strong></dt>

<dd>
<p>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).</p>
</dd>
<dt><strong><a name="textfromlist" class="item">textFromList</a></strong></dt>

<dd>
<p>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.</p>
<p>Seems to do the wrong thing for references - not sure why.  
Don't use it for that.</p>
</dd>
<dt><strong><a name="wraptext" class="item">wrapText</a></strong></dt>

<dd>
<p>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.</p>
</dd>
<dt><strong><a name="wrapon" class="item">wrapOn ($firstLinePrefix, $linePrefix, $colums, $text[, @separators])</a></strong></dt>

<dd>
<p>Wraps $text into lines with at most $colums colums. Prepends the
prefixes to the lines. @separators is a list of expressions on which
to wrap. The expression itself is part of the upper line.</p>
<p>If no @separators are provided, the $text is wrapped at whitespace
except in EC/TC numbers or at dashes that separate words.</p>
<p>First tries to wrap on the first item of @separators, then the next
etc.  If no wrap on any element of @separators or whitespaces is
possible, wraps into lines of exactly length $colums.</p>
<p>A special case is that the first item of @separators may be a reference
to an array. This is used internally for wrapping FT VARIANT-like lines.</p>
<p>Example:</p>
<pre>
 wrapOn('DE ', 'DE ', 40, 
        '14-3-3 PROTEIN BETA/ALPHA (PROTEIN KINASE C INHIBITOR PROTEIN-1)', 
        '\s+') 
 returns ['14-3-3 PROTEIN BETA/ALPHA (PROTEIN ', 
          'KINASE C INHIBITOR PROTEIN-1)']
 wrapOn('DE ', 'DE ', 40, 
        '14-3-3 PROTEIN BETA/ALPHA (PROTEIN KINASE C INHIBITOR PROTEIN-1)', 
        ' (?=\()', '\s+')
 returns ['14-3-3 PROTEIN BETA/ALPHA ', 
          '(PROTEIN KINASE C INHIBITOR PROTEIN-1)']</pre>
</dd>
<dt><strong><a name="cleanline" class="item">cleanLine</a></strong></dt>

<dd>
<p>Remove the leading line Identifier and three blanks and trailing spaces from an SP line.</p>
</dd>
<dt><strong><a name="joinwith" class="item">joinWith ($text, $with, $noAddAfter, @list)</a></strong></dt>

<dd>
<p>Concatenates $text and @list into one string. Adds $with between the 
original elements, unless the postfix of the current string is $noAddAfter. 
This is used to avoid inserting blanks after hyphens during concatenation. 
So unpleasant strings like 'CALMODULIN- DEPENDENT' are avoided. Unfortunately 
a correct reassembly of strings like 'CARBON-DIOXIDE' is not done.</p>
</dd>
<dt><strong><a name="insertlinegroup" class="item">insertLineGroup ($textRef, $text, $pattern)</a></strong></dt>

<dd>
<p>Inserts text block $text into the text referred to by $textRef. $text will replace the text block in $textRef matched by $pattern.</p>
</dd>
<dt><strong><a name="uniquelist" class="item">uniqueList (@list)</a></strong></dt>

<dd>
<p>Returns a list in which all duplicates from @list have been removed.</p>
</dd>
<dt><strong><a name="currentspdate" class="item">currentSpDate</a></strong></dt>

<dd>
<p>returns the current date in SWISS-PROT format</p>
</dd>
<dt><strong><a name="tomixedcase" class="item">toMixedCase($text, @regexps)</a></strong></dt>

<dd>
<p>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 SWISS::GN for more details.</p>
</dd>
</dl>

</body>

</html>