Skip to content

Commit

Permalink
chore: gene renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Jan 11, 2024
1 parent 8ed3dbd commit 3bec54c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions models/genes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ const GENE_RENAMES = {
FAM214B: "ATOSB",
BZRAP1: "TSPOAP1",
C19orf60: "REX1BD",
KIAA0100: "BLTP2",
CRAMP1L: "CRAMP1",
TCEB3: "ELOA",
};

export const normalizeGeneName = name => {
const nameNorm = name.replace(/[^a-zA-Z\d]/g, '-');
if (nameNorm in GENE_RENAMES) return GENE_RENAMES[nameNorm];
return nameNorm;
}
export const renameGeneIfNeeded = (name) => {
if (name in GENE_RENAMES) return GENE_RENAMES[name];
return name;
};

export const normalizeGeneName = (name) => {
return renameGeneIfNeeded(name.replace(/[^a-zA-Z\d]/g, '-'));
};

export default {
renameGeneIfNeeded,
normalizeGeneName,
};
2 changes: 1 addition & 1 deletion scripts/import-genes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const parseGene = line => {
const fields = line.trim().split('\t');
return [
Gene.normalizeGeneName(fields[0]), // id
fields[0], // name
Gene.renameGeneIfNeeded(fields[0]), // name
];
};

Expand Down

0 comments on commit 3bec54c

Please sign in to comment.