def from_repeat_masker_string(s):
parts = s.split()<EOL>if len(parts) != <NUM_LIT:15> and len(parts) != <NUM_LIT>:<EOL><INDENT>raise RetrotransposonError("<STR_LIT>" + s)<EOL><DEDENT>for i in [<NUM_LIT:11>, <NUM_LIT:12>, <NUM_LIT>]:<EOL><INDENT>parts[i] = parts[i].strip()<EOL>if parts[i][<NUM_LIT:0>] == "<STR_LIT:(>":<EOL><INDENT>parts[i] = parts[i][<NUM_LIT:1>:]<EOL><DEDENT>if parts[i][-<NUM_LIT:1>] == "<STR_LIT:)>":<EOL><INDENT>parts[i] = parts[i][<NUM_LIT:0>:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>q_seq = parts[<NUM_LIT:4>].strip()<EOL>q_seq_start = int(parts[<NUM_LIT:5>])<EOL>q_seq_end = int(parts[<NUM_LIT:6>]) + <NUM_LIT:1><EOL>strand = "<STR_LIT:->" if parts[<NUM_LIT:8>].strip() in COMPLEMENT_CHARS else "<STR_LIT:+>"<EOL>repeat_name = parts[<NUM_LIT:9>].strip()<EOL>repeat_family = parts[<NUM_LIT:10>].strip()<EOL>con_pos_start = int(parts[<NUM_LIT:11>]) if strand is "<STR_LIT:+>" else int(parts[<NUM_LIT>])<EOL>con_pos_end = int(parts[<NUM_LIT:12>]) + <NUM_LIT:1><EOL>con_pos_left = int(parts[<NUM_LIT>]) if strand is "<STR_LIT:+>" else int(parts[<NUM_LIT:11>])<EOL>repeat_id = int(parts[<NUM_LIT>].strip()) if len(parts) == <NUM_LIT:15> else None<EOL>con_seq_len = con_pos_end + con_pos_left<EOL>rt = Retrotransposon(repeat_name, repeat_family)<EOL>return RetrotransposonOccurrence(q_seq, q_seq_start, q_seq_end, strand,<EOL>con_pos_start, con_pos_end, con_seq_len,<EOL>rt, uniq_id=repeat_id)<EOL>
Parse a RepeatMasker string. This format is white-space separated and has
15 columns. The first 11 are invariably as follows:

+----------------------+---------+-----------+----------------------------+
|     Description      |  Type   |  Example  | Notes                      |
+======================+=========+===========+============================+
| alignment score      | int (?) |  463      |                            |
+----------------------+---------+-----------+----------------------------+
| percent divergence   | float   | 1.3       |                            |
+----------------------+---------+-----------+----------------------------+
| percent deletions    | float   | 0.6       |                            |
+----------------------+---------+-----------+----------------------------+
| percent insertions   | float   | 1.7       |                            |
+----------------------+---------+-----------+----------------------------+
| query seq. name      | string  | chr1      |                            |
+----------------------+---------+-----------+----------------------------+
| query seq. start     | int     | 10001     | always pos. strand coords  |
+----------------------+---------+-----------+----------------------------+
| query seq. end       | int     | 10468     | always pos. strand         |
+----------------------+---------+-----------+----------------------------+
| query seq. remaining | int     | (105)     | always in parenthesis,     |
|                      |         |           | always negative strand     |
|                      |         |           | coords. Bases left in      |
|                      |         |           | query sequence before end  |
|                      |         |           | (alt. can be interpreted   |
|                      |         |           | as negative strand coord   |
|                      |         |           | of genomic end coord).     |
+----------------------+---------+-----------+----------------------------+
| strand               | char    | C         | either + or C              |
|                      |         |           | (complement); this refers  |
|                      |         |           | to whether the match is    |
|                      |         |           | to the consensus or the    |
|                      |         |           | rev. comp. of it.          |
+----------------------+---------+-----------+----------------------------+
| repeat name          | string  | AluJo     |                            |
+----------------------+---------+-----------+----------------------------+
| repeat family        | string  | SINE/Alu  |                            |
+----------------------+---------+-----------+----------------------------+

The next three depend on whether the genomic sequence was a match to the
consensus sequence, or to the reverse complement of the consensus sequence.
In the former case, they are as follows:

+------------------------+-------+-----------+-----------------------------+
|     Description        | Type  |  Example  | Notes                       |
+========================+=======+===========+=============================+
| consensus match start  | int   |   45      | awlays pos strand           |
+------------------------+-------+-----------+-----------------------------+
| consensus match end    | int   |   60      | always pos strand;          |
|                        |       |           | end >= start; it is         |
|                        |       |           | inclusive of the final      |
|                        |       |           | coordinate (unlike e.g.     |
|                        |       |           | UCSC coords)                |
+------------------------+-------+-----------+-----------------------------+
| consensus match remain | (int) |  (40)     | for '+' match, always       |
|                        |       |           | negative strand coords. Num |
|                        |       |           | of bases after match before |
|                        |       |           | end of consensus. (Alt. can |
|                        |       |           | be considered the negative  |
|                        |       |           | strand coords of the match  |
|                        |       |           | end in consensus seq.)      |
+------------------------+-------+-----------+-----------------------------+

In the latter case, they have this interpretation:

+------------------------+-------+-----------+-----------------------------+
|     Description        | Type  |  Example  | Notes                       |
+========================+=======+===========+=============================+
| consensus match before | (int) | (10)      | always neg. strand (always  |
|                        |       |           | parens); number of bases    |
|                        |       |           | before start of match on    |
|                        |       |           | negative strand (alt. can   |
|                        |       |           | be interpreted as the       |
|                        |       |           | negative strand coordinates |
|                        |       |           | of the match start)         |
+------------------------+-------+-----------+-----------------------------+
| consensus match start  | int   | 345       | start of match in pos.      |
|                        |       |           | strand coords.              |
+------------------------+-------+-----------+-----------------------------+
| consensus match end    | int   | 143       | end of match in pos. strand |
|                        |       |           | coords. Because match is on |
|                        |       |           | neg. strand, 'start' is     |
|                        |       |           | always >= end.              |
+------------------------+-------+-----------+-----------------------------+

The final column should be an ID, but I have noticed this is sometimes
missing. We don't use all of the above fields, and we convert everything into
positive strand coords where start < end always.

:param s: string representation of a retrotransposon occurrence in
          RepeatMasker format.
:return: Retrotransposon object corresponding to the string s.