Skip to content

Commit 40b60a6

Browse files
AmirMohammad CheraghaliAmirMohammad Cheraghali
authored andcommitted
Revert "Implement molecular interaction visualization (H-bonds, salt bridges, disulfide bonds)"
This reverts commit 380211a.
1 parent 380211a commit 40b60a6

3 files changed

Lines changed: 1 addition & 88 deletions

File tree

src/App.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ function App() {
9090
const [showLigands, setShowLigands] = useState(initialUrlState.showLigands || false);
9191
const [showIons, setShowIons] = useState(false);
9292
const [showSurface, setShowSurface] = useState(initialUrlState.showSurface || false);
93-
const [showInteractions, setShowInteractions] = useState(false);
9493

9594
// ... (lines 53-343) ...
9695

@@ -1001,8 +1000,6 @@ function App() {
10011000
setShowLigands={setShowLigands}
10021001
showIons={showIons}
10031002
setShowIons={setShowIons}
1004-
showInteractions={showInteractions}
1005-
setShowInteractions={setShowInteractions}
10061003
onFocusLigands={handleFocusLigands}
10071004
onRecordMovie={handleRecordMovie}
10081005
isRecording={isRecording}
@@ -1053,7 +1050,6 @@ function App() {
10531050
showSurface={showSurface}
10541051
showLigands={showLigands}
10551052
showIons={showIons}
1056-
showInteractions={showInteractions}
10571053
coloring={coloring}
10581054
palette={colorPalette}
10591055
backgroundColor={customBackgroundColor || (isLightMode ? 'white' : 'black')}

src/components/Controls.tsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,6 @@ interface ControlsProps {
288288
setShowSurface: (show: boolean) => void;
289289
showLigands: boolean;
290290
setShowLigands: (show: boolean) => void;
291-
showInteractions: boolean;
292-
setShowInteractions: (show: boolean) => void;
293291
onFocusLigands: () => void;
294292
onRecordMovie: (duration: number) => void;
295293
isRecording: boolean;
@@ -356,8 +354,6 @@ export const Controls: React.FC<ControlsProps> = ({
356354
setShowLigands,
357355
showIons,
358356
setShowIons,
359-
showInteractions,
360-
setShowInteractions,
361357
onRecordMovie,
362358
isRecording,
363359
proteinTitle,
@@ -1199,20 +1195,6 @@ export const Controls: React.FC<ControlsProps> = ({
11991195
<span className={`w-1.5 h-1.5 rounded-full ${showIons ? 'bg-purple-500' : 'bg-neutral-400'}`} />
12001196
{showIons ? 'Ions On' : 'Ions Off'}
12011197
</button>
1202-
{!isChemical && (
1203-
<button
1204-
onClick={() => setShowInteractions(!showInteractions)}
1205-
className={`flex items-center justify-center gap-2 px-3 py-1.5 rounded-md border text-[10px] font-medium transition-all
1206-
${showInteractions
1207-
? 'bg-green-500/10 border-green-500 text-green-600 dark:text-green-400'
1208-
: `${isLightMode ? 'bg-white border-neutral-200 text-neutral-600 hover:bg-neutral-50' : 'bg-white/5 border-white/10 text-neutral-400 hover:bg-white/10'}`
1209-
}`}
1210-
title="Show molecular interactions (H-bonds, salt bridges)"
1211-
>
1212-
<span className={`w-1.5 h-1.5 rounded-full ${showInteractions ? 'bg-green-500' : 'bg-neutral-400'}`} />
1213-
{showInteractions ? 'Interactions On' : 'Interactions Off'}
1214-
</button>
1215-
)}
12161198
</div>
12171199
<div className="flex flex-wrap gap-1">
12181200
{ligands.map(lig => (

src/components/ProteinViewer.tsx

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export interface ProteinViewerProps {
4141
showSurface: boolean;
4242
showLigands?: boolean; // Optional, defaults to true
4343
showIons?: boolean; // New prop
44-
showInteractions?: boolean; // Show H-bonds and interactions
4544
coloring: ColoringType;
4645
palette: ColorPalette;
4746
backgroundColor: string;
@@ -119,7 +118,6 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
119118
showSurface = false,
120119
showLigands = false,
121120
showIons = false,
122-
showInteractions = false,
123121
isSpinning = false,
124122
isMeasurementMode = false,
125123
measurements,
@@ -1856,72 +1854,9 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
18561854
}
18571855
};
18581856

1859-
// Update Interactions (H-bonds, Salt bridges, Disulfide bonds)
1860-
const updateInteractions = () => {
1861-
const component = componentRef.current;
1862-
if (!component || !showInteractions) {
1863-
// Remove existing interaction representations
1864-
if (component) {
1865-
component.removeRepresentation(component.reprList.filter((r: any) => r.name && r.name.startsWith('interaction_')));
1866-
}
1867-
return;
1868-
}
1869-
1870-
try {
1871-
// Remove old interaction reps
1872-
component.reprList.filter((r: any) => r.name && r.name.startsWith('interaction_')).forEach((r: any) => component.removeRepresentation(r));
1873-
1874-
1875-
// 1. Hydrogen Bonds (Backbone N-H...O=C)
1876-
// Using distance representation for atoms within H-bond distance
1877-
component.addRepresentation('distance', {
1878-
atomPair: [
1879-
['protein and .N', 'protein and .O'],
1880-
],
1881-
labelVisible: false,
1882-
color: 'lightblue',
1883-
linewidth: 1,
1884-
opacity: 0.6,
1885-
name: 'interaction_hbond',
1886-
maxDistance: 3.5, // Typical H-bond distance
1887-
});
1888-
1889-
// 2. Salt Bridges (Charged residues)
1890-
// Positive: ARG, LYS; Negative: ASP, GLU
1891-
component.addRepresentation('distance', {
1892-
atomPair: [
1893-
['( ARG or LYS ) and ( .NH* or .NZ )', '( ASP or GLU ) and ( .OD* or .OE* )'],
1894-
],
1895-
labelVisible: false,
1896-
color: 'orange',
1897-
linewidth: 2,
1898-
opacity: 0.7,
1899-
name: 'interaction_saltbridge',
1900-
maxDistance: 4.0, // Salt bridge cutoff
1901-
});
1902-
1903-
// 3. Disulfide Bonds (CYS SG-SG)
1904-
component.addRepresentation('distance', {
1905-
atomPair: [
1906-
['CYS and .SG', 'CYS and .SG'],
1907-
],
1908-
labelVisible: false,
1909-
color: 'yellow',
1910-
linewidth: 3,
1911-
opacity: 0.9,
1912-
name: 'interaction_disulfide',
1913-
maxDistance: 2.5, // Disulfide bond distance
1914-
});
1915-
1916-
} catch (e) {
1917-
console.warn("Error adding interactions:", e);
1918-
}
1919-
};
1920-
19211857
useEffect(() => {
19221858
updateRepresentation();
1923-
updateInteractions();
1924-
}, [representation, coloring, customColors, showSurface, showLigands, showIons, colorPalette, showInteractions]);
1859+
}, [representation, coloring, customColors, showSurface, showLigands, showIons, colorPalette]);
19251860

19261861
useEffect(() => {
19271862
if (stageRef.current) {

0 commit comments

Comments
 (0)