Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

Commit

Permalink
last copy of front before merge into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Crazy-Jack committed Aug 22, 2019
1 parent 421bead commit 317ff07
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 26 deletions.
2 changes: 1 addition & 1 deletion cirDraw/restart_uwsgi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ sudo uwsgi --ini /home/circ/circDraw/cirDraw/uwsgi.ini --uid circ --enable-threa
cd /home/circ/circDraw/process_watchdog/
python3 resetdb.py admin_login.json clean

> /var/log/uwsgi/circDraw.log
#> /var/log/uwsgi/circDraw.log
4 changes: 2 additions & 2 deletions cirDraw/static/tools/js/denChrPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ function gradientLegend(x, y) {
stroke: 'none'
});
}
den.paper.text(x - 10, y + 5, '1').attr({
den.paper.text(x - 10, y + 5, denBlockMIN).attr({
fill: palette[0],
stroke: 'none',
'font-size': 8,
//'font-family': 'arial'
});
den.paper.text(x + 203, y + 5, '100').attr({
den.paper.text(x + 203, y + 5, denBlockMAX).attr({
fill: palette[99],
stroke: 'none',
'font-size': 8,
Expand Down
3 changes: 2 additions & 1 deletion cirDraw/static/tools/js/drawCirc.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ $scale.ionRangeSlider({
});

var table = new Tabulator("#table", {
layout:"fitDataFill",
layout:"fitColumns",
height:"350px",
headerFilterPlaceholder:"Search",
placeholder:"No Data Available",
Expand Down Expand Up @@ -814,6 +814,7 @@ function drawArc(data) {
//console.log(tableData)

table.replaceData(tableData);
table.redraw();

$("#download-csv").click(function(){
table.download("csv", name + ".csv");
Expand Down
3 changes: 3 additions & 0 deletions cirDraw/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav text-uppercase ml-auto">
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="/tools/display/8bd10a77cbda74ed2513d2643a39b0bb">Example</a>
</li>
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="{% url 'tools' %}">Upload</a>
</li>
Expand Down
18 changes: 9 additions & 9 deletions cirDraw/tools/templates/tools/tools.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<a id='origin-data' style='font-size: 7pt; color: #fed136; cursor: pointer;'><u>Result data</u></a>
<h2 id="report">Basic Report</h2>
<div class="row justify-content-center mt-3">
<div class="col-12">
<h3 id="len">circRNA length distribution</h3>
<div data-intro="Statistic of circRNA length in the file." data-step="1" id="lenChart" style="width: 100%; min-height: 400px"></div>
<div class="col-10">
<h3 id="len">Distrubution of circRNA splicing sites span</h3>
<div data-intro="Statistic of the span of all circRNA backsplicing sites in the file." data-step="1" id="lenChart" style="width: 100%; min-height: 400px"></div>
<h3 id="top">Top 20 genes with most circRNA isoforms</h3>
<div id="topChart" style="width: 100%; min-height: 400px"></div>
</div>
Expand All @@ -35,7 +35,7 @@ <h3 id="iso">circRNA length</h3>
<h2 id="density" data-toc-text="Density plot">circRNA density distribution on chromosome
</h2>

<svg id="svg2" width="800" height="500" class="svg" data-intro="Interactive plot of circRNA density on chromosome. Try to click on the color block."
<svg id="svg2" width="800" height="500" class="svg" data-intro="Interactive plot of circRNA counts on chromosome. Try to click on the color block. Darker block means the gene has more circRNAs. The block surrounded by red squre is the gene currently displaying below."
data-step="2">
<image id="load" x="360" y="220" width="80" height="80" xlink:href="../../../media/dna.gif"/>
</svg>
Expand Down Expand Up @@ -74,7 +74,7 @@ <h2 id="density" data-toc-text="Density plot">circRNA density distribution on ch
<a class="btn btn-primary btn-sm text-center" id="denDownload" download="circDraw.svg">Download</a>
</div>-->

<h2 id="isoform" data-toc-text="Isoform plot">circRNA isoforms on chromosome region</h2>
<h2 id="isoform" data-toc-text="Isoform plot">circRNA isoforms on gene</h2>
<svg id="svg" width="800" height="500" class="svg" data-intro="Interactive plot of circRNAs back-splicing events on gene, Select a block from above plot, the detail of that block will be displayed here. Click the curve to view the predicted internal structure of circRNAs." data-step="5">
<foreignObject width="800" height="500" id="svg-tip">
<p style="padding-top: 240px; font-size: 20px; color: grey;"><strong>Please select a region from
Expand All @@ -101,10 +101,10 @@ <h2 id="isoform" data-toc-text="Isoform plot">circRNA isoforms on chromosome reg
</div>

<div class="row justify-content-center pt-3">
<div class="col-8">
<div class="col-10">
<div class="extra-controls den-select-info">
<button id="previous" class="btn btn-light btn-sm"><i
class="fas fa-angle-double-left"></i><strong> Last Gene</strong></button>
class="fas fa-angle-double-left"></i><strong> Last</strong></button>
<p class="ml-1 mr-1 mb-1 d-inline-block">Name:</p>
<!--<p id="geneNameSelect" class="ml-1 mr-1 mb-1 d-inline-block">Unknown</p>-->
<input data-step="6" data-intro="type in gene name to search for interested gene." list="genename-list" id="geneNameSelect" style="width: 5em" />
Expand All @@ -117,7 +117,7 @@ <h2 id="isoform" data-toc-text="Isoform plot">circRNA isoforms on chromosome reg
<p id="js-input-from" class="ml-1 mr-1 mb-1 d-inline-block">0</p>
<p class="ml-1 mr-1 mb-1 d-inline-block">End:</p>
<p id="js-input-to" class="ml-1 mr-1 mb-1 d-inline-block">0</p>
<button id="next" class="btn btn-light btn-sm"><strong>Next Gene </strong><i
<button id="next" class="btn btn-light btn-sm"><strong>Next </strong><i
class="fas fa-angle-double-right"></i></button>
</div>
</div>
Expand Down Expand Up @@ -161,7 +161,7 @@ <h2 id="BaTable" class="d-inline-block mr-3">Possible modifications on circRNA</

</div>
<span class="help-block" style="color:grey;" id="circ-name"></span>
<div class="row justify-content-center" id="BaTable2" data-step="7" data-intro="When you select a circRNA, related modification info will be displayed here.">
<div class="row justify-content-center" id="BaTable2" data-step="7" data-intro="When you select a circRNA, related modification info will be displayed here. If the table content is not displayed, please enlarge your windows.">
<div class="col-9">
<div id="table" class="table-sm bd-bottom"></div>
</div>
Expand Down
32 changes: 22 additions & 10 deletions process_watchdog/resetdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ def delete_file(file_path, r=False):




def cleandb_except(connector, exception_box, exceptions):
# delete from table where exceptions won't be deleted.
operator = mc.Operator(connector)
for t in exception_box:
operator.clean_table(t, {'md5': ['!=', exceptions]})
print('Exception drop Success in ', t)
operator.terminate()



Expand Down Expand Up @@ -132,22 +138,28 @@ def main(login_file_name, inp):
connector = mc.Connector(login_file_name)
if inp == "migration":
remigrations(connector)
connector.commit_close_db()

elif inp == "clean":
clean_box = ['tools_species_circrnas', 'tools_species_genome_exons_introns', 'tools_species_genome_genes', 'tools_species_genome_transcripts']
example_md5 = '8bd10a77cbda74ed2513d2643a39b0bb'
path_box = ["../cirDraw/media/md5_data/"]
empty_db(connector, clean_box)
empty_dir(path_box)
cursor_ob = mc.Cursor(connector)
cursor = cursor_ob.cursor
cursor.execute(f'''delete from UserTable where md5 != '{example_md5}';''')
cursor.execute(f'''delete from tools_uploadmd5 where md5 != '{example_md5}';''')
cursor.execute(f'''delete from StatisticTable where md5 != '{example_md5}';''')
cursor.execute(f'''delete from UserDensity where md5 != '{example_md5}';''')
print(f"Success: Empty table UserTable,tools_uploadmd5,StatisticTable,UserDensity except md5 == '{example_md5}'")
cursor_ob.terminate()
connector.commit_close_db()

exception_box = ['UserTable', 'tools_uploadmd5', 'StatisticTable', 'UserDensity']
cleandb_except(connector, exception_box, example_md5)
connector.commit_close_db()


#cursor_ob = mc.Cursor(login_file_name)
#cursor = cursor_ob.origin_cursor
#cursor.execute(f'''delete from UserTable where md5 != '{example_md5}';''')
#cursor.execute(f'''delete from tools_uploadmd5 where md5 != '{example_md5}';''')
#cursor.execute(f'''delete from StatisticTable where md5 != '{example_md5}';''')
#cursor.execute(f'''delete from UserDensity where md5 != '{example_md5}';''')
#print(f"Success: Empty table UserTable,tools_uploadmd5,StatisticTable,UserDensity except md5 == '{example_md5}'")
#cursor_ob.terminate()

if __name__ == '__main__':
login_file_name = sys.argv[1]
Expand Down
10 changes: 7 additions & 3 deletions related_genome_info/process_pkg/mysqlconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def drop_table(self, table_name):
def clean_table(self, table_name, conditions=None):
"""empty an existed table
>>> conditions = None
>>> conditions = {'colname1': 'colvalue'}
>>> conditions = {'colname1': ['=', 'colvalue']}
"""
try:
delete_sql_base = """delete from """ + str(table_name)
Expand All @@ -114,12 +114,13 @@ def clean_table(self, table_name, conditions=None):
colname = i
value = conditions[colname]
if num == 0:
adds = """ """ + str(colname) + """ = """ + value.__repr__()
adds = """ """ + str(colname) + """ """ + value[0] + """ """ + value[1].__repr__()
else:
adds = """ AND """ + str(colname) + """ = """ + value.__repr__()
adds = """ AND """ + str(colname) + """ """ + value[0] + """ """ + value[1].__repr__()
delete_sql_base += adds
num += 1
delete_sql = delete_sql_base + """;"""
print("This is deletesql: ", delete_sql)
# execute
if self.connector.checkpoint.is_exist_table(table_name):
cursor_ob = Cursor(self.connector)
Expand All @@ -146,10 +147,13 @@ def clean_table(self, table_name, conditions=None):

except Exception as e:
print("Failed: Empty table {} failed, raise Expections:")

print("Error: ", e)





## =====================================================================
# Create table in database:
def create_table(self, table_name, table_columns, data):
Expand Down

0 comments on commit 317ff07

Please sign in to comment.