Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single Base BED Box #240

Open
denisemauldin opened this issue Aug 9, 2018 · 2 comments
Open

Single Base BED Box #240

denisemauldin opened this issue Aug 9, 2018 · 2 comments

Comments

@denisemauldin
Copy link

denisemauldin commented Aug 9, 2018

Hi there,

I'm attempting to highlight a single basepair in the browser. My BED row is:
"chr4 4175043 4175058 spacer 999 - 4175051 4175052 255,0,0 1 15 0"

The top image is what it displays. The bottom image is what I want it to display.
biodalliance_single_basepair

If I change the BED row to be this:
"chr4 4175043 4175058 spacer 999 - 4175051 4175051 255,0,0 1 15 0"
Then it displays no red.

If I change the BED row to be this:
"chr4 4175043 4175058 spacer 999 - 4175050 4175051 255,0,0 1 15 0"
Then it displays this:
biodalliance_left

How do I get it to just color one base pair (4175051) red?

@denisemauldin
Copy link
Author

denisemauldin commented Aug 9, 2018

As far as I can tell, I need to add a condition to the code to skip the thickStart -3 and thickEnd +3 codingRegion calculation.

I added this to make BedParseSession.prototype.parse draw 1 base pair:

            } else if (thickEnd == thickStart) {
                var codingRegion = f.orientation == '+' ? new Range(thickStart, thickEnd) : new Range(thickStart, thickEnd);
                var tl = intersection(spans, codingRegion);
                if (tl) {
                    f.type = 'translation';
                    var tlList = tl.ranges();
                    var readingFrame = 0;
                    for (var s = 0; s < tlList.length; ++s) {
                        // Record reading frame for every exon
                        var index = s;
                        if (f.orientation == '-') index = tlList.length - s - 1;
                        var ts = tlList[index];
                        var bf = shallowCopy(f);
                        bf.min = ts.min();
                        bf.max = ts.max();
                        f.readframe = readingFrame;
                        var length = ts.max() - ts.min();
                        readingFrame = (readingFrame + length) % 3;
                        this.sink(bf);
                    }
                }
            }

Maybe I should be using some parser other than the BedParseSession.prototype.parse?
Would it be useful to contribute this code back?

@dasmoth
Copy link
Owner

dasmoth commented Aug 10, 2018

Thanks for looking into this. Yes, you're looking in the right place. The +/-3 thing is because this style of BED is usually being used to represent protein-coding regions. I guess you're using it for something else (would be quite curious to know what, if it's not sensitive information).

I suspect what's really needed here is a flag here to optionally suppress the +/-3 behaviour. That ends up being slightly annoying in that there's not currently a way to pass per-track config flags to parsers. However, it wouldn't be too hard to pass the track config in as an extra parameter to Parser.createSession...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants