Skip to content

Commit

Permalink
Merge pull request #45 from opentargets/rm-genetics-add-sqtl
Browse files Browse the repository at this point in the history
remove phenotypeid
  • Loading branch information
remo87 authored Aug 18, 2022
2 parents af4f2a4 + 6c8bc87 commit eebfe68
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import { tissueComparator } from './utils';

const getTissueColumns = (data, uniqueTissues) => {
const tissueThresholdValue = 7;
const [minVal, maxVal] = extent(data, (d) => d.log2h4h3);
const [minVal, maxVal] = extent(data, d => d.log2h4h3);
const absMax = Math.min(
tissueThresholdValue,
Math.max(Math.abs(minVal), maxVal)
);
const radiusScale = scaleSqrt().domain([0, absMax]).range([0, 6]);
return uniqueTissues
.sort((a, b) => ascending(a.name, b.name))
.map((t) => ({
.map(t => ({
id: t.id,
label: t.name,
verticalHeader: true,
comparator: tissueComparator(t.id),
renderCell: (row) => {
renderCell: row => {
if (!row[t.id]) {
// no comparison made for this gene-tissue pair
return null;
Expand Down Expand Up @@ -55,11 +55,13 @@ export const getTableColumns = (data, uniqueTissues) => {
id: 'gene.symbol',
label: 'Gene',
comparator: (a, b) => ascending(a.gene.symbol, b.gene.symbol),
renderCell: (d) => <Link to={`/gene/${d.gene.id}`}>{d.gene.symbol}</Link>,
renderCell: d => <Link to={`/gene/${d.gene.id}`}>{d.gene.symbol}</Link>,
};
const phenotypeIdColumn = {
id: 'phenotypeId',
id: 'gene.id',
label: 'Molecular trait',
comparator: (a, b) => ascending(a.gene.id, b.gene.id),
renderCell: d => <span>{d.gene.id}</span>,
};
const studyColumn = {
id: 'qtlStudyName',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { descending } from 'd3';
import { getPhenotypeId, getSpliceId } from './utils';

export const useColocTable = (data) => {
export const useColocTable = data => {
const uniqueStudyGenePhenotypes = data.reduce((acc, d) => {
const { phenotypeId, gene, qtlStudyName } = d;
acc[`${qtlStudyName}__${gene.id}__${phenotypeId}`] = {
acc[`${qtlStudyName}__${gene.id}`] = {
phenotypeId: getPhenotypeId(phenotypeId),
gene,
qtlStudyName,
Expand All @@ -29,13 +29,12 @@ export const useColocTable = (data) => {
...uniqueTissues.reduce((acc, t) => {
const items = data
.filter(
(d) =>
getPhenotypeId(d.phenotypeId) === phenotypeId &&
d =>
d.gene.id === gene.id &&
d.qtlStudyName === qtlStudyName &&
d.tissue.id === t.id
)
.map((d) => ({
.map(d => ({
h3: d.h3,
h4: d.h4,
log2h4h3: d.log2h4h3,
Expand Down

0 comments on commit eebfe68

Please sign in to comment.