Skip to content

Commit

Permalink
Latest updates
Browse files Browse the repository at this point in the history
  • Loading branch information
adsilb committed Sep 4, 2021
1 parent 6f997f1 commit e74a2ce
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 40 deletions.
Binary file modified search/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file modified search/__pycache__/views.cpython-39.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion search/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class MsigdbPathways(models.Model):
hgnc_id = models.TextField(db_column='HGNC_ID', blank=True, null=True) # Field name made lowercase.
pathway = models.TextField(db_column='Pathway', blank=True, null=True) # Field name made lowercase.
url = models.TextField(db_column='URL', blank=True, null=True) # Field name made lowercase.
gene = models.TextField(db_column='Gene', blank=True, null=True) # Field name made lowercase.
gene_symbol = models.TextField(db_column='gene_symbol', blank=True, null=True) # Field name made lowercase.
source = models.TextField(db_column='Source', blank=True, null=True) # Field name made lowercase.
source_date = models.IntegerField(db_column='Source_Date', blank=True, null=True) # Field name made lowercase.
download_date = models.IntegerField(db_column='Download_Date', blank=True, null=True) # Field name made lowercase.
Expand Down
89 changes: 52 additions & 37 deletions search/templates/search/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ <h1>TargetLink</h1>
<td>
<form method="get">
Enter either:
<ul>
<li>a single gene symbol</li>
<li>a list of gene symbols, one per line</li>
</ul>
<textarea id="txtGeneList" name="search_terms" rows="8">{%if search_terms != None %}{{ search_terms }}{% endif %}</textarea>
<br />
<input type="submit" value="Search" style="margin-top:5px;">
<br><br>
<i>Current Search: {{ search_terms }}</i><br>
</form>
</td>
<ul>
<li>a single gene symbol</li>
<li>a list of gene symbols, one per line</li>
</ul>
<textarea id="txtGeneList" name="search_terms" rows="8">{%if search_terms != None %}{{ search_terms }}{% endif %}</textarea>
<br />
<input type="submit" value="Search" style="margin-top:5px;">
<br><br>
<i>Current Search: {{ search_terms }}</i><br>
</form>
</td>
<td valign="top">
<div class="container section" style="margin-left:10px;max-width:2000px;">
<div class="form-check" style="padding-left:10px;">
Expand Down Expand Up @@ -124,8 +124,8 @@ <h1>TargetLink</h1>
<li>
<input type="checkbox" /><span>Protein Interactions</span>
<ul class="column-choices-ajax">
<li><input type="checkbox" data-column="0" data-table="3" checked />Gene 1 Symbol</li>
<li><input type="checkbox" data-column="1" data-table="3" checked />Gene 2 Symbol</li>
<li><input type="checkbox" data-column="0" data-table="3" />Primary Gene</li>
<li><input type="checkbox" data-column="1" data-table="3" checked />Interacting Gene</li>
<li><input type="checkbox" data-column="2" data-table="3" checked />Score (HIPPIE)</li>
<li><input type="checkbox" data-column="3" data-table="3" checked />Score (STRING)</li>
<li><input type="checkbox" data-column="4" data-table="3" checked />Experiments</li>
Expand Down Expand Up @@ -159,6 +159,7 @@ <h1>TargetLink</h1>

{% if search_terms %}
<div id="resultsGrid" style="display:none;">
<input type="submit" value="Download Data" style="margin:5px 0;">
<h5>Matching Genes</h5>
<table id="tblGenes" class="table" style="width:100%">
<thead>
Expand All @@ -184,13 +185,13 @@ <h5>Matching Genes</h5>
<tbody>
{% for search_result in genelist %}
<tr id='tr{{search_result.gene_info.gene_symbol}}'>
<td><a href="https://www.genenames.org/data/gene-symbol-report/#!/hgnc_id/{{ search_result.gene_info.hgnc_id }}" target="_blank">{{ search_result.gene_info.gene_symbol }}</a></td>
<td style="width:7%"><a href="https://www.genenames.org/data/gene-symbol-report/#!/hgnc_id/{{ search_result.gene_info.hgnc_id }}" target="_blank">{{ search_result.gene_info.gene_symbol }}</a></td>
<td>{{ search_result.gene_info.approved_name }}</td>
<td>{{ search_result.gene_info.synonyms }}</td>
<td>{{ search_result.gene_info.protein_class }}</td>
<td>{{ search_result.gene_info.categories }}</td>
<td>{{ search_result.gene_info.chromosome }}</td>
<td>{{ search_result.gene_info.druggable }}</td>
<td style="width:7%">{{ search_result.gene_info.chromosome }}</td>
<td style="width:7%">{{ search_result.gene_info.druggable }}</td>
<td>{{ search_result.gene_info.enzyme }}</td>
<td>{{ search_result.gene_info.kinase }}</td>
<td>{{ search_result.gene_info.transcription_factor }}</td>
Expand Down Expand Up @@ -264,8 +265,8 @@ <h5>Protein Interactions</h5>
<table id="tblProteinInteractions" class="table" style="width:100%">
<thead>
<tr>
<th>Gene 1</th>
<th>Gene 2</th>
<th>Primary Gene</th>
<th>Interacting Gene</th>
<th>HIPPIE Score</th>
<th>STRING Score</th>
<th>Experiments</th>
Expand All @@ -278,11 +279,12 @@ <h5>Protein Interactions</h5>

<hr/>

<h5>Function/Pathway (COMING SOON)</h5>
<table class="table grid" style="width:100%">
<h5>Pathways</h5>
<table id="tblPathways" class="table grid" style="width:100%">
<thead>
<tr>
<th>Condition</th>
<th>Pathway</th>
<th>Source</th>
</tr>
</thead>
</table>
Expand Down Expand Up @@ -322,21 +324,23 @@ <h5>Function/Pathway (COMING SOON)</h5>
} );

tblGenes = $('#tblGenes').DataTable({
"searching": false,
initComplete: function () {
// Apply the search
this.api().columns().every( function () {
var that = this;
"searching": true,

$( 'input', this.footer() ).on( 'keyup change clear', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
initComplete: function () {
// Apply the search
this.api().columns().every( function () {
var that = this;

$('input', this.footer() ).on( 'keyup change clear', function () {
console.log('searching: ' + this.value)
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
} );
} );
} );
}
}
} );
tables.push(tblGenes);

Expand Down Expand Up @@ -401,7 +405,7 @@ <h5>Function/Pathway (COMING SOON)</h5>
success: function (d) {
//console.log(d);
tblDrugTargets = $('#tblDrugTargets').DataTable({
searching: false,
searching: true,
destroy: true,
data: d["drug_targets"],
columns: [
Expand All @@ -416,7 +420,7 @@ <h5>Function/Pathway (COMING SOON)</h5>
tables.push(tblDrugTargets);

tblDiseases = $('#tblDiseases').DataTable({
searching: false,
searching: true,
destroy: true,
data: d["diseases"],
columns: [
Expand All @@ -433,7 +437,7 @@ <h5>Function/Pathway (COMING SOON)</h5>
tables.push(tblDiseases);

tblProteinInteractions = $('#tblProteinInteractions').DataTable({
searching: false,
searching: true,
destroy: true,
data: d["protein_interactions"],
columns: [
Expand All @@ -449,6 +453,17 @@ <h5>Function/Pathway (COMING SOON)</h5>
} );
tables.push(tblProteinInteractions);

tblPathways = $('#tblPathways').DataTable({
searching: true,
destroy: true,
data: d["pathways"],
columns: [
{ data: "pathway", render: function(data, type, row, meta) {return "<a href='" + row["url"] + "' target='_blank'>" + data + "</a>"} },
{ data: "source" }
]
} );
tables.push(tblPathways);

$('input[type="checkbox"]', ".column-choices-ajax").each(function(index) {
setColumnVis(tables[$(this).data('table')], $(this))
});
Expand Down
5 changes: 3 additions & 2 deletions search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.http import HttpResponse
from django.http import JsonResponse

from search.models import vwGeneInfo, vwDrugTargets, vwDiseases, vwProteinInteractions
from search.models import vwGeneInfo, vwDrugTargets, vwDiseases, vwProteinInteractions, MsigdbPathways

def index(request):
# print("genelist:", genelist)
Expand All @@ -29,7 +29,8 @@ def gene_details(request):
data = {
'drug_targets': list(vwDrugTargets.objects.filter(gene_symbol = symbol).values()),
'diseases': list(vwDiseases.objects.filter(gene_symbol = symbol).values()),
'protein_interactions': list(vwProteinInteractions.objects.filter(geneSymbol1 = symbol).values())
'protein_interactions': list(vwProteinInteractions.objects.filter(geneSymbol1 = symbol).values()),
'pathways': list(MsigdbPathways.objects.filter(gene_symbol = symbol).values())
}

return JsonResponse(data)
Expand Down

0 comments on commit e74a2ce

Please sign in to comment.