Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pampa_web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Touzet Hélène
pampa_web
Commits
c3c14414
Commit
c3c14414
authored
1 year ago
by
Flissi Areski
Browse files
Options
Downloads
Patches
Plain Diff
Buf fix on taxonomy tree
parent
172d28ab
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
json_taxo.py
+1
-1
1 addition, 1 deletion
json_taxo.py
postgresql/fill_taxo.py
+7
-6
7 additions, 6 deletions
postgresql/fill_taxo.py
taxonomy_reduced.tsv
+540
-540
540 additions, 540 deletions
taxonomy_reduced.tsv
with
548 additions
and
547 deletions
json_taxo.py
+
1
−
1
View file @
c3c14414
...
...
@@ -33,7 +33,7 @@ def create_json(cur, taxo_path):
json_root
[
"
state
"
]
=
state
# on construit children en ajoutant l'element racine -> taxonId = -1 (root)
add_childs
(
cur
,
json_root
,
-
1
)
add_childs
(
cur
,
json_root
,
89593
)
json_array
.
append
(
json_root
)
#print(json_array)
...
...
This diff is collapsed.
Click to expand it.
postgresql/fill_taxo.py
+
7
−
6
View file @
c3c14414
...
...
@@ -24,7 +24,7 @@ def load_file(path):
print
(
line
)
insert_data
(
line
)
add_root
()
#
add_root()
#re_arrange()
def
insert_data
(
raw
):
...
...
@@ -33,9 +33,10 @@ def insert_data(raw):
commonName
=
raw
[
1
]
scientificName
=
raw
[
2
]
rank
=
raw
[
4
]
if
rank
==
"
no rank
"
:
parentId
=-
1
else
:
#if rank=="no rank":
# parentId=-1
#else:
# parentId=raw[3]
parentId
=
raw
[
3
]
sql
=
"
INSERT INTO taxonomy(taxonid, commonname, scientificname, parent, rank) VALUES(%s,%s,%s,%s,%s)
"
#print(sql)
...
...
@@ -51,7 +52,7 @@ def insert_data(raw):
def
add_root
():
config
=
load_config
()
insert
=
"
INSERT INTO taxonomy(taxonid, commonname) VALUES(%s,%s)
"
update
=
"
UPDATE taxonomy set parent=-1 WHERE rank=
'
no_rank
'"
update
=
"
UPDATE taxonomy set parent=-1 WHERE rank=
'
subphylum
'"
try
:
with
psycopg2
.
connect
(
**
config
)
as
conn
:
with
conn
.
cursor
()
as
cur
:
...
...
This diff is collapsed.
Click to expand it.
taxonomy_reduced.tsv
+
540
−
540
View file @
c3c14414
...
...
@@ -234,7 +234,7 @@ Taxon Id Common name Scientific name Parent Rank
51338 Castor canadensis 10184 species
9376 Soricidae 9362 family
9900 Bison 27592 genus
89593 Craniata
subphylum
89593 Craniata
0
subphylum
41426 Phacochoerus africanus 41425 species
9738 Tursiops 9726 genus
54602 Macaca thibetana 9539 species
...
...
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