Commit 274935da authored by Anton Petrov's avatar Anton Petrov
Browse files

Use so_rna_type instead of so_rna_type_name

parent 2de47c90
......@@ -15,8 +15,6 @@ to sequences. That is it can find if the sequence and Rfam domain conflict, or
if the sequence is only a partial sequence
"""
import re
import requests
......@@ -59,8 +57,8 @@ class RnaSummary(object):
self.rfam_count = len(self.rfam_id)
self.rna_type = entry['rna_type'][0]
self.species = entry['species'][0] if len(entry['species']) > 0 else ''
self.pretty_so_rna_type_name = self.parse_so_rna_type_name(entry['so_rna_type_name'][0]) if len(entry['so_rna_type_name']) > 0 else ''
self.so_rna_type_name = self.convert_string_to_array(entry['so_rna_type_name'][0]) if len(entry['so_rna_type_name']) > 0 else ''
self.pretty_so_rna_type = self.parse_so_rna_type(entry['so_rna_type'][0]) if len(entry['so_rna_type']) > 0 else ''
self.so_rna_type = self.convert_string_to_array(entry['so_rna_type'][0]) if len(entry['so_rna_type']) > 0 else ''
def get_raw_data(self, urs, taxid):
......@@ -83,7 +81,7 @@ class RnaSummary(object):
'rfam_id',
'rna_type',
'species',
'so_rna_type_name',
'so_rna_type',
]
url = '{endpoint}/entry/{urs}_{taxid}?format=json&fields={fields}'.format(
urs=urs,
......@@ -106,11 +104,9 @@ class RnaSummary(object):
except:
return 1
def convert_string_to_array(self, target):
so_terms = re.sub(r'[\[\]\'\s]', '', target)
if not so_terms:
return None
so_terms = so_terms.split(',')
def convert_string_to_array(self, so_rna_type):
so_terms = so_rna_type.split('/')
so_terms.remove('')
if len(so_terms) > 1:
so_terms.remove('ncRNA')
return so_terms
......@@ -127,11 +123,8 @@ class RnaSummary(object):
so_term = so_term.replace('_', ' ')
return so_term
def parse_so_rna_type_name(self, so_rna_type_name):
"""
Turn "['ncRNA', 'lnc_RNA']" into an array of strings.
"""
so_terms = self.convert_string_to_array(so_rna_type_name)
def parse_so_rna_type(self, so_rna_type):
so_terms = self.convert_string_to_array(so_rna_type)
if not so_terms:
return ''
pretty_so_terms = []
......
......@@ -78,8 +78,8 @@ limitations under the License.
<li>
Found in <strong>{{ context.summary.count_distinct_organisms|intcomma }}</strong> <a href="" class="show-species-tab" ng-click="activateTaxonomyTab()">species</a>
</li>
{% if context.summary.so_rna_type_name %}
{% if context.summary.pretty_so_rna_type_name|length > 1 %}
{% if context.summary.so_rna_type %}
{% if context.summary.pretty_so_rna_type|length > 1 %}
<li>
<ol class="breadcrumb well well-sm" style="background-color: white; margin-bottom: 0;">
{% for pretty_rna_type, rna_type in context.summary_so_terms %}
......@@ -88,7 +88,7 @@ limitations under the License.
</ol>
</li>
{% else %}
<li><a href='/search?q=so_rna_type_name:"{{ context.summary.so_rna_type_name.0 }}"' uib-tooltip="Browse {{ context.summary.pretty_so_rna_type_name.0 }}">{{ context.summary.pretty_so_rna_type_name.0 }}</a></li>
<li><a href='/search?q=so_rna_type_name:"{{ context.summary.so_rna_type.0 }}"' uib-tooltip="Browse {{ context.summary.pretty_so_rna_type.0 }}">{{ context.summary.pretty_so_rna_type.0 }}</a></li>
{% endif %}
{% else %}
<li class="badge" style="padding-left: 7px; padding-right: 7px;">{{ context.precomputed.rna_type }}</li>
......
......@@ -136,7 +136,7 @@ def rna_view(request, upi, taxid=None):
if taxid_filtering:
summary_text = render_to_string('portal/summary.html', vars(summary))
summary_text = re.sub(r'\s+', ' ', summary_text.strip())
summary_so_terms = zip(summary.pretty_so_rna_type_name, summary.so_rna_type_name)
summary_so_terms = zip(summary.pretty_so_rna_type, summary.so_rna_type)
context = {
'symbol_counts': symbol_counts,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment