Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some patches to the DB + a bugfix on a date #78

Merged
merged 4 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion covigator/pipeline/vcf_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _parse_variant_observation(
gene_name=covigator_variant.gene_name,
hgvs_p=covigator_variant.hgvs_p,
hgvs_c=covigator_variant.hgvs_c,
date=sample.first_created,
date=sample.collection_date,
variant_type=covigator_variant.variant_type,
length=self._get_variant_length(variant),
reference_amino_acid=covigator_variant.reference_amino_acid,
Expand Down
29 changes: 29 additions & 0 deletions scripts/sql/20230104_patch_start_end_mutations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@



delete from variant_observation_on where position <= 50;
delete from variant_on where position <= 50;
delete from variant_observation_on where position >= 29804;
delete from variant_on where position >= 29804;

delete from subclonal_variant_observation_on where position <= 50;
delete from subclonal_variant_on where position <= 50;
delete from subclonal_variant_observation_on where position >= 29804;
delete from subclonal_variant_on where position >= 29804;

delete from low_frequency_variant_observation_on where position <= 50;
delete from low_frequency_variant_on where position <= 50;
delete from low_frequency_variant_observation_on where position >= 29804;
delete from low_frequency_variant_on where position >= 29804;

delete from lq_clonal_variant_observation_on where position <= 50;
delete from lq_clonal_variant_on where position <= 50;
delete from lq_clonal_variant_observation_on where position >= 29804;
delete from lq_clonal_variant_on where position >= 29804;

delete from variant_observation_covid19portal_on where position <= 50;
delete from variant_covid19portal_on where position <= 50;
delete from variant_observation_covid19portal_on where position >= 29804;
delete from variant_covid19portal_on where position >= 29804;


11 changes: 11 additions & 0 deletions scripts/sql/20230105_path_collection_date_in_variants.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

-- The date stored in the variant observations tables need to be patched with the collection date from the corresponding sample.

-- patch ENA dataset
update variant_observation_on set date=s.collection_date from sample_ena_on as s where s.run_accession = variant_observation_on.sample;
update subclonal_variant_observation_on set date=s.collection_date from sample_ena_on as s where s.run_accession = subclonal_variant_observation_on.sample;
update low_frequency_variant_observation_on set date=s.collection_date from sample_ena_on as s where s.run_accession = low_frequency_variant_observation_on.sample;
update lq_clonal_variant_observation_on set date=s.collection_date from sample_ena_on as s where s.run_accession = lq_clonal_variant_observation_on.sample;

-- patch COVID19 Data Portal dataset
update variant_observation_covid19portal_on set date=s.collection_date from sample_covid19_portal_on as s where s.run_accession = variant_observation_covid19portal_on.sample;