Package org.broad.igv.feature

Examples of org.broad.igv.feature.BasicFeature


                int l2 = track.getLongestFeatureLength(chr);
                Iterator<BasicFeature> regionFeatures = frame.getFeatureIterator(features, l2, model.getFrameBPWidth());

                while (regionFeatures.hasNext()) {
                    BasicFeature f = regionFeatures.next();

                    Color c = track.getColor();

                    float score = track.getSignal(f);
                    double alpha = Float.isNaN(score) ? 1 : getAlpha(min, max, score);
View Full Code Here


        String name = editing ? "Edit " + featDispName : "Add annotation to " + MongoFeatureTrack.this.getName();
        JMenuItem item = new JMenuItem(name);
        item.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Feature feat = editing ? selFeat.getDBFeature() : new BasicFeature(chr, start, end);
                FeatureAnnotDialog dialog = new FeatureAnnotDialog(IGV.getMainFrame(), getCollection(), feat);
                dialog.setVisible(true);
            }
        });
        return item;
View Full Code Here

                Feature feature = featureList != null && featureList.size() > 0 ? featureList.get(0) : null;

                if (feature == null)
                    return;
                if (feature instanceof BasicFeature) {
                    BasicFeature bf = (BasicFeature) feature;
                    java.util.List<Exon> exons = bf.getExons();
                    if (exons == null || exons.isEmpty()) {
                        MessageUtils.showMessage("At least one centered feature does not have exon structure");
                        return;
                    }

                    if (forward) {
                        for (Exon exon : bf.getExons()) {
                            //the "+ 1" here is necessary because the rounding in the recentering method
                            //sometimes places the center one base off.  This should be perfectly safe,
                            //but it does assume no one's abusing the exon datastructure and creating
                            //exons that are right next to each other.
                            if (exon.getStart() > vc.getCenter() + 1) {
View Full Code Here

        String hasPhaseId = "LOC_Os01g01010.1:exon_1";
        int expPhaseNum = 1;
        boolean checkedHasPhase = false;

        BasicFeature bf = (BasicFeature) sourceFeats.get(0);
        for (Exon exon : bf.getExons()) {
            if (exon.getName().equals(hasPhaseId)) {
                checkedHasPhase = true;
                assertEquals(expPhaseNum, exon.getReadingFrame());
            } else {
                assertEquals(-1, exon.getReadingFrame());
View Full Code Here

        final IGVBEDCodec codec = new IGVBEDCodec();

        Function<String, Void> decodeFunc = new Function<String, Void>(){
            @Override
            public Void apply(String input) {
                BasicFeature feat = codec.decode(input);
                return null;
            }
        };

        supplier.reset();
View Full Code Here

chr1  .  CDS  7000  7600  .  +  ID=cds00004;Parent=mRNA00003;Name=edenprotein.4
         */
        Set<Integer> mRNA3CdStarts = new HashSet<Integer>(Arrays.asList(3300, 3390));

        for (Feature feature : features) {
            BasicFeature bf = (BasicFeature) feature;

            String ident = bf.getIdentifier();
            List<Exon> exons = bf.getExons();
            String type = bf.getType();
            if (type.equals("mRNA")) {
                actmRNAFeats++;
                mRNAIds.add(bf.getIdentifier());
            } else if (type.equals("gene")) {
                assertEquals(bf.getIdentifier(), "gene00001");
                continue;
            } else {
                continue;
            }

            Exon lastExon = exons.get(exons.size() - 1);
            assertEquals(7600, lastExon.getCdEnd());
            assertEquals(lastExon.getCdStart(), lastExon.getStart());
            assertEquals(9000, lastExon.getEnd());

            int midCDSInd = 2;

            if (ident.equals("mRNA00001")) {
                assertEquals(4, bf.getExonCount());
                assertEquals(1201 - 1, exons.get(0).getCdStart());

                Exon secExon = exons.get(1);
                assertWholeExonCoding(secExon);
                assertEquals(3000 - 1, secExon.getStart());
                assertEquals(3902, secExon.getEnd());

            }
            if (ident.equals("mRNA00002")) {
                assertEquals(3, bf.getExonCount());
                assertEquals(1201 - 1, exons.get(0).getCdStart());
                midCDSInd = 1;
            }
            if (ident.equals("mRNA00003")) {
                assertEquals(4, bf.getExonCount());
                boolean passedCdStart = false;
                for (Exon exon : exons) {
                    if (exon.isNonCoding()) {
                        assertEquals("Entire exon is UTR but has coding region: " + exon.getName(), 0, exon.getCodingLength());
                        assertEquals("Entire exon is UTR but has coding region: " + exon.getName(), 0, exon.getCdEnd() - exon.getCdEnd());
View Full Code Here

        List<Feature> features = getGeneFeatures(filepath, chr, start, end);
        assertEquals(6, features.size());

        for (Feature feat : features) {
            BasicFeature basicFeature = (BasicFeature) feat;
            if (basicFeature.getType().equals("region")) {
                assertEquals("id0", basicFeature.getIdentifier());
            } else if (basicFeature.getType().equals("gene")) {
                assertEquals(1, basicFeature.getExonCount());
                assertTrue(basicFeature.getIdentifier().contains("gene"));
                assertTrue(basicFeature.getName().contains("A1S_"));

                Exon exon = basicFeature.getExons().get(0);
                assertTrue("Exon name incorrect: " + exon.getName(), exon.getName().contains("YP_00"));

                assertWholeExonCoding(exon);
                assertEquals(0, exon.getReadingFrame());
            } else {
                throw new AssertionError("Unknown feature type: " + basicFeature.getType());
            }

        }
    }
View Full Code Here

        GFFFeatureSource src = new GFFFeatureSource(TribbleFeatureSource.getFeatureSource(new ResourceLocator(path), null));

        Iterator<Feature> iter = src.getFeatures("I", 0, Integer.MAX_VALUE);
        while (iter.hasNext()) {
            BasicFeature bf = (BasicFeature) iter.next();
            assertEquals(expName, bf.getName());
        }

    }
View Full Code Here

        int end = 26848;

        List<Feature> features = getGeneFeatures(filepath, chr, start, end);
        assertEquals(2, features.size());

        BasicFeature gene = null, tRNA = null;
        for (Feature feat : features) {
            if (((BasicFeature) feat).getType().equals("gene")) {
                gene = (BasicFeature) feat;
            } else if (((BasicFeature) feat).getType().equals("tRNA")) {
                tRNA = (BasicFeature) feat;
            }
        }

        assertEquals(gene.getIdentifier(), tRNA.getAttributes().get("Parent"));

        assertEquals(1, tRNA.getExonCount());
        Exon exon = tRNA.getExons().get(0);
        assertEquals(tRNA.getIdentifier(), exon.getAttributes().get("Parent"));
        assertWholeExonNonCoding(exon);
View Full Code Here

        FeatureSource source = new GFFFeatureSource(tribbleFeatureSource);

        int featureCount = 0;
        Iterator<Feature> iter = source.getFeatures("chr7", 0, Integer.MAX_VALUE);
        while (iter.hasNext()) {
            BasicFeature bf = (BasicFeature) iter.next();
            featureCount++;
        }
        assertEquals(2, featureCount);

    }
View Full Code Here

TOP

Related Classes of org.broad.igv.feature.BasicFeature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.