Skip to content

Commit

Permalink
update sourceId in CGI loader
Browse files Browse the repository at this point in the history
  • Loading branch information
sshugsc committed Feb 13, 2024
1 parent 3cf72e0 commit e7e0f41
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/cancergenomeinterpreter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const HEADER = {
evidenceLevel: 'Evidence level',
gene: 'Gene',
genomic: 'gDNA',
protein: 'protein',
protein: 'individual_mutation',
relevance: 'Association',
reviewData: 'Curation date',
reviewer: 'Curator',
Expand Down Expand Up @@ -491,24 +491,26 @@ const uploadFile = async ({

const perVariantRows = [];

for (const row of rows) {
for (let index = 0; index < rows.length; index++) {
let match,
protein;
individual_mutation;

Check failure on line 496 in src/cancergenomeinterpreter/index.js

View workflow job for this annotation

GitHub Actions / node-12

Identifier 'individual_mutation' is not in camel case

Check failure on line 496 in src/cancergenomeinterpreter/index.js

View workflow job for this annotation

GitHub Actions / node-14

Identifier 'individual_mutation' is not in camel case

Check failure on line 496 in src/cancergenomeinterpreter/index.js

View workflow job for this annotation

GitHub Actions / node-16

Identifier 'individual_mutation' is not in camel case

if (match = /^(\w+) \(([A-Z0-9*,;]+)\)$/.exec(row.Biomarker)) {
if (match = /^(\w+) \(([A-Z0-9*,;]+)\)$/.exec(rows[index].Biomarker)) {
const mutations = match[2].split(',');

for (const mutation of mutations) {
protein = `${match[1]}:${mutation}`;
for (let i = 0; i < mutations.length; i++) {
individual_mutation = `${match[1]}:${mutations[i]}`;

Check failure on line 502 in src/cancergenomeinterpreter/index.js

View workflow job for this annotation

GitHub Actions / node-12

Identifier 'individual_mutation' is not in camel case

Check failure on line 502 in src/cancergenomeinterpreter/index.js

View workflow job for this annotation

GitHub Actions / node-14

Identifier 'individual_mutation' is not in camel case

Check failure on line 502 in src/cancergenomeinterpreter/index.js

View workflow job for this annotation

GitHub Actions / node-16

Identifier 'individual_mutation' is not in camel case
perVariantRows.push({
...row,
protein,
...rows[i],
individual_mutation,

Check failure on line 505 in src/cancergenomeinterpreter/index.js

View workflow job for this annotation

GitHub Actions / node-12

Identifier 'individual_mutation' is not in camel case

Check failure on line 505 in src/cancergenomeinterpreter/index.js

View workflow job for this annotation

GitHub Actions / node-14

Identifier 'individual_mutation' is not in camel case

Check failure on line 505 in src/cancergenomeinterpreter/index.js

View workflow job for this annotation

GitHub Actions / node-16

Identifier 'individual_mutation' is not in camel case
sourceId: `${index + 1}:${i + 1}`,
});
}
} else {
perVariantRows.push({
...row,
protein: '',
...rows[index],
individual_mutation: '',
sourceId: `${index + 1}`,
});
}
}
Expand All @@ -527,11 +529,10 @@ const uploadFile = async ({
break;
}
const rawRow = perVariantRows[index];
const sourceId = hashRecordToId(rawRow);
logger.info(`processing: ${sourceId} (${index} / ${perVariantRows.length})`);
logger.info(`processing: ${perVariantRows[index].sourceId} (${index} / ${perVariantRows.length})`);
const row = {
_raw: rawRow,
sourceId,
sourceId: perVariantRows[index].sourceId,
...convertRowFields(HEADER, perVariantRows[index]),
};
row.therapy = parseTherapy(row);
Expand Down

0 comments on commit e7e0f41

Please sign in to comment.