Skip to content

Commit

Permalink
Merge pull request #226 from bcgsc/feature/DEVSU-1886-update-kbMatche…
Browse files Browse the repository at this point in the history
…s-enum

feature/DEVSU-1886-update-kbMatches
  • Loading branch information
Nithriel authored Feb 10, 2023
2 parents 0ea1d87 + eb9337a commit 412cdd5
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
mut: 'smallMutations',
exp: 'expressionVariants',
protein: 'proteinVariants',
msi: 'msi',
},
KB_PIVOT_COLUMN: 'variantType',
GENE_LINKED_VARIANT_MODELS: [
Expand Down
20 changes: 10 additions & 10 deletions app/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@ analysisReports.hasMany(immuneCellTypes, {
as: 'immuneCellTypes', foreignKey: 'reportId', onDelete: 'CASCADE', constraints: true,
});

// MSI
const msi = require('./reports/msi')(sequelize, Sq);

analysisReports.hasMany(msi, {
as: 'msi', foreignKey: 'reportId', targetKey: 'id', onDelete: 'CASCADE', constraints: true,
});
msi.belongsTo(analysisReports, {
as: 'report', foreignKey: 'reportId', targetKey: 'id', onDelete: 'CASCADE', constraints: true,
});

// Copy Number Analysis
const copyVariants = require('./reports/copyVariants')(sequelize, Sq);

Expand Down Expand Up @@ -441,16 +451,6 @@ comparators.belongsTo(analysisReports, {
as: 'report', foreignKey: 'reportId', targetKey: 'id', onDelete: 'CASCADE', constraints: true,
});

// MSI
const msi = require('./reports/msi')(sequelize, Sq);

analysisReports.hasMany(msi, {
as: 'msi', foreignKey: 'reportId', targetKey: 'id', onDelete: 'CASCADE', constraints: true,
});
msi.belongsTo(analysisReports, {
as: 'report', foreignKey: 'reportId', targetKey: 'id', onDelete: 'CASCADE', constraints: true,
});

// Images
const image = require('./image')(sequelize, Sq);

Expand Down
5 changes: 5 additions & 0 deletions app/models/reports/msi.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ module.exports = (sequelize, Sq) => {
exclude: ['id', 'reportId', 'deletedAt', 'updatedBy'],
},
},
extended: {
attributes: {
exclude: ['id', 'reportId', 'deletedAt', 'updatedBy'],
},
},
},
});

Expand Down
11 changes: 11 additions & 0 deletions app/schemas/report/reportUpload/variant.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ const generateVariantUploadSchemas = (isJsonSchema) => {
});
});

variantSchemas.msi = schemaGenerator(db.models.msi, {
isJsonSchema,
baseUri: UPLOAD_BASE_URI,
properties: {
key: {
type: 'string', description: 'Unique identifier for this variant within this section used to link it to kb-matches',
},
},
isSubSchema: true,
});

return variantSchemas;
};

Expand Down
9 changes: 9 additions & 0 deletions migrations/20230208194424-DEVSU-1886-update-kbMatches-enum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
up: async (queryInterface) => {
queryInterface.sequelize.query('ALTER TYPE enum_reports_kb_matches_variant_type ADD VALUE \'msi\'');
},

down: async () => {
throw new Error('Not Implemented!');
},
};
23 changes: 22 additions & 1 deletion test/testData/mockReportData.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,26 @@
"externalSource": "CIViC",
"externalStatementId": "1234",
"reviewStatus": "pending"
},
{
"category": "cancer predisposition",
"variantType": "msi",
"variant": "msi",
"kbVariant": "protein increased expression",
"disease": "colorectal cancer",
"relevance": "unfavourable",
"context": "lower overall survival",
"status": "na",
"reference": "12345678#",
"sample": "UPLOADPAT01-FFPE-1; UPLOADPAT01-FFPE-1_trans",
"evidenceLevel": "reported",
"matchedCancer": false,
"pmidRef": "yes",
"kbStatementId": "prognostic_unfavourable_lower overall survival_(ELV-PROT_ZNF703_increased expression,True,ns)_colorectal cancer_reported_pubmed_25017610",
"inferred": false,
"externalSource": "CIViC",
"externalStatementId": "1234",
"reviewStatus": "pending"
}
],
"genes": [
Expand Down Expand Up @@ -415,7 +435,8 @@
"msi": [
{
"score": 19.5,
"kbCategory": "moderate"
"kbCategory": "moderate",
"key": "msi"
}
],
"project": "TEST",
Expand Down

0 comments on commit 412cdd5

Please sign in to comment.