Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/f66135a68ae5
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 01:10:59 2012
Кодировка:
allpy: f66135a68ae5

allpy

changeset 738:f66135a68ae5

Merge with Nagaev
author Boris Burkov <BurkovBA@gmail.com>
date Sat, 09 Jul 2011 16:31:36 +0400
parents ccee8a6023f4 c421263ef000
children a6a5cce7018e
files
diffstat 3 files changed, 33 insertions(+), 15 deletions(-) [+]
line diff
     1.1 --- a/allpy/structure.py	Sat Jul 09 16:30:28 2011 +0400
     1.2 +++ b/allpy/structure.py	Sat Jul 09 16:31:36 2011 +0400
     1.3 @@ -310,8 +310,13 @@
     1.4              p_from = column2pos[block.columns[0]]
     1.5              p_to = column2pos[block.columns[-1]]
     1.6              js_block = {}
     1.7 -            js_block['start'] = p_from
     1.8 -            js_block['end'] = p_to
     1.9 +            if len(block.columns) == p_to + 1 - p_from:
    1.10 +                # continuous block
    1.11 +                js_block['start'] = p_from
    1.12 +                js_block['end'] = p_to
    1.13 +            else:
    1.14 +                # not continuous block
    1.15 +                js_block['positions'] = [column2pos[c] for c in block.columns]
    1.16              js_block['IDs'] = []
    1.17              for sequence in block.sequences:
    1.18                  js_block['IDs'].append(sequence.name)
     2.1 --- a/blocks3d/www/input/blocks.js	Sat Jul 09 16:30:28 2011 +0400
     2.2 +++ b/blocks3d/www/input/blocks.js	Sat Jul 09 16:31:36 2011 +0400
     2.3 @@ -2,8 +2,9 @@
     2.4  /*
     2.5  list of blocks
     2.6  block = {
     2.7 -    int start; (inclusive)
     2.8 -    int end; (inclusive)
     2.9 +    int start; (inclusive) // do not use with positions
    2.10 +    int end; (inclusive) // do not use with positions
    2.11 +    int[] positions; // do not use with start and end
    2.12      IDs: list of IDs
    2.13      cores: []
    2.14      is_conservative: list, mapping pos to bool
    2.15 @@ -96,6 +97,20 @@
    2.16  
    2.17      var seq;
    2.18  
    2.19 +    // generate positions for deprecated start-end blocks
    2.20 +    for (i = 0; i < blocks.length; i++)
    2.21 +    {
    2.22 +        block = blocks[i];
    2.23 +        if (block.end)
    2.24 +        {
    2.25 +            block.positions = [];
    2.26 +            for (j = block.start; j <= block.end; j++)
    2.27 +            {
    2.28 +                block.positions.push(j);
    2.29 +            }
    2.30 +        }
    2.31 +    }
    2.32 +
    2.33      // calculate max_ID_length
    2.34      max_ID_length = 0;
    2.35      for (ID in fasta_dict)
    2.36 @@ -125,10 +140,9 @@
    2.37          for (k = 0; k < block.IDs.length; k++)
    2.38          {
    2.39              ID = block.IDs[k];
    2.40 -            for (j = block.start; j <= block.end; j++)
    2.41 -            {
    2.42 -                useful_positions[ID][j] = i;
    2.43 -            }
    2.44 +            $.each(block.positions, function(key, pos) {
    2.45 +                useful_positions[ID][pos] = i;
    2.46 +            });
    2.47          }
    2.48      }
    2.49  
    2.50 @@ -144,10 +158,9 @@
    2.51      {
    2.52          block = blocks[i];
    2.53          block.is_conservative = [];
    2.54 -        for (j = block.start; j <= block.end; j++)
    2.55 -        {
    2.56 -            block.is_conservative[j] = is_conservative_column(j, block.IDs);
    2.57 -        }
    2.58 +        $.each(block.positions, function(key, pos) {
    2.59 +            block.is_conservative[j] = is_conservative_column(pos, block.IDs);
    2.60 +        });
    2.61      }
    2.62  
    2.63      // pre-calculate strings for <pre>
    2.64 @@ -231,10 +244,10 @@
    2.65      for (var i = 0; i < blocks.length; i++)
    2.66      {
    2.67          var s = '.block' + i;
    2.68 -        $(s).mouseover({s: s}, function(event) {
    2.69 +        $(s).bind('mouseover', {s: s}, function(event) {
    2.70              $(event.data.s).css('color', 'green');
    2.71          });
    2.72 -        $(s).mouseleave({s: s}, function(event) {
    2.73 +        $(s).bind('mouseleave', {s: s}, function(event) {
    2.74              $(event.data.s).css('color', 'black');
    2.75          });
    2.76      }
     3.1 --- a/blocks3d/www/test.py	Sat Jul 09 16:30:28 2011 +0400
     3.2 +++ b/blocks3d/www/test.py	Sat Jul 09 16:31:36 2011 +0400
     3.3 @@ -2,7 +2,7 @@
     3.4  print open('output/index.html').read().replace('self_js_text', """
     3.5  blocks = [{"start": 2, "end": 17, "IDs": ["B", "A"]},
     3.6      {"start": 19, "end": 28, "IDs": ["B", "C"]},
     3.7 -    {"start": 35, "end": 47, "IDs": ["B", "A", "C"]}];
     3.8 +    {"positions": [35, 36, 37, 45, 46, 47], "IDs": ["B", "A", "C"]}];
     3.9  fasta_dict = {"A": "SNAKIDQLSSDVQTLNAK-DQLSNDVNAARSDAQAAKDDAARANQRLDNM",
    3.10                "B": "SNAKIDQLSSDAQTANAK-DQASNDANAARSDAQAAKDDAARANQRLDNM",
    3.11                "C": "SNAARANQRLDNMKIDQLSSDAQTANAKA-SDAQAAKDDAARANQRLDNM"};