Skip to content

Commit

Permalink
Unneeded to clip softclipped bases
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed May 19, 2022
1 parent 1c538a7 commit abf9bff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
31 changes: 13 additions & 18 deletions plugins/alignments/src/PileupRenderer/PileupRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ export default class PileupRenderer extends BoxRendererType {
) {
const { feature, topPx, heightPx } = layoutFeature
const { regionSequence, modificationTagMap = {} } = props
console.log({ regionSequence })

const mm = (getTagAlt(feature, 'MM', 'Mm') as string) || ''

Expand All @@ -418,13 +417,11 @@ export default class PileupRenderer extends BoxRendererType {

const cigar = feature.get('CIGAR')
const start = feature.get('start')
const end = feature.get('end')
const seq = feature.get('seq')
const strand = feature.get('strand')
const cigarOps = parseCigar(cigar)

const modifications = getModificationPositions(mm, seq, strand)
console.log({ modifications })

// probIndex applies across multiple modifications e.g.
let probIndex = 0
Expand All @@ -434,21 +431,19 @@ export default class PileupRenderer extends BoxRendererType {
const base = Color(col)
for (const readPos of getNextRefPos(cigarOps, positions)) {
const r = start + readPos
if (readPos >= 0 && r < end) {
const [leftPx, rightPx] = bpSpanPx(r, r + 1, region, bpPerPx)

// give it a little boost of 0.1 to not make them fully
// invisible to avoid confusion
const prob = probabilities[probIndex]
ctx.fillStyle =
prob && prob !== 1
? base
.alpha(prob + 0.1)
.hsl()
.string()
: col
ctx.fillRect(leftPx, topPx, rightPx - leftPx + 0.5, heightPx)
}
const [leftPx, rightPx] = bpSpanPx(r, r + 1, region, bpPerPx)

// give it a little boost of 0.1 to not make them fully
// invisible to avoid confusion
const prob = probabilities[probIndex]
ctx.fillStyle =
prob && prob !== 1
? base
.alpha(prob + 0.1)
.hsl()
.string()
: col
ctx.fillRect(leftPx, topPx, rightPx - leftPx + 0.5, heightPx)
probIndex++
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ export default class SNPCoverageAdapter extends BaseFeatureDataAdapter {
({ type, positions }) => {
const mod = `mod_${type}`
for (const pos of getNextRefPos(ops, positions)) {
if (pos < 0 || pos > fend) {
continue
}
const epos = pos + fstart - region.start
if (epos >= 0 && epos < bins.length && pos + fstart < fend) {
const bin = bins[epos]
Expand Down
2 changes: 1 addition & 1 deletion plugins/alignments/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ export async function fetchSequence(

// has to check underlying C-G (aka CpG) on the reference sequence
export function shouldFetchReferenceSequence(type?: string) {
return type === 'methylation' || type === 'modifications'
return type === 'methylation'
}

0 comments on commit abf9bff

Please sign in to comment.