Skip to content

Commit

Permalink
feat: add ucsc browser column (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterckx committed Aug 31, 2024
1 parent d1d917b commit 9f127bc
Show file tree
Hide file tree
Showing 8 changed files with 830 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export interface BRCDataCatalogGenome {
species: string;
strain: string;
supercontigs: number;
ucscBrowserUrl: string | null;
vEuPathDbProject: string;
}
1 change: 1 addition & 0 deletions data-catalog/app/components/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { Link } from "@databiosphere/findable-ui/lib/components/Links/components/Link/link";
export { BasicCell } from "@databiosphere/findable-ui/lib/components/Table/components/TableCell/components/BasicCell/basicCell";
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@ export const buildSupercontigs = (
};
};

/**
* Build props for the UCSC browser URL cell.
* @param genome - Genome entity.
* @returns Props to be used for the cell.
*/
export const buildUcscBrowserUrl = (
genome: BRCDataCatalogGenome
): React.ComponentProps<typeof C.Link> => {
return genome.ucscBrowserUrl
? {
label: "UCSC Browser",
url: genome.ucscBrowserUrl,
}
: {
label: "Unspecified",
url: "",
};
};

/**
* Build props for the VEuPathDB project cell.
* @param genome - Genome entity.
Expand Down
5 changes: 5 additions & 0 deletions data-catalog/files/build-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function buildGenomes(): Promise<BRCDataCatalogGenome[]> {
species: row.Species,
strain: row.Strain,
supercontigs: parseNumber(row.Supercontigs),
ucscBrowserUrl: parseStringOrNull(row.ucscBrowser),
vEuPathDbProject: row["VEuPathDB Project"],
})
);
Expand All @@ -51,6 +52,10 @@ async function saveJson(filePath: string, data: unknown): Promise<void> {
await fsp.writeFile(filePath, JSON.stringify(data, undefined, 2) + "\n");
}

function parseStringOrNull(value: string): string | null {
return value || null;
}

function parseNumber(value: string): number {
value = value.trim();
const n = Number(value);
Expand Down
8 changes: 8 additions & 0 deletions data-catalog/files/entities.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
export interface SourceGenome {
asmId: string;
Chromosomes: string;
comName: string;
Contigs: string;
genBank: string;
"Genome Source": string;
"Genome Version/Assembly ID": string;
identical: string;
"Is Reference Strain": string;
Organism: string;
refSeq: string;
sciName: string;
Species: string;
Strain: string;
Supercontigs: string;
taxId: string;
ucscBrowser: string;
"VEuPathDB Project": string;
}
Loading

0 comments on commit 9f127bc

Please sign in to comment.