Skip to content

Commit

Permalink
fix logic for class assignment based on zscores in biosample activity…
Browse files Browse the repository at this point in the history
… tab
  • Loading branch information
NishiPhalke committed Oct 4, 2024
1 parent b395428 commit 520398d
Show file tree
Hide file tree
Showing 4 changed files with 8,752 additions and 12,336 deletions.
6 changes: 3 additions & 3 deletions screen2.0/src/app/search/_ccredetails/ccredetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const CcreDetails: React.FC<CcreDetailsProps> = ({ accession, region, ass
})].sort((a, b) => a.distanceToTSS - b.distanceToTSS).slice(0, 3)
} : null
}, [dataNearbyAndLinked, region])

console.log("nearest3AndLinkedGenes",nearest3AndLinkedGenes && nearest3AndLinkedGenes.nearbyGenes.sort((a,b)=>a.distanceToTSS-b.distanceToTSS))
//Used to pass genes and their linking method to Gene Expression and RAMPAGE pages
const uniqueGenes: { name: string; linkedBy: string[]; }[] = useMemo(() => {
const uniqueGenes: { name: string; linkedBy: string[]; }[] = [];
Expand Down Expand Up @@ -154,8 +154,8 @@ export const CcreDetails: React.FC<CcreDetailsProps> = ({ accession, region, ass
<Typography variant="h6">{`${region.chrom}:${region.start.toLocaleString("en-US")}-${region.end.toLocaleString("en-US")}`}</Typography>
</Stack>
<Divider sx={{ mb: 2 }} />
{page === 0 &&
<InSpecificBiosamples accession={accession} assembly={assembly} />
{page === 0 && nearest3AndLinkedGenes &&
<InSpecificBiosamples accession={accession} assembly={assembly} distanceToTSS={nearest3AndLinkedGenes.nearbyGenes.sort((a,b)=>a.distanceToTSS-b.distanceToTSS)[0].distanceToTSS}/>
}
{(page === 1 && assembly !== "mm10") &&
(loadingLinkedGenes ?
Expand Down
85 changes: 52 additions & 33 deletions screen2.0/src/app/search/_ccredetails/inspecificbiosample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type cCRERow = {
type InSpecificBiosamplesProps = {
accession: string,
assembly: "GRCh38" | "mm10",
distanceToTSS: number
}


Expand Down Expand Up @@ -166,7 +167,7 @@ const ctAgnosticColumns = () => [
]

//Cache is not working as expected when switching between open cCREs
export const InSpecificBiosamples: React.FC<InSpecificBiosamplesProps> = ({ accession, assembly }) => {
export const InSpecificBiosamples: React.FC<InSpecificBiosamplesProps> = ({ accession, assembly, distanceToTSS }) => {

const { data: data_toptissues, loading: loading_toptissues, error: error_toptissues } = useQuery(TOP_TISSUES,
{
Expand All @@ -190,6 +191,8 @@ export const InSpecificBiosamples: React.FC<InSpecificBiosamplesProps> = ({ acce
)


const distance = distanceToTSS


let partialDataCollection: cCRERow[], coreCollection: cCRERow[], ancillaryCollection: cCRERow[];
if (data_toptissues) {
Expand Down Expand Up @@ -278,44 +281,60 @@ export const InSpecificBiosamples: React.FC<InSpecificBiosamplesProps> = ({ acce
}
})

let igroup = data_toptissues?.cCREQuery[0]?.group


let ccreCts = typedata.map((t) => {
let group = igroup
if (t.dnase <= 1.64 && t.dnase != -11.0) group = "ylowdnase"
if (igroup == "PLS") {
if (t.h3k4me3 > 1.64) group = "PLS"
if (t.h3k27ac > 1.64) group = "pELS"
let group
let tf = data_ccre_tf && data_ccre_tf.getcCRETFQuery.length>0 ? data_ccre_tf.getcCRETFQuery.find(a=> t.ct===a.celltype)?.tf.toString(): undefined

} else {
if (t.h3k27ac > 1.64) {
if (igroup === "pELS") {
group = "pELS"
} else {
group = "dELS"
if(t.dnase != -11.0)
{
if((t.dnase >= 1.64)) {
if(t.h3k4me3 >= 1.64) {
if(distance <= 200) {
group = "PLS" //Promoter-like signatures (promoter) must fall within 200 bp of a TSS and have high chromatin accessibility and H3K4me3 signals.
}
else if((t.h3k27ac < 1.64) && distance > 200) {
group = "CA-H3K4me3" //Chromatin accessibility + H3K4me3 (CA-H3K4me3) have high chromatin accessibility and H3K4me3 signals but low H3K27ac signals and do not fall within 200 bp of a TSS.
}
else if (distance <= 2000 && t.h3k27ac >= 1.64) {
group = "pELS" //Enhancer-like signatures (enhancer) have high chromatin accessibility and H3K27ac signals. Enhancers are further divided into TSS-proximal or distal with a 2 kb distance cutoff.
} else if(distance > 2000 && t.h3k27ac >= 1.64) {
group = "dELS" //Enhancer-like signatures (enhancer) have high chromatin accessibility and H3K27ac signals. Enhancers are further divided into TSS-proximal or distal with a 2 kb distance cutoff.
}
}
else if(t.h3k27ac >= 1.64) {
if(distance <= 2000) {
group ="pELS" //Enhancer-like signatures (enhancer) have high chromatin accessibility and H3K27ac signals. Enhancers are further divided into TSS-proximal or distal with a 2 kb distance cutoff.
} else if(distance > 2000) {
group = "dELS" //Enhancer-like signatures (enhancer) have high chromatin accessibility and H3K27ac signals. Enhancers are further divided into TSS-proximal or distal with a 2 kb distance cutoff.
}
}
else if(t.ctcf >= 1.64) {
group = "CA-CTCF" //Chromatin accessibility + CTCF (CA-CTCF) have high chromatin accessibility and CTCF signals but low H3K4me3 and H3K27ac signals.
}
else if(tf==='1') {
group = "CA-TF" //Chromatin accessibility + transcription factor (CA-TF) have high chromatin accessibility, low H3K4me3, H3K27ac, and CTCF signals and are bound by a transcription factor.
}
else {
group = "CA" //Chromatin accessibility (CA) have high chromatin accessibility, and low H3K4me3, H3K27ac, and CTCF signals.
}
}
}
if (t.h3k4me3 > 1.64) group = "CA-H3K4me3"
}
if (t.ctcf > 1.64) group = "ctcf"
if (-11.0 === t.dnase) group = "zunclassified"
if (t.dnase > 1.64) {
group = "dnase"
if (t.h3k27ac > 1.64) {
if (igroup === "pELS") {
group = "pELS"
} else if(igroup === "PLS") {
group = "PLS"
}
else {
group = "dELS"
else {
if(tf==='1'){
group = "TF" //Transcription factor (TF) have low chromatin accessibility, low H3K4me3, H3K27ac, and CTCF signals and are bound by a transcription factor.
} else {
group = "InActive" //low chromatin accessibility, low H3K4me3, H3K27ac, and CTCF signals and are NOT bound by a transcription factor.
}
}
}
} else {
group = "ylowdnase"
}


else {
group = "noclass" //If not active in DNase, No class assigned
}


console.log(t.celltypename, t.atac, t.dnase,t.h3k27ac,t.h3k4me3,t.ctcf, tf, group)

let type: "core" | "partial" | "ancillary"

type = "ancillary"
Expand Down
4 changes: 2 additions & 2 deletions screen2.0/src/app/search/_ccredetails/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ export const GROUP_COLOR_MAP: Map<string, string> = new Map([
["pELS","Proximal Enhancer:#FFA700"],
["dELS","Distal Enhancer:#FFCD00"],
["PLS","Promoter:#ff0000"],
["ylowdnase","Low DNase:#8c8c8c"],
["zunclassified","zunclassified:#8c8c8c"]
["noclass","noclass:#8c8c8c"],
["InActive","In Active:#8c8c8c"]
])

type Coordinates = {
Expand Down
Loading

0 comments on commit 520398d

Please sign in to comment.