GithubHelp home page GithubHelp logo

Comments (1)

BurkovBA avatar BurkovBA commented on May 29, 2024

Ok, nevermind, I mostly copy-pasted the new E! transcript track model, have a very little idea of how it works. but it works now. Thanks!

    GenoverseUtils.prototype.RNAcentralParseData = function(data) {
        var model = this;
        var featuresById = this.featuresById;
        var ids = [];

        data.filter(function (d) { return d.feature_type === 'transcript'; }).forEach(function (feature, i) {
            if (!featuresById[feature.id]) {
                // prepare a label
                var label = feature.description || feature.external_name;
                if (label.length > 50) {
                    label = label.substr(0, 47) + "...";
                }
                if (feature.strand == 1) {
                    label = label + " >";
                }
                else if (feature.strand == -1) {
                    label = "< " + label;
                }

                feature.id = feature.ID;
                feature.label = label; // used to be feature.external_name
                feature.exons = {};
                feature.subFeatures = [];
                feature.cdsStart = Infinity;
                feature.cdsEnd = -Infinity;
                feature.chr = feature.seq_region_name;
                feature.color = '#8B668B';

                model.insertFeature(feature);

                ids.push(feature.id);
            }
        });

        data.filter(function (d) { return d.feature_type === 'exon' && featuresById[d.Parent] && !featuresById[d.Parent].exons[d.id]; }).forEach(function (feature) {
            feature.id  = feature.ID;
            feature.chr = feature.seq_region_name;

            if (feature.end < featuresById[feature.Parent].cdsStart || feature.start > featuresById[feature.Parent].cdsEnd) {
                feature.utr = true;
            } else if (feature.start < featuresById[feature.Parent].cdsStart) {
                featuresById[feature.Parent].subFeatures.push($.extend({ utr: true }, feature, { end: featuresById[feature.Parent].cdsStart }));

                feature.start = featuresById[feature.Parent].cdsStart;
            } else if (feature.end > featuresById[feature.Parent].cdsEnd) {
                featuresById[feature.Parent].subFeatures.push($.extend({ utr: true }, feature, { start: featuresById[feature.Parent].cdsEnd }));

                feature.end = featuresById[feature.Parent].cdsEnd;
            }

            featuresById[feature.Parent].subFeatures.push(feature);
            featuresById[feature.Parent].exons[feature.id] = feature;

            // set colors
            feature.color = false;
            feature.borderColor = '#8B668B';
        });

        ids.forEach(function (id) {
            featuresById[id].subFeatures.sort(function (a, b) { return a.start - b.start; });
        });
    };

from genoverse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.