Spaces:
Running
Running
feat(seq-tools): share colored MSA viewer across BLAST job, alignment tool, report, shared and phylo surfaces
Browse files- bioai-platform/frontend/src/app/(dashboard)/analyze/alignment/page.tsx +4 -5
- bioai-platform/frontend/src/app/(dashboard)/jobs/[jobId]/page.tsx +2 -3
- bioai-platform/frontend/src/app/(dashboard)/report/[jobId]/page.tsx +2 -3
- bioai-platform/frontend/src/app/shared/[token]/page.tsx +2 -3
- bioai-platform/frontend/src/components/alignment/AlignmentBlock.tsx +127 -0
- bioai-platform/frontend/src/components/alignment/MSAResultPanel.tsx +4 -103
- bioai-platform/frontend/src/components/phylo/PhyloTreeViewer.tsx +4 -4
bioai-platform/frontend/src/app/(dashboard)/analyze/alignment/page.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import { useAuditTrail } from '@/hooks/useAuditTrail';
|
|
| 11 |
import PhyloTreeViewer from '@/components/phylo/PhyloTreeViewer';
|
| 12 |
import { ConservationTrack } from '@/components/alignment/ConservationTrack';
|
| 13 |
import { AlignmentStatsBar } from '@/components/alignment/AlignmentStatsBar';
|
|
|
|
| 14 |
import { computeAlignmentStats, parseAlignedFasta } from '@/lib/alignment-stats';
|
| 15 |
import { BackButton, CriticalButton, ClaySegmented, FlatTextarea, PageHeader } from '@/components/ui';
|
| 16 |
|
|
@@ -177,11 +178,9 @@ export default function AlignmentPage() {
|
|
| 177 |
<motion.div variants={fadeUp} initial={{ y: 24 }} animate="show" className="space-y-4">
|
| 178 |
<div className="data-card p-5">
|
| 179 |
<h3 className="text-sm font-semibold text-text-primary mb-3">Alignment (FASTA) β {METHOD_LABELS[result.method as AlignmentMethod] ?? result.method ?? 'Clustal Omega'}</h3>
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
</pre>
|
| 184 |
-
</div>
|
| 185 |
|
| 186 |
{result.phylotree && (
|
| 187 |
<div className="data-card p-5">
|
|
|
|
| 11 |
import PhyloTreeViewer from '@/components/phylo/PhyloTreeViewer';
|
| 12 |
import { ConservationTrack } from '@/components/alignment/ConservationTrack';
|
| 13 |
import { AlignmentStatsBar } from '@/components/alignment/AlignmentStatsBar';
|
| 14 |
+
import { AlignmentBlock } from '@/components/alignment/AlignmentBlock';
|
| 15 |
import { computeAlignmentStats, parseAlignedFasta } from '@/lib/alignment-stats';
|
| 16 |
import { BackButton, CriticalButton, ClaySegmented, FlatTextarea, PageHeader } from '@/components/ui';
|
| 17 |
|
|
|
|
| 178 |
<motion.div variants={fadeUp} initial={{ y: 24 }} animate="show" className="space-y-4">
|
| 179 |
<div className="data-card p-5">
|
| 180 |
<h3 className="text-sm font-semibold text-text-primary mb-3">Alignment (FASTA) β {METHOD_LABELS[result.method as AlignmentMethod] ?? result.method ?? 'Clustal Omega'}</h3>
|
| 181 |
+
<AlignmentStatsBar stats={computeAlignmentStats(alignedSeqs)} className="mb-3" />
|
| 182 |
+
<AlignmentBlock alnFasta={result.aln_fasta} className="max-h-80" />
|
| 183 |
+
</div>
|
|
|
|
|
|
|
| 184 |
|
| 185 |
{result.phylotree && (
|
| 186 |
<div className="data-card p-5">
|
bioai-platform/frontend/src/app/(dashboard)/jobs/[jobId]/page.tsx
CHANGED
|
@@ -21,6 +21,7 @@ import { DomainArchitecture } from '@/components/domains/DomainArchitecture';
|
|
| 21 |
import { StringDBViewer } from '@/components/interactions/StringDBViewer';
|
| 22 |
import PhyloTreeViewer from '@/components/phylo/PhyloTreeViewer';
|
| 23 |
import { AlignmentStatsBar } from '@/components/alignment/AlignmentStatsBar';
|
|
|
|
| 24 |
import { computeAlignmentStats, parseAlignedFasta } from '@/lib/alignment-stats';
|
| 25 |
import { SecondaryStructureViewer } from '@/components/structure/SecondaryStructure';
|
| 26 |
import { RamachandranPlot } from '@/components/structure/RamachandranPlot';
|
|
@@ -348,9 +349,7 @@ export default function JobPage() {
|
|
| 348 |
stats={computeAlignmentStats(parseAlignedFasta(context.msa.aln_fasta).seqs)}
|
| 349 |
className="mb-2"
|
| 350 |
/>
|
| 351 |
-
<
|
| 352 |
-
{context.msa.aln_fasta}
|
| 353 |
-
</pre>
|
| 354 |
</motion.div>
|
| 355 |
)}
|
| 356 |
|
|
|
|
| 21 |
import { StringDBViewer } from '@/components/interactions/StringDBViewer';
|
| 22 |
import PhyloTreeViewer from '@/components/phylo/PhyloTreeViewer';
|
| 23 |
import { AlignmentStatsBar } from '@/components/alignment/AlignmentStatsBar';
|
| 24 |
+
import { AlignmentBlock } from '@/components/alignment/AlignmentBlock';
|
| 25 |
import { computeAlignmentStats, parseAlignedFasta } from '@/lib/alignment-stats';
|
| 26 |
import { SecondaryStructureViewer } from '@/components/structure/SecondaryStructure';
|
| 27 |
import { RamachandranPlot } from '@/components/structure/RamachandranPlot';
|
|
|
|
| 349 |
stats={computeAlignmentStats(parseAlignedFasta(context.msa.aln_fasta).seqs)}
|
| 350 |
className="mb-2"
|
| 351 |
/>
|
| 352 |
+
<AlignmentBlock alnFasta={context.msa.aln_fasta} className="max-h-80" />
|
|
|
|
|
|
|
| 353 |
</motion.div>
|
| 354 |
)}
|
| 355 |
|
bioai-platform/frontend/src/app/(dashboard)/report/[jobId]/page.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { ScoreBars } from "@/components/results/ScoreBars";
|
|
| 9 |
import { UniprotPanel } from "@/components/results/UniprotPanel";
|
| 10 |
import PhyloTreeViewer from "@/components/phylo/PhyloTreeViewer";
|
| 11 |
import { AlignmentStatsBar } from "@/components/alignment/AlignmentStatsBar";
|
|
|
|
| 12 |
import { computeAlignmentStats, parseAlignedFasta } from "@/lib/alignment-stats";
|
| 13 |
import type { BlastHitSummary, UniprotSummary } from "@/types/pipeline";
|
| 14 |
import { BackButton } from "@/components/ui";
|
|
@@ -95,9 +96,7 @@ export default function ReportPage() {
|
|
| 95 |
<h2 className="font-semibold text-text-primary mb-2">Multiple Sequence Alignment</h2>
|
| 96 |
<p className="text-xs text-text-muted mb-2">{msaData.sequence_count} sequences aligned</p>
|
| 97 |
<AlignmentStatsBar stats={computeAlignmentStats(parseAlignedFasta(msaData.aln_fasta).seqs)} className="mb-2" />
|
| 98 |
-
<
|
| 99 |
-
{msaData.aln_fasta}
|
| 100 |
-
</pre>
|
| 101 |
</section>
|
| 102 |
)}
|
| 103 |
|
|
|
|
| 9 |
import { UniprotPanel } from "@/components/results/UniprotPanel";
|
| 10 |
import PhyloTreeViewer from "@/components/phylo/PhyloTreeViewer";
|
| 11 |
import { AlignmentStatsBar } from "@/components/alignment/AlignmentStatsBar";
|
| 12 |
+
import { AlignmentBlock } from "@/components/alignment/AlignmentBlock";
|
| 13 |
import { computeAlignmentStats, parseAlignedFasta } from "@/lib/alignment-stats";
|
| 14 |
import type { BlastHitSummary, UniprotSummary } from "@/types/pipeline";
|
| 15 |
import { BackButton } from "@/components/ui";
|
|
|
|
| 96 |
<h2 className="font-semibold text-text-primary mb-2">Multiple Sequence Alignment</h2>
|
| 97 |
<p className="text-xs text-text-muted mb-2">{msaData.sequence_count} sequences aligned</p>
|
| 98 |
<AlignmentStatsBar stats={computeAlignmentStats(parseAlignedFasta(msaData.aln_fasta).seqs)} className="mb-2" />
|
| 99 |
+
<AlignmentBlock alnFasta={msaData.aln_fasta} className="max-h-96" />
|
|
|
|
|
|
|
| 100 |
</section>
|
| 101 |
)}
|
| 102 |
|
bioai-platform/frontend/src/app/shared/[token]/page.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import { AlphaFoldViewer } from '@/components/AlphaFoldViewer';
|
|
| 13 |
import { PathwayEnrichment } from '@/components/results/PathwayEnrichment';
|
| 14 |
import PhyloTreeViewer from "@/components/phylo/PhyloTreeViewer";
|
| 15 |
import { AlignmentStatsBar } from "@/components/alignment/AlignmentStatsBar";
|
|
|
|
| 16 |
import { computeAlignmentStats, parseAlignedFasta } from "@/lib/alignment-stats";
|
| 17 |
import { motion } from 'framer-motion';
|
| 18 |
import { fadeUp, stagger } from '@/lib/animations';
|
|
@@ -102,9 +103,7 @@ export default function SharedResultPage() {
|
|
| 102 |
stats={computeAlignmentStats(parseAlignedFasta(context.msa.aln_fasta).seqs)}
|
| 103 |
className="mb-2"
|
| 104 |
/>
|
| 105 |
-
<
|
| 106 |
-
{context.msa.aln_fasta}
|
| 107 |
-
</pre>
|
| 108 |
</motion.div>
|
| 109 |
)}
|
| 110 |
|
|
|
|
| 13 |
import { PathwayEnrichment } from '@/components/results/PathwayEnrichment';
|
| 14 |
import PhyloTreeViewer from "@/components/phylo/PhyloTreeViewer";
|
| 15 |
import { AlignmentStatsBar } from "@/components/alignment/AlignmentStatsBar";
|
| 16 |
+
import { AlignmentBlock } from "@/components/alignment/AlignmentBlock";
|
| 17 |
import { computeAlignmentStats, parseAlignedFasta } from "@/lib/alignment-stats";
|
| 18 |
import { motion } from 'framer-motion';
|
| 19 |
import { fadeUp, stagger } from '@/lib/animations';
|
|
|
|
| 103 |
stats={computeAlignmentStats(parseAlignedFasta(context.msa.aln_fasta).seqs)}
|
| 104 |
className="mb-2"
|
| 105 |
/>
|
| 106 |
+
<AlignmentBlock alnFasta={context.msa.aln_fasta} className="max-h-80" />
|
|
|
|
|
|
|
| 107 |
</motion.div>
|
| 108 |
)}
|
| 109 |
|
bioai-platform/frontend/src/components/alignment/AlignmentBlock.tsx
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client';
|
| 2 |
+
|
| 3 |
+
import { useMemo } from 'react';
|
| 4 |
+
import { analyzeColumns, parseAlignedFasta } from '@/lib/alignment-stats';
|
| 5 |
+
|
| 6 |
+
const AA_COLORS: Record<string, string> = {
|
| 7 |
+
A: '#8B93D6', C: '#E0A94E', D: '#EF4444', E: '#EF4444',
|
| 8 |
+
F: '#7C3AED', G: '#848CA4', H: '#60A5FA', I: '#7C3AED',
|
| 9 |
+
K: '#2DD4BF', L: '#7C3AED', M: '#E0A94E', N: '#60A5FA',
|
| 10 |
+
P: '#FB923C', Q: '#60A5FA', R: '#2DD4BF', S: '#60A5FA',
|
| 11 |
+
T: '#60A5FA', V: '#7C3AED', W: '#7C3AED', Y: '#7C3AED',
|
| 12 |
+
};
|
| 13 |
+
|
| 14 |
+
function aaColor(ch: string): string {
|
| 15 |
+
if (ch === '-') return 'rgba(132,140,164,0.25)';
|
| 16 |
+
return AA_COLORS[ch.toUpperCase()] ?? 'var(--text-primary)';
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
type CellClass = 'match' | 'mismatch' | 'gap';
|
| 20 |
+
|
| 21 |
+
function cellClass(ch: string, consensus: string): CellClass {
|
| 22 |
+
if (ch === '-' || ch === '.') return 'gap';
|
| 23 |
+
return ch.toUpperCase() === consensus ? 'match' : 'mismatch';
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
const CELL_BG: Record<CellClass, string> = {
|
| 27 |
+
match: 'rgba(45,212,191,0.16)',
|
| 28 |
+
mismatch: 'rgba(239,68,68,0.12)',
|
| 29 |
+
gap: 'rgba(132,140,164,0.08)',
|
| 30 |
+
};
|
| 31 |
+
|
| 32 |
+
function symbolClass(symbol: string): string {
|
| 33 |
+
if (symbol === '*') return 'text-accent-cyan font-bold';
|
| 34 |
+
if (symbol === ':') return 'text-accent-amber';
|
| 35 |
+
if (symbol === '.') return 'text-text-muted/40';
|
| 36 |
+
return 'text-transparent';
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
interface AlignmentBlockProps {
|
| 40 |
+
/** Aligned FASTA text (headers + equal-length gapped sequences). */
|
| 41 |
+
alnFasta: string;
|
| 42 |
+
/** Extra classes for the scroll container (e.g. max-height). */
|
| 43 |
+
className?: string;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Colored MSA grid shared by every alignment surface. Each cell is tinted by
|
| 48 |
+
* its relationship to the column consensus β teal = matched, red = mismatched,
|
| 49 |
+
* gray = gap β with the per-residue chemistry color kept as the foreground and
|
| 50 |
+
* a CLUSTAL-style consensus row (* : .) beneath the sequences.
|
| 51 |
+
*/
|
| 52 |
+
export function AlignmentBlock({ alnFasta, className = '' }: AlignmentBlockProps) {
|
| 53 |
+
const { headers, seqs } = useMemo(() => parseAlignedFasta(alnFasta), [alnFasta]);
|
| 54 |
+
const length = seqs[0]?.length ?? 0;
|
| 55 |
+
const columns = useMemo(() => analyzeColumns(seqs), [seqs]);
|
| 56 |
+
|
| 57 |
+
if (!seqs.length) return null;
|
| 58 |
+
|
| 59 |
+
return (
|
| 60 |
+
<div className={`rounded-xl border border-glass-border bg-surface-1 overflow-auto ${className}`}>
|
| 61 |
+
<div className="min-w-max p-3 font-mono text-xs leading-[1.7]">
|
| 62 |
+
<div className="flex">
|
| 63 |
+
<span className="w-24 shrink-0 pr-3 text-right text-[10px] text-text-muted/60" />
|
| 64 |
+
<span className="whitespace-pre text-[10px] text-text-muted/50">
|
| 65 |
+
{Array.from({ length }).map((_, i) => ((i + 1) % 10 === 0 ? (i + 1) / 10 % 10 : ' ').toString()).join('')}
|
| 66 |
+
</span>
|
| 67 |
+
</div>
|
| 68 |
+
{headers.map((h, i) => (
|
| 69 |
+
<div key={i} className="flex">
|
| 70 |
+
<span
|
| 71 |
+
className="w-24 shrink-0 pr-3 text-right text-[10px] text-accent-cyan/80 truncate"
|
| 72 |
+
title={h}
|
| 73 |
+
>
|
| 74 |
+
{h.length > 12 ? `${h.slice(0, 11)}β¦` : h}
|
| 75 |
+
</span>
|
| 76 |
+
<span className="whitespace-pre" style={{ color: 'inherit' }}>
|
| 77 |
+
{Array.from(seqs[i] ?? '').map((ch, j) => {
|
| 78 |
+
const cls = cellClass(ch, columns[j]?.consensus ?? '-');
|
| 79 |
+
return (
|
| 80 |
+
<span key={j} style={{ color: aaColor(ch), backgroundColor: CELL_BG[cls] }}>
|
| 81 |
+
{ch}
|
| 82 |
+
</span>
|
| 83 |
+
);
|
| 84 |
+
})}
|
| 85 |
+
</span>
|
| 86 |
+
</div>
|
| 87 |
+
))}
|
| 88 |
+
<div className="flex">
|
| 89 |
+
<span className="w-24 shrink-0 pr-3 text-right text-[10px] text-accent-amber/80 truncate">
|
| 90 |
+
consensus
|
| 91 |
+
</span>
|
| 92 |
+
<span className="whitespace-pre">
|
| 93 |
+
{columns.map((col, j) => (
|
| 94 |
+
<span key={j} className={symbolClass(col.symbol)}>
|
| 95 |
+
{col.symbol}
|
| 96 |
+
</span>
|
| 97 |
+
))}
|
| 98 |
+
</span>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
|
| 102 |
+
<div className="px-3 pb-3 flex flex-wrap items-center gap-x-5 gap-y-2 text-[10px] text-text-muted">
|
| 103 |
+
<span className="flex items-center gap-1.5">
|
| 104 |
+
<span className="w-2.5 h-2.5 rounded-sm" style={{ background: CELL_BG.match }} />
|
| 105 |
+
Matched
|
| 106 |
+
</span>
|
| 107 |
+
<span className="flex items-center gap-1.5">
|
| 108 |
+
<span className="w-2.5 h-2.5 rounded-sm" style={{ background: CELL_BG.mismatch }} />
|
| 109 |
+
Mismatched
|
| 110 |
+
</span>
|
| 111 |
+
<span className="flex items-center gap-1.5">
|
| 112 |
+
<span className="w-2.5 h-2.5 rounded-sm" style={{ background: CELL_BG.gap }} />
|
| 113 |
+
Gap
|
| 114 |
+
</span>
|
| 115 |
+
<span className="flex items-center gap-1.5">
|
| 116 |
+
<span className="font-bold text-accent-cyan">*</span> Identical
|
| 117 |
+
</span>
|
| 118 |
+
<span className="flex items-center gap-1.5">
|
| 119 |
+
<span className="text-accent-amber font-bold">:</span> Strongly conserved group
|
| 120 |
+
</span>
|
| 121 |
+
<span className="flex items-center gap-1.5">
|
| 122 |
+
<span className="text-text-muted/50 font-bold">.</span> Weakly conserved
|
| 123 |
+
</span>
|
| 124 |
+
</div>
|
| 125 |
+
</div>
|
| 126 |
+
);
|
| 127 |
+
}
|
bioai-platform/frontend/src/components/alignment/MSAResultPanel.tsx
CHANGED
|
@@ -7,40 +7,8 @@ import PhyloTreeViewer from '@/components/phylo/PhyloTreeViewer';
|
|
| 7 |
import { ConservationTrack } from '@/components/alignment/ConservationTrack';
|
| 8 |
import { PairwiseResultDisplay } from '@/components/alignment/PairwiseResultDisplay';
|
| 9 |
import { AlignmentStatsBar } from '@/components/alignment/AlignmentStatsBar';
|
| 10 |
-
import {
|
| 11 |
-
|
| 12 |
-
const AA_COLORS: Record<string, string> = {
|
| 13 |
-
A: '#8B93D6', C: '#E0A94E', D: '#EF4444', E: '#EF4444',
|
| 14 |
-
F: '#7C3AED', G: '#848CA4', H: '#60A5FA', I: '#7C3AED',
|
| 15 |
-
K: '#2DD4BF', L: '#7C3AED', M: '#E0A94E', N: '#60A5FA',
|
| 16 |
-
P: '#FB923C', Q: '#60A5FA', R: '#2DD4BF', S: '#60A5FA',
|
| 17 |
-
T: '#60A5FA', V: '#7C3AED', W: '#7C3AED', Y: '#7C3AED',
|
| 18 |
-
};
|
| 19 |
-
|
| 20 |
-
function aaColor(ch: string): string {
|
| 21 |
-
if (ch === '-') return 'rgba(132,140,164,0.25)';
|
| 22 |
-
return AA_COLORS[ch.toUpperCase()] ?? 'var(--text-primary)';
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
type CellClass = 'match' | 'mismatch' | 'gap';
|
| 26 |
-
|
| 27 |
-
function cellClass(ch: string, consensus: string): CellClass {
|
| 28 |
-
if (ch === '-' || ch === '.') return 'gap';
|
| 29 |
-
return ch.toUpperCase() === consensus ? 'match' : 'mismatch';
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
const CELL_BG: Record<CellClass, string> = {
|
| 33 |
-
match: 'rgba(45,212,191,0.16)',
|
| 34 |
-
mismatch: 'rgba(239,68,68,0.12)',
|
| 35 |
-
gap: 'rgba(132,140,164,0.08)',
|
| 36 |
-
};
|
| 37 |
-
|
| 38 |
-
function symbolClass(symbol: string): string {
|
| 39 |
-
if (symbol === '*') return 'text-accent-cyan font-bold';
|
| 40 |
-
if (symbol === ':') return 'text-accent-amber';
|
| 41 |
-
if (symbol === '.') return 'text-text-muted/40';
|
| 42 |
-
return 'text-transparent';
|
| 43 |
-
}
|
| 44 |
|
| 45 |
interface MSAResultPanelProps {
|
| 46 |
alnFasta: string;
|
|
@@ -61,10 +29,8 @@ export function MSAResultPanel({
|
|
| 61 |
pairwiseSubject,
|
| 62 |
jobId,
|
| 63 |
}: MSAResultPanelProps) {
|
| 64 |
-
const {
|
| 65 |
-
const length = seqs[0]?.length ?? 0;
|
| 66 |
const stats = useMemo(() => computeAlignmentStats(seqs), [seqs]);
|
| 67 |
-
const columns = useMemo(() => analyzeColumns(seqs), [seqs]);
|
| 68 |
|
| 69 |
const download = () => {
|
| 70 |
const blob = new Blob([alnFasta], { type: 'text/plain' });
|
|
@@ -101,72 +67,7 @@ export function MSAResultPanel({
|
|
| 101 |
|
| 102 |
<AlignmentStatsBar stats={stats} className="mb-3" />
|
| 103 |
|
| 104 |
-
<
|
| 105 |
-
<div className="min-w-max p-3 font-mono text-xs leading-[1.7]">
|
| 106 |
-
<div className="flex">
|
| 107 |
-
<span className="w-24 shrink-0 pr-3 text-right text-[10px] text-text-muted/60" />
|
| 108 |
-
<span className="whitespace-pre text-[10px] text-text-muted/50">
|
| 109 |
-
{Array.from({ length }).map((_, i) => ((i + 1) % 10 === 0 ? (i + 1) / 10 % 10 : ' ').toString()).join('')}
|
| 110 |
-
</span>
|
| 111 |
-
</div>
|
| 112 |
-
{headers.map((h, i) => (
|
| 113 |
-
<div key={i} className="flex">
|
| 114 |
-
<span
|
| 115 |
-
className="w-24 shrink-0 pr-3 text-right text-[10px] text-accent-cyan/80 truncate"
|
| 116 |
-
title={h}
|
| 117 |
-
>
|
| 118 |
-
{h.length > 12 ? `${h.slice(0, 11)}β¦` : h}
|
| 119 |
-
</span>
|
| 120 |
-
<span className="whitespace-pre" style={{ color: 'inherit' }}>
|
| 121 |
-
{Array.from(seqs[i] ?? '').map((ch, j) => {
|
| 122 |
-
const cls = cellClass(ch, columns[j]?.consensus ?? '-');
|
| 123 |
-
return (
|
| 124 |
-
<span key={j} style={{ color: aaColor(ch), backgroundColor: CELL_BG[cls] }}>
|
| 125 |
-
{ch}
|
| 126 |
-
</span>
|
| 127 |
-
);
|
| 128 |
-
})}
|
| 129 |
-
</span>
|
| 130 |
-
</div>
|
| 131 |
-
))}
|
| 132 |
-
<div className="flex">
|
| 133 |
-
<span className="w-24 shrink-0 pr-3 text-right text-[10px] text-accent-amber/80 truncate">
|
| 134 |
-
consensus
|
| 135 |
-
</span>
|
| 136 |
-
<span className="whitespace-pre">
|
| 137 |
-
{columns.map((col, j) => (
|
| 138 |
-
<span key={j} className={symbolClass(col.symbol)}>
|
| 139 |
-
{col.symbol}
|
| 140 |
-
</span>
|
| 141 |
-
))}
|
| 142 |
-
</span>
|
| 143 |
-
</div>
|
| 144 |
-
</div>
|
| 145 |
-
</div>
|
| 146 |
-
|
| 147 |
-
<div className="mt-3 flex flex-wrap items-center gap-x-5 gap-y-2 text-[10px] text-text-muted">
|
| 148 |
-
<span className="flex items-center gap-1.5">
|
| 149 |
-
<span className="w-2.5 h-2.5 rounded-sm" style={{ background: CELL_BG.match }} />
|
| 150 |
-
Matched
|
| 151 |
-
</span>
|
| 152 |
-
<span className="flex items-center gap-1.5">
|
| 153 |
-
<span className="w-2.5 h-2.5 rounded-sm" style={{ background: CELL_BG.mismatch }} />
|
| 154 |
-
Mismatched
|
| 155 |
-
</span>
|
| 156 |
-
<span className="flex items-center gap-1.5">
|
| 157 |
-
<span className="w-2.5 h-2.5 rounded-sm" style={{ background: CELL_BG.gap }} />
|
| 158 |
-
Gap
|
| 159 |
-
</span>
|
| 160 |
-
<span className="flex items-center gap-1.5">
|
| 161 |
-
<span className="font-bold text-accent-cyan">*</span> Identical
|
| 162 |
-
</span>
|
| 163 |
-
<span className="flex items-center gap-1.5">
|
| 164 |
-
<span className="text-accent-amber font-bold">:</span> Strongly conserved group
|
| 165 |
-
</span>
|
| 166 |
-
<span className="flex items-center gap-1.5">
|
| 167 |
-
<span className="text-text-muted/50 font-bold">.</span> Weakly conserved
|
| 168 |
-
</span>
|
| 169 |
-
</div>
|
| 170 |
</div>
|
| 171 |
|
| 172 |
{seqs.length >= 2 && (
|
|
|
|
| 7 |
import { ConservationTrack } from '@/components/alignment/ConservationTrack';
|
| 8 |
import { PairwiseResultDisplay } from '@/components/alignment/PairwiseResultDisplay';
|
| 9 |
import { AlignmentStatsBar } from '@/components/alignment/AlignmentStatsBar';
|
| 10 |
+
import { AlignmentBlock } from '@/components/alignment/AlignmentBlock';
|
| 11 |
+
import { computeAlignmentStats, parseAlignedFasta } from '@/lib/alignment-stats';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
interface MSAResultPanelProps {
|
| 14 |
alnFasta: string;
|
|
|
|
| 29 |
pairwiseSubject,
|
| 30 |
jobId,
|
| 31 |
}: MSAResultPanelProps) {
|
| 32 |
+
const { seqs } = useMemo(() => parseAlignedFasta(alnFasta), [alnFasta]);
|
|
|
|
| 33 |
const stats = useMemo(() => computeAlignmentStats(seqs), [seqs]);
|
|
|
|
| 34 |
|
| 35 |
const download = () => {
|
| 36 |
const blob = new Blob([alnFasta], { type: 'text/plain' });
|
|
|
|
| 67 |
|
| 68 |
<AlignmentStatsBar stats={stats} className="mb-3" />
|
| 69 |
|
| 70 |
+
<AlignmentBlock alnFasta={alnFasta} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
</div>
|
| 72 |
|
| 73 |
{seqs.length >= 2 && (
|
bioai-platform/frontend/src/components/phylo/PhyloTreeViewer.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
| 4 |
import { MagnifyingGlass as Search } from '@phosphor-icons/react'
|
| 5 |
import { ClaySegmented } from '@/components/ui/ClaySegmented'
|
| 6 |
import { AlignmentStatsBar } from '@/components/alignment/AlignmentStatsBar'
|
|
|
|
| 7 |
import { computeAlignmentStats, parseAlignedFasta } from '@/lib/alignment-stats'
|
| 8 |
|
| 9 |
// βββ Types ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
@@ -952,10 +953,9 @@ export default function PhyloTreeViewer({
|
|
| 952 |
{showAlignment && (
|
| 953 |
<>
|
| 954 |
{alignmentStats && <AlignmentStatsBar stats={alignmentStats} className="px-4 pt-3" />}
|
| 955 |
-
<
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
</pre>
|
| 959 |
</>
|
| 960 |
)}
|
| 961 |
</div>
|
|
|
|
| 4 |
import { MagnifyingGlass as Search } from '@phosphor-icons/react'
|
| 5 |
import { ClaySegmented } from '@/components/ui/ClaySegmented'
|
| 6 |
import { AlignmentStatsBar } from '@/components/alignment/AlignmentStatsBar'
|
| 7 |
+
import { AlignmentBlock } from '@/components/alignment/AlignmentBlock'
|
| 8 |
import { computeAlignmentStats, parseAlignedFasta } from '@/lib/alignment-stats'
|
| 9 |
|
| 10 |
// βββ Types ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 953 |
{showAlignment && (
|
| 954 |
<>
|
| 955 |
{alignmentStats && <AlignmentStatsBar stats={alignmentStats} className="px-4 pt-3" />}
|
| 956 |
+
<div className="p-4">
|
| 957 |
+
<AlignmentBlock alnFasta={alignment} className="max-h-60" />
|
| 958 |
+
</div>
|
|
|
|
| 959 |
</>
|
| 960 |
)}
|
| 961 |
</div>
|