Skip to content

Commit

Permalink
Changes to cosmic signatures handling
Browse files Browse the repository at this point in the history
mathieulemieux committed Oct 23, 2024
1 parent 8830a26 commit ca1337e
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions src/moa/index.js
Original file line number Diff line number Diff line change
@@ -256,36 +256,45 @@ const loadVariant = async (conn, moaVariant) => {
});
}
} else if (moaVariant.feature_type === 'mutational_signature') {
const signature = await conn.getUniqueRecordBy({
filters: {
AND: [
{ source: { filters: { name: 'cosmic' }, target: 'Source' } },
{ sourceId: moaVariant.cosmic_signature },
{ sourceIdVersion: '3' },
],
},
target: 'Signature',
});
const variantType = await conn.getVocabularyTerm('high signature');

// Cosmic signature
let signature = {};
try {

Check failure on line 261 in src/moa/index.js

GitHub Actions / node-12

Expected blank line before this statement

Check failure on line 261 in src/moa/index.js

GitHub Actions / node-14

Expected blank line before this statement

Check failure on line 261 in src/moa/index.js

GitHub Actions / node-16

Expected blank line before this statement
const record = await conn.getUniqueRecordBy({
filters: { AND: [{ reference1: rid(signature) }, { type: rid(variantType) }] },
target: 'CategoryVariant',
});
return await conn.updateRecord('CategoryVariant', record['@rid'], {
displayName: `${signature.name.toUpperCase()} high signature`,
signature = await conn.getUniqueRecordBy({
target: 'Signature',
filters: {
AND: [
{
source: {
target: 'Source',
filters: { name: 'cosmic' },
},
},
{ sourceId: moaVariant.cosmic_signature },
{ sourceIdVersion: '3' },
],
},
});
} catch (err) {
return conn.addVariant({
} catch(err) {

Check failure on line 277 in src/moa/index.js

GitHub Actions / node-12

Expected space(s) after "catch"

Check failure on line 277 in src/moa/index.js

GitHub Actions / node-14

Expected space(s) after "catch"

Check failure on line 277 in src/moa/index.js

GitHub Actions / node-16

Expected space(s) after "catch"
// Enforcing usage of v3 Cosmic signatures
throw Error(`Missing Cosmic signature ${moaVariant.cosmic_signature}`);
}

// 'high signature' variant type (prefered over 'signature present')
const variantType = await conn.getVocabularyTerm('high signature');

Check failure on line 284 in src/moa/index.js

GitHub Actions / node-12

Trailing spaces not allowed

Check failure on line 284 in src/moa/index.js

GitHub Actions / node-14

Trailing spaces not allowed

Check failure on line 284 in src/moa/index.js

GitHub Actions / node-16

Trailing spaces not allowed

Check failure on line 285 in src/moa/index.js

GitHub Actions / node-12

Trailing spaces not allowed

Check failure on line 285 in src/moa/index.js

GitHub Actions / node-14

Trailing spaces not allowed

Check failure on line 285 in src/moa/index.js

GitHub Actions / node-16

Trailing spaces not allowed
// Corresponding 'high signature' CategoryVariant
try {
return await conn.addVariant({
content: {
displayName: `${signature.name.toUpperCase()} high signature`,
reference1: rid(signature),
type: rid(variantType),
},
existsOk: true,
target: 'CategoryVariant',
});
} catch (err) {
throw Error(`Unable to add variant for Cosmic signature ${moaVariant.cosmic_signature}`);
}
// } else if (moaVariant.feature_type === 'mutational_burden') {
} else if (moaVariant.feature_type === 'copy_number') {

0 comments on commit ca1337e

Please sign in to comment.