phenopolis / phenopolis_genomics_browser

Python API and React frontend for the Phenopolis Genomics Browser
https://dev-live.phenopolis.org
MIT License
31 stars 2 forks source link

OLD SCHEMA - observed_features cannot be empty #331

Closed alanwilter closed 3 years ago

alanwilter commented 3 years ago

Why?: Script scripts/migrate_individuals.sh uses public.individuals.observed_features, this column cannot ever been empty, it must, at least, contains HP:0000001

Check:

select internal_id
from public.individuals i
where i.observed_features = '' ;

Solution: Only PH00002126 failed.

update public.individuals set observed_features = (
    select string_agg(DISTINCT t.hpo_id , ',' ORDER BY t.hpo_id) AS hpo_ids from hpo.term t 
    where t."name" = any(string_to_array((select observed_features_names from public.individuals i where i.internal_id = 'PH00002126'),';'))
),
simplified_observed_features = (
    select string_agg(DISTINCT t.hpo_id , ',' ORDER BY t.hpo_id) AS hpo_ids from hpo.term t 
    where t."name" = any(string_to_array((select observed_features_names from public.individuals i where i.internal_id = 'PH00002126'),';'))
)
where internal_id = 'PH00002126'
;
alanwilter commented 3 years ago

Fixed in Dev_DB on 02/Apr/21, yet to be done in Prod_DB.