Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cosy-Bio
Drugst.One
backend
Commits
97b03703
Commit
97b03703
authored
2 years ago
by
AndiMajore
Browse files
Options
Downloads
Patches
Plain Diff
commented out depricated functions
Former-commit-id:
65460ef4
parent
5dfd5092
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drugstone/management/includes/DataPopulator.py
+49
-49
49 additions, 49 deletions
drugstone/management/includes/DataPopulator.py
with
49 additions
and
49 deletions
drugstone/management/includes/DataPopulator.py
+
49
−
49
View file @
97b03703
...
...
@@ -31,55 +31,55 @@ class DataPopulator:
for
disorder
in
models
.
Disorder
.
objects
.
all
():
self
.
disorders
[
disorder
.
mondo_id
]
=
disorder
def
populate_proteins
(
self
)
->
int
:
"""
Populates the Protein table in the django database.
Handles loading the data and passing it to the django database
Returns:
int: Count of how many proteins were added
"""
df
=
DataLoader
.
load_proteins
()
for
_
,
row
in
df
.
iterrows
():
self
.
proteins
[
row
[
'
entrez_id
'
]]
=
models
.
Protein
(
uniprot_code
=
row
[
'
protein_ac
'
],
gene
=
row
[
'
gene_name
'
],
entrez
=
row
[
'
entrez_id
'
],
protein_name
=
row
[
'
protein_name
'
])
self
.
uniprot_to_ensembl
[
row
[
'
protein_ac
'
]]
=
row
[
'
entrez_id
'
]
self
.
gene_name_to_ensembl
[
row
[
'
gene_name
'
]].
add
(
row
[
'
entrez_id
'
])
models
.
Protein
.
objects
.
bulk_create
(
self
.
proteins
.
values
())
return
len
(
self
.
proteins
)
def
populate_disorders
(
self
)
->
int
:
"""
Populates the Disorder table in the django database.
Handles loading the data and passing it to the django database
Returns:
int: Count of how many disorders were added
"""
df
=
DataLoader
.
load_disorders
()
for
_
,
row
in
df
.
iterrows
():
self
.
disorders
[
row
[
'
mondo_id
'
]]
=
models
.
Disorder
(
mondo_id
=
row
[
'
mondo_id
'
],
label
=
row
[
'
label
'
],
icd10
=
row
[
'
icd10
'
]
)
models
.
Disorder
.
objects
.
bulk_create
(
self
.
disorders
.
values
())
return
len
(
self
.
disorders
)
def
populate_drugs
(
self
):
df
=
DataLoader
.
load_drugs
()
for
_
,
row
in
df
.
iterrows
():
drug_id
=
row
[
'
drug_id
'
]
drug_name
=
row
[
'
drug_name
'
]
drug_status
=
row
[
'
drug_status
'
]
self
.
drugs
[
drug_id
]
=
models
.
Drug
(
drug_id
=
drug_id
,
name
=
drug_name
,
status
=
drug_status
)
models
.
Drug
.
objects
.
bulk_create
(
self
.
drugs
.
values
())
return
len
(
self
.
drugs
)
#
def populate_proteins(self) -> int:
#
""" Populates the Protein table in the django database.
#
Handles loading the data and passing it to the django database
#
#
Returns:
#
int: Count of how many proteins were added
#
"""
#
df = DataLoader.load_proteins()
#
for _, row in df.iterrows():
#
self.proteins[row['entrez_id']] = models.Protein(
#
uniprot_code=row['protein_ac'],
#
gene=row['gene_name'],
#
entrez=row['entrez_id'],
#
protein_name=row['protein_name'])
#
self.uniprot_to_ensembl[row['protein_ac']] = row['entrez_id']
#
self.gene_name_to_ensembl[row['gene_name']].add(row['entrez_id'])
#
#
models.Protein.objects.bulk_create(self.proteins.values())
#
return len(self.proteins)
#
#
def populate_disorders(self) -> int:
#
""" Populates the Disorder table in the django database.
#
Handles loading the data and passing it to the django database
#
#
Returns:
#
int: Count of how many disorders were added
#
"""
#
df = DataLoader.load_disorders()
#
for _, row in df.iterrows():
#
self.disorders[row['mondo_id']] = models.Disorder(
#
mondo_id=row['mondo_id'],
#
label=row['label'],
#
icd10=row['icd10']
#
)
#
models.Disorder.objects.bulk_create(self.disorders.values())
#
return len(self.disorders)
#
#
def populate_drugs(self):
#
df = DataLoader.load_drugs()
#
for _, row in df.iterrows():
#
drug_id = row['drug_id']
#
drug_name = row['drug_name']
#
drug_status = row['drug_status']
#
self.drugs[drug_id] = models.Drug(
#
drug_id=drug_id,
#
name=drug_name,
#
status=drug_status)
#
models.Drug.objects.bulk_create(self.drugs.values())
#
return len(self.drugs)
def
populate_expessions
(
self
):
self
.
init_proteins
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment