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

Commit

Permalink
add data from circ2disease, connect circRNA with disease
Browse files Browse the repository at this point in the history
  • Loading branch information
Crazy-Jack committed Aug 24, 2019
1 parent a59112a commit 497d832
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 5 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: 3 additions & 1 deletion cirDraw/static/tools/js/drawCirc.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ function drawCircRNA(exonComponents, circStart, circEnd) {
for (i = 0, up = exons.length; i < up; i++) {
var start = exons[i].start,
end = exons[i].end,
disease = exons[i].disease,
exStartAngle = startAngle,
exEndAngle = startAngle + ((end - start) / len) * 360,
type = exons[i].type,
Expand Down Expand Up @@ -831,7 +832,8 @@ function drawArc(data) {
infobox = infoBox(x, y, {
name: $chr.text() + ' : ' + data.start + ' - ' + data.end,
position: data.start + "-" + data.end,
source: data.source
source: data.source,
disease: data.disease,
});
}).mouseout(function () {
Snap.animate(5, 1, function (val) {
Expand Down
2 changes: 2 additions & 0 deletions cirDraw/static/tools/js/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ $(document).ready(function () {
status = reportID[0].save_status;
//console.log(reportID, status);
if (status === false) {
$('.lds-roller').remove();
$('#upload-text').remove();
$('#processtip').html('<p>Processing Failed! Wrong file type or server failed. Please <a id="refresher" onclick="location.reload()"><i>refresh</i><i class="fas fa-redo-alt ml-1"></i></a></p>');
$('#refresher').hover(function(){
$('#refresher').css({'cursor':'pointer', 'color': '#fed136'});
Expand Down
19 changes: 19 additions & 0 deletions cirDraw/tools/handle_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,20 @@ def process_file(file, assembly: str, file_type, task_id, bias=2):
print('demjson decode ERROR:', e)
for i in components:
i['mods'] = ujson.loads(i['mods'])
with connection.cursor() as cur:
cur.execute(f'select disease from circ_disease where assembly="{assembly}" and chr_num="{chr_num}" and start>={start-bias} and start<={start+bias} and end<={end+bias} and end>={end-bias};')
disease = cur.fetchall()
print(disease)
if len(disease) == 0:
disease = 'Unknown'
else:
disease = disease[0]
circ_json = {"start": int(circ[3]),
"end": int(circ[4]),
"source": "CIRCpedia V2",
"gene": circ[0],
"transcript": circ[1],
"disease": disease,
"components": components}
#print('This is gene of circ', circ[0])

Expand Down Expand Up @@ -268,12 +277,21 @@ def process_file(file, assembly: str, file_type, task_id, bias=2):
for i in components:
i['mods'] = ujson.loads(i['mods'])
#print('alter components')
with connection.cursor() as cur:
cur.execute(f'select disease from circ_disease where assembly="{assembly}" and chr_num="{chr_num}" and start>={start-bias} and start<={start+bias} and end<={end+bias} and end>={end-bias};')
disease = cur.fetchall()
if len(disease) == 0:
disease = 'Unknown'
else:
disease = disease[0]

try:
circ_on_gene[gene][1].append({"start": int(circ[1]),
"end": int(circ[2]),
"source": "circDraw_annotated",
"gene": gene,
"transcript": transcript,
"disease": disease,
"components": components})
except:
# get gene info
Expand All @@ -288,6 +306,7 @@ def process_file(file, assembly: str, file_type, task_id, bias=2):
"source": "circDraw_annotated",
"gene": gene,
"transcript": transcript,
"disease": disease,
"components": components}]]
except Exception as e:
print("Add circ error:", e)
Expand Down
14 changes: 14 additions & 0 deletions cirDraw/tools/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ class Meta:
db_table = 'chromosome_length'
managed = False

class circ_disease(models.Model):
"""Store known chromosome length, fixed by existed knowledge."""
id = models.AutoField(primary_key=True)
assembly = models.CharField(max_length=100)
chr_num = models.CharField(max_length=50)
start = models.IntegerField()
end = models.IntegerField()
name = models.CharField(max_length=255)
disease = models.CharField(max_length=255)

class Meta:
db_table = 'circ_disease'
managed = False

# Species genome
_assembly = ['hg19', 'hg38', 'rn6', 'danRer11', 'sacCer3', 'mm10']

Expand Down
7 changes: 5 additions & 2 deletions process_watchdog/resetdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ 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]})
if exceptions != '':
operator.clean_table(t, {'md5': ['!=', exceptions]})
else:
operator.clean_table(t)
print('Exception drop Success in ', t)
operator.terminate()

Expand Down Expand Up @@ -142,7 +145,7 @@ def main(login_file_name, inp):

elif inp == "clean":
clean_box = ['tools_species_circrnas', 'tools_species_genome_exons_introns', 'tools_species_genome_genes', 'tools_species_genome_transcripts']
example_md5 = '8bd10a77cbda74ed2513d2643a39b0bb'
example_md5 = ''#'8bd10a77cbda74ed2513d2643a39b0bb'
path_box = ["../cirDraw/media/md5_data/"]
empty_db(connector, clean_box)
empty_dir(path_box)
Expand Down
2 changes: 1 addition & 1 deletion related_genome_info/process_pkg/mysqlconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def create_table_core(self, table_name, table_columns):


# auto-clean
def autoclean(self, timenow):
#def autoclean(self, timenow):



Expand Down

0 comments on commit 497d832

Please sign in to comment.