UofS-Pulse-Binfo/genotypes_loader

Bug: cannot insert genotype

laceysanderson opened this issue · 2 comments

When loading genotypes I see the following errors:

$ drush load-genotypes ***.vcf ***samples.txt --marker-type="genetic_marker" --variant-type="sequence_variant" --organism="Lens culinaris" --project-name="AGILE: Application of Genomic Innovation in the Lentil Economy" --ndgeolocation="here"
WD tripal_chado: chado_insert_record; Cannot insert duplicate record into genotype table: Array              [error]
(   
    [name] => GG
    [uniquename] => GG
    [description] => GG
    [type_id] => 1159
)

ERROR (TRIPAL_CHADO): chado_insert_record; Cannot insert duplicate record into genotype table: Array
(   
    [name] => GG
    [uniquename] => GG
    [description] => GG
    [type_id] => 1159
)

[site http://default] [TRIPAL ERROR] [TRIPAL_CHADO] chado_insert_record; Cannot insert duplicate record into genotype table: Array(    [name] => GG    [uniquename] => GG    [description] => GG    [type_id] => 1159)
Tried to insert "Genotype" but the primary key is returned empty (mode=2). Values: Array                     [error]
(   
    [name] => GG
    [uniquename] => GG
    [description] => GG
    [type_id] => 1159
)

Upon checking my database I see that indeed those genotypes do already exist but with a different type (769). Switching the type fixed the problem.

This is due to using the same type for the genotype.type_id as we do for the variant feature.type_id.

To fix this we need to add the type_id to the select values so that if the genotype exists as a different type it will happily insert it again with our type.

Fixed in previous PRs