-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: implementing fragment line. TO FIX : x position of fragment label
- Loading branch information
1 parent
3c81094
commit 4906637
Showing
13 changed files
with
167 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { SVGSequenceLabel } from './SVGSequenceLabel'; | ||
|
||
export function SVGFragment({ | ||
fragment, | ||
firstIndexOnLine, | ||
y, | ||
indexFragment, | ||
options, | ||
}) { | ||
const { | ||
width = 600, | ||
leftRightBorders = 50, | ||
spaceBetweenResidues = 30, | ||
spaceBetweenInternalLines = 12, | ||
strokeWidth = 2, | ||
labelFontFamily = 'Verdana', | ||
labelSize = 8, | ||
} = options; | ||
const xStart = | ||
leftRightBorders + | ||
(fragment.from - firstIndexOnLine) * spaceBetweenResidues; | ||
const xEnd = | ||
leftRightBorders + (fragment.to - firstIndexOnLine) * spaceBetweenResidues; | ||
const yLine = y - indexFragment * spaceBetweenInternalLines; | ||
console.log(xStart, xEnd, (xEnd - xStart) / 2); | ||
return ( | ||
<> | ||
{fragment.members.map((member, index) => ( | ||
<> | ||
<line | ||
x1={xStart} | ||
y1={yLine - index * spaceBetweenInternalLines} | ||
x2={xEnd} | ||
y2={yLine - index * spaceBetweenInternalLines} | ||
strokeLinecap="round" | ||
strokeWidth={strokeWidth} | ||
stroke={fragment.color} | ||
key={`SVGFragment-${xStart}${xEnd}${index}`} | ||
/> | ||
<SVGSequenceLabel | ||
x={Math.trunc((xEnd - xStart) / 2)} | ||
// x={xEnd} | ||
y={yLine - index * spaceBetweenInternalLines - strokeWidth} | ||
label={member.type} | ||
charge={member.charge} | ||
similarity={Math.trunc(member.similarity * 100)} | ||
textColor={member.textColor} | ||
options={options} | ||
key={`fragmentLabel${member.type}${String(index)}`} | ||
/> | ||
</> | ||
))} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export function SVGFragmentLabel(x, y, label, charge, similarity, options) {} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { SVGFragment } from './SVGFragment'; | ||
|
||
export function SVGSequenceFragments({ | ||
fragments, | ||
firstIndexOnLine, | ||
y, | ||
options, | ||
}) { | ||
const { | ||
width = 600, | ||
leftRightBorders = 50, | ||
spaceBetweenResidues = 30, | ||
spaceBetweenInternalLines = 12, | ||
strokeWidth = 2, | ||
labelFontFamily = 'Verdana', | ||
labelSize = 8, | ||
} = options; | ||
let indexFragment = 0; | ||
return ( | ||
<> | ||
{fragments.map((fragment, index) => { | ||
let iF = indexFragment; | ||
indexFragment += fragment.members.length; | ||
return ( | ||
<SVGFragment | ||
fragment={fragment} | ||
firstIndexOnLine={firstIndexOnLine} | ||
y={y} | ||
indexFragment={iF} | ||
options={options} | ||
key={`SVGFragment-${index}`} | ||
/> | ||
); | ||
})} | ||
</> | ||
); | ||
} |
15 changes: 7 additions & 8 deletions
15
src/components/SVGSequenceBreakLabel.jsx → src/components/SVGSequenceLabel.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters