-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataviz.py
44 lines (40 loc) · 1.77 KB
/
dataviz.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
from BioSQL import BioSeqDatabase
from dir_mana import dir_mana
from lister import Lister
home = os.getcwd()
project = "GPCR-Orthologs-Project"
user = "Work"
where = dir_mana(home, project)
# Use lister() class here so that we can easily access our Master RNA Accession File
what = Lister('MAFV3.1.csv') # Always make sure this file name is correct
# genes = '%s' % genes.r_repr().rstrip('\n')
arg_string1 = 'gene'
db_list = []
for gene in what.master_gene_list:
arg_string1 += (' %s' % gene)
arg_string2 = 'org'
for org in what.org_list:
arg_string2 += (' %s' % org)
for file in os.listdir('/srv/shiny-server/GPCR-Orthologs-Project/CODE/1_Databases/Vallender Data/'):
if '.db' in str(file):
db_list.append(file)
for db_name in db_list:
server = BioSeqDatabase.open_database(driver='sqlite3', db='/srv/shiny-server/GPCR-Orthologs-Project/CODE/1_Databases/Vallender Data/%s' % db_name)
for sub_db_name in server.keys():
db = server[sub_db_name]
Accession = str(what.A_Get1['HTR1A']['Homo_sapiens'])
Accession, Sup, Version = Accession.partition('.')
Accession = Accession.upper()
try:
record = db.lookup(accession=Accession)
with open('/srv/shiny-server/GPCR-Orthologs-Project/CODE/1_Databases/Vallender Data/HTR1A_Homo_sapiens.gbk', 'w') as GB_file:
GB_file.write(record.format('genbank'))
print(GB_file.name, 'created')
server_flag = True
except IndexError:
continue
os.system('Rscript /srv/shiny-server/GPCR-Orthologs-Project/CODE/Lib/web.R %s %s'
% (arg_string1, arg_string2))
#//TODO-ROB Add code that takes the features and turns them into actual sequence data
#//TODO-ROB Add code that breaks up the annotation attribute