Skip to content

Commit

Permalink
Update schema for donor metadata (#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-klum authored Jul 1, 2024
1 parent 985e48c commit 973358d
Show file tree
Hide file tree
Showing 28 changed files with 519 additions and 233 deletions.
10 changes: 6 additions & 4 deletions resources/queries/cds/MAbMixMAbMeta.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ SELECT
mab_hxb2_location,
mab_ab_binding_type,
mab_isotype,
mab_donorid,
mab_donor_species,
mab_donor_clade
mabmeta.donor_id AS mab_donorid,
-- donor meta
donormeta.donor_species AS mab_donor_species,
donormeta.donor_clade AS mab_donor_clade

FROM MAbMix mix

LEFT JOIN MAbMixMetadata mixmeta ON mix.mab_mix_id = mixmeta.mab_mix_id
LEFT JOIN MAbMetadata mabmeta ON mix.mab_id = mabmeta.mab_id
LEFT JOIN MAbMetadata mabmeta ON mix.mab_id = mabmeta.mab_id
LEFT JOIN donor_metadata donormeta ON mabmeta.donor_id = donormeta.donor_id
10 changes: 6 additions & 4 deletions resources/queries/cds/MAbMixMAbMetaForLearnExport.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ SELECT
mab_hxb2_location,
mab_ab_binding_type,
mab_isotype,
mab_donorid,
mab_donor_species,
mab_donor_clade
mabmeta.donor_id AS mab_donorid,
-- donor meta
donormeta.donor_species AS mab_donor_species,
donormeta.donor_clade AS mab_donor_clade

FROM MAbMix mix

LEFT JOIN MAbMixMetadata mixmeta ON mix.mab_mix_id = mixmeta.mab_mix_id
LEFT JOIN MAbMetadata mabmeta ON mix.mab_id = mabmeta.mab_id
LEFT JOIN MAbMetadata mabmeta ON mix.mab_id = mabmeta.mab_id
LEFT JOIN donor_metadata donormeta ON mabmeta.donor_id = donormeta.donor_id
4 changes: 2 additions & 2 deletions resources/queries/cds/alignment_mab_metadata.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SELECT *
FROM cds.alignment a
INNER JOIN cds.antibody_sequence aseq ON a.sequence_id = aseq.sequence_id
INNER JOIN cds.MAbMetadata mm ON aseq.mab_id = mm.mab_id
INNER JOIN cds.donor_mab_sequence dseq ON a.sequence_id = dseq.sequence_id
INNER JOIN cds.MAbMetadata mm ON dseq.mab_id = mm.mab_id
11 changes: 0 additions & 11 deletions resources/queries/cds/antibody_sequence_header_source.sql

This file was deleted.

4 changes: 4 additions & 0 deletions resources/queries/cds/donor_mab.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT DISTINCT dms.mab_id,
dms.donor_id
FROM donor_mab_sequence AS dms
WHERE dms.donor_id IS NOT NULL
3 changes: 3 additions & 0 deletions resources/queries/cds/donor_mab_sequence_alignment.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SELECT *
FROM alignment ali
JOIN donor_mab_sequence AS dms ON dms.sequence_id = ali.sequence_id
12 changes: 12 additions & 0 deletions resources/queries/cds/donor_mab_sequence_germline.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SELECT dms.mab_id,
dms.donor_id,
sgl.sequence_id,
sgl.allele,
sgl.percent_identity,
sgl.matches,
sgl.alignment_length,
sgl.score,
sgl.container,
sgl.run_application
FROM sequence_germline AS sgl
JOIN donor_mab_sequence AS dms ON dms.sequence_id = sgl.sequence_id
15 changes: 15 additions & 0 deletions resources/queries/cds/donor_mab_sequence_header_source.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SELECT seq.sequence_id,
dms.mab_id,
dms.donor_id,
mab.mab_name_std,
don.donor_code,
sqh.header,
src.source,
seq.sequence_aa,
seq.sequence_nt
FROM sequence seq
JOIN donor_mab_sequence AS dms ON dms.sequence_id = seq.sequence_id
JOIN sequence_header AS sqh ON sqh.sequence_id = seq.sequence_id
JOIN header_source AS src ON src.source_id = sqh.source_id
LEFT JOIN mabMetadata AS mab ON mab.mab_id = dms.mab_id
LEFT JOIN donor_metadata AS don ON don.donor_id = dms.donor_id
5 changes: 3 additions & 2 deletions resources/queries/cds/ds_mabmetasummary.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ SELECT
mabmeta.mab_hxb2_location,
mabmeta.mab_ab_binding_type,
mabmeta.mab_isotype,
mabmeta.mab_donor_species
donormeta.donor_species AS mab_donor_species

FROM cds.MAbMix mix
JOIN cds.MAbMixMetadata mixmeta ON (mixmeta.container = mix.container AND mixmeta.mab_mix_id = mix.mab_mix_id)
JOIN cds.MAbMetadata mabmeta ON (mabmeta.container = mix.container AND mabmeta.mab_id = mix.mab_id)
JOIN cds.MAbMetadata mabmeta ON (mabmeta.container = mix.container AND mabmeta.mab_id = mix.mab_id)
LEFT JOIN cds.donor_metadata donormeta ON (donormeta.container = mix.container AND donormeta.donor_id = mabmeta.donor_id)
98 changes: 0 additions & 98 deletions resources/queries/cds/lineage_alignment.sql

This file was deleted.

14 changes: 0 additions & 14 deletions resources/queries/cds/lineage_sequence_germline.sql

This file was deleted.

4 changes: 2 additions & 2 deletions resources/queries/cds/sequence_germline_mab_metadata.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SELECT *
FROM cds.sequence_germline sg
INNER JOIN cds.antibody_sequence aseq ON sg.sequence_id = aseq.sequence_id
INNER JOIN cds.MAbMetadata mm ON aseq.mab_id = mm.mab_id
INNER JOIN cds.donor_mab_sequence dseq ON sg.sequence_id = dseq.sequence_id
INNER JOIN cds.MAbMetadata mm ON dseq.mab_id = mm.mab_id
74 changes: 60 additions & 14 deletions resources/schemas/cds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -764,14 +764,13 @@
<column columnName="mab_isotype">
<description>A classification indicating the type of the antibody.</description>
</column>
<column columnName="mab_donorid">
<column columnName="donor_id">
<description>Unique ID assigned to the donor of the mab.</description>
</column>
<column columnName="mab_donor_species">
<description>The species of the donor of the mab. The species in which the immune response was stimulated.</description>
</column>
<column columnName="mab_donor_clade">
<description>The clade of the virus strain (subtype) that infected the donor.</description>
<fk>
<fkDbSchema>cds</fkDbSchema>
<fkTable>donor_metadata</fkTable>
<fkColumnName>donor_id</fkColumnName>
</fk>
</column>
<column columnName="mab_class_id">
<description>A reference ID to the `antibody_class` table, which indicates the class of the antibody.</description>
Expand Down Expand Up @@ -1801,6 +1800,8 @@
<column columnName="sequence_nt">
<description>The sequence as nucleotides.</description>
</column>
<column columnName="sequence_aa"/>
<column columnName="chain"/>
<column columnName="container"/>
</columns>
</table>
Expand Down Expand Up @@ -1871,8 +1872,10 @@
<column columnName="container"/>
</columns>
</table>
<table tableName="antibody_sequence" tableDbType="TABLE">
<table tableName="donor_mab_sequence" tableDbType="TABLE">
<columns>
<column columnName="row_id"/>
<column columnName="container"/>
<column columnName="mab_id">
<description>The CDS mAb ID.</description>
<fk>
Expand All @@ -1883,11 +1886,19 @@
</column>
<column columnName="sequence_id">
<description>The sequence ID associated with a given mAB ID and chain.</description>
<fk>
<fkDbSchema>cds</fkDbSchema>
<fkTable>sequence</fkTable>
<fkColumnName>sequence_id</fkColumnName>
</fk>
</column>
<column columnName="lineage">
<description>True if the sequence is a lineage sequence.</description>
<column columnName="donor_id">
<fk>
<fkDbSchema>cds</fkDbSchema>
<fkTable>donor_metadata</fkTable>
<fkColumnName>donor_id</fkColumnName>
</fk>
</column>
<column columnName="container"/>
</columns>
</table>
<table tableName="alignment" tableDbType="TABLE">
Expand All @@ -1896,9 +1907,6 @@
<column columnName="sequence_id">
<description>The CDS sequence ID.</description>
</column>
<column columnName="locus">
<description>Gene locus (chain type). Note that this field uses a controlled vocabulary that is meant to provide a generic classification of the locus, not necessarily the correct designation according to a specific nomenclature.</description>
</column>
<column columnName="stop_codon">
<description>True if the aligned sequence contains a stop codon.</description>
</column>
Expand Down Expand Up @@ -2221,4 +2229,42 @@
<column columnName="container"/>
</columns>
</table>
<table tableName="donor_metadata" tableDbType="TABLE">
<columns>
<column columnName="donor_id"/>
<column columnName="donor_lanl_id"/>
<column columnName="donor_code"/>
<column columnName="donor_species"/>
<column columnName="donor_clade"/>
<column columnName="container"/>
</columns>
</table>
<table tableName="pab_sequence" tableDbType="TABLE">
<columns>
<column columnName="pab_id"/>
<column columnName="sequence_id"/>
<column columnName="container"/>
</columns>
</table>
<table tableName="pab_sequence_study" tableDbType="TABLE">
<columns>
<column columnName="row_id"/>
<column columnName="prot"/>
<column columnName="subject_id"/>
<column columnName="study_day"/>
<column columnName="specimen_type"/>
<column columnName="pab_id"/>
<column columnName="lab_code"/>
<column columnName="seq_method"/>
<column columnName="assay_identifier"/>
<column columnName="container"/>
</columns>
</table>
<table tableName="antibody_structure" tableDbType="TABLE">
<columns>
<column columnName="structure_id"/>
<column columnName="mab_id"/>
<column columnName="container"/>
</columns>
</table>
</tables>
Loading

0 comments on commit 973358d

Please sign in to comment.