Reload VCF - sample order switched
- Dominant language
- Python
- Stars
- 30
- Forks
- 3
- Avg merge
- 9h 28m
- Merged PRs (30d)
- 42
Description
In current SA Path code - we reloaded a VCF in place where an extra sample had been added
This caused a different packed field index for sample sample name:
```
for i, sample_name in enumerate(sample_names):
sample = vcf.samples_by_vcf_name[sample_name]
logging.info("Creating cohort sample for: %s", sample)
CohortSample.objects.get_or_create(cohort=cohort,
sample=sample,
defaults={
"cohort_genotype_packed_field_index": i,
"sort_order": i,
})
```
Then died with:
```
Error: duplicate key value violates unique constraint "snpdb_cohortsample_cohort_id_cohort_genotyp_b2c4ac43_uniq" DETAIL: Key (cohort_id, cohort_genotype_packed_field_index)=(6057, 0) already exists. ."
```
Maybe a hack would be to set the index super high with:
```
qs.update(cohort_genotype_packed_field_index=F"(cohort_genotype_packed_field_index")+1000)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.