Examples of BasicFeature


Examples of htsjdk.tribble.BasicFeature

        Assert.assertEquals(loc.getStop(), read.getAlignmentStart());
    }

    @Test
    public void testCreationFromFeature() {
        final Feature feature = new BasicFeature("chr1", 1, 5);
        final GenomeLoc loc = genomeLocParser.createGenomeLoc(feature);
        Assert.assertEquals(loc.getContig(), feature.getChr());
        Assert.assertEquals(loc.getStart(), feature.getStart());
        Assert.assertEquals(loc.getStop(), feature.getEnd());
    }
View Full Code Here

Examples of htsjdk.tribble.BasicFeature

    }

    public void initializeTests() {
        final List<Feature> handPickedFeatures = new ArrayList<Feature>();

        handPickedFeatures.add(new BasicFeature(contig, 1, 1));
        handPickedFeatures.add(new BasicFeature(contig, 2, 5));
        handPickedFeatures.add(new BasicFeature(contig, 4, 4));
        handPickedFeatures.add(new BasicFeature(contig, 6, 6));
        handPickedFeatures.add(new BasicFeature(contig, 9, 10));
        handPickedFeatures.add(new BasicFeature(contig, 10, 10));
        handPickedFeatures.add(new BasicFeature(contig, 10, 11));
        handPickedFeatures.add(new BasicFeature(contig, 13, 20));

        createTestsForFeatures(handPickedFeatures);

        // test in the present of a large spanning element
        {
            List<Feature> oneLargeSpan = new ArrayList<Feature>(handPickedFeatures);
            oneLargeSpan.add(new BasicFeature(contig, 1, 30));
            createTestsForFeatures(oneLargeSpan);
        }

        // test in the presence of a partially spanning element
        {
            List<Feature> partialSpanStart = new ArrayList<Feature>(handPickedFeatures);
            partialSpanStart.add(new BasicFeature(contig, 1, 6));
            createTestsForFeatures(partialSpanStart);
        }

        // test in the presence of a partially spanning element at the end
        {
            List<Feature> partialSpanEnd = new ArrayList<Feature>(handPickedFeatures);
            partialSpanEnd.add(new BasicFeature(contig, 10, 30));
            createTestsForFeatures(partialSpanEnd);
        }

        // no data at all
        final GenomeLoc loc = genomeLocParser.createGenomeLoc(contig, 5, 5);
View Full Code Here

Examples of org.broad.igv.feature.BasicFeature

        int start=0;
        int end=0;
        for (int i = 0; i < nItems; i++) {
            start = i * 5;
            end = start + 5;
            features.add(new BasicFeature("chr1", start, end));
        }

        List<Feature> filteredFeatures = CollUtils.filter(features, FeatureUtils.getOverlapPredicate("chr1", start, end));

        // We should find 1 feature (the last one)
View Full Code Here

Examples of org.broad.igv.feature.BasicFeature

        helper.parseAttributes(attributeString, attributes);

        String id = helper.getID(attributes, featureType);
        String[] parentIds = helper.getParentIds(attributes, attributeString);

        BasicFeature f = new BasicFeature(chromosome, start, end, strand);


        // Set "thick start/end" => corresponds to coding start & end, for UTRs
        if (SequenceOntology.utrTypes.contains(featureType)) {
            boolean plus = (SequenceOntology.fivePrimeUTRTypes.contains(featureType) && strand == Strand.POSITIVE) ||
                    (SequenceOntology.threePrimeUTRTypes.contains(featureType) && strand == Strand.NEGATIVE);
            if (plus) {
                f.setThickStart(end);
            } else {
                f.setThickEnd(end);
            }
        }

        String phaseString = tokens[7].trim();
        if (!phaseString.equals(".")) {
            int phaseNum = Integer.parseInt(phaseString);
            f.setReadingFrame(phaseNum);
        }

        f.setName(helper.getName(attributes));
        f.setType(featureType);

        id = id != null ? id : "igv_" + UUID.randomUUID().toString();
        f.setIdentifier(id);

        f.setParentIds(parentIds);
        f.setAttributes(attributes);

        String[] colorNames = new String[]{"color", "Color", "colour", "Colour"};
        for (String colorName : colorNames) {
            if (attributes.containsKey(colorName)) {
                f.setColor(ColorUtilities.stringToColor(attributes.get(colorName)));
                break;
            }
        }

        if (featuresToHide.contains(featureType)) {
View Full Code Here

Examples of org.broad.igv.feature.BasicFeature

        int[] expectedStarts = {0, 0, 1032, 82042, -79, 10554};
        int[] expectedEnds = {105338, 105338, 102035, 82643, -78, 10555};

        List<Feature> features = genbankParser.getFeatures();
        for (int i=0; i<expectedTypes.length; i++) {
            BasicFeature bf = (BasicFeature) features.get(i);
            assertEquals(expectedTypes[i], bf.getType());
            assertEquals(expectedStarts[i], bf.getStart());
            assertEquals(expectedEnds[i], bf.getEnd());
        }


        //       61 ttccgaggcg cccgggctcc cggcgcggcg gcggaggggg cgggcaggcc ggcgggcggt
        String chr = genbankParser.getChr();
View Full Code Here

Examples of org.broad.igv.feature.BasicFeature

        List<Feature> combinedFeatures = new GFFFeatureSource.GFFCombiner().addFeatures(features).combineFeatures();

        assertEquals("Wrong number of transcripts", 1, combinedFeatures.size());

        BasicFeature transcript = (BasicFeature) combinedFeatures.get(0);

        assertEquals(53 - 1, transcript.getStart());
        assertEquals(550, transcript.getEnd());


        assertEquals(3, transcript.getExonCount());
        String transFPKM = transcript.getAttributes().get("FPKM");
        assertTrue("Transcript FPKM invalid: " + transFPKM, transFPKM.startsWith("105"));

        int[] exonStarts = new int[]{53,351,501};
        int[] exonEnds = new int[]{250,400,550};

        for(int ii= 0; ii < 3; ii++){
            Exon exon = transcript.getExons().get(ii);
            assertEquals(exonStarts[ii] - 1, exon.getStart());
            assertEquals(exonEnds[ii], exon.getEnd());
            String exonFPKM = transcript.getAttributes().get("FPKM");
            assertTrue("Exon FPKM invalid: " + exonFPKM, exonFPKM.startsWith("105"));
            assertTrue(exonFPKM.startsWith("105"));
        }

    }
View Full Code Here

Examples of org.broad.igv.feature.BasicFeature

        String queryChr = "chr8";
        int queryStart = 40823007;
        int queryEnd = 40863995;

        Iterator<Feature> iter = source.getFeatures(queryChr, queryStart, queryEnd);
        BasicFeature feat = (BasicFeature) iter.next();

        int expFeatureStart = 40843500;
        int exFeatureEnd = 40843512;

        assertEquals(expFeatureStart, feat.getStart());
        assertEquals(exFeatureEnd, feat.getEnd());
        checkPatternMatches(motif, feat);

        //Negative strand hit
//        feat = (BasicFeature) iter.next();
//        assertEquals(expFeatureStart + 2, feat.getStart());
//        assertEquals(exFeatureEnd + 2, feat.getEnd());
//        checkPatternMatches(motif, feat);

        feat = (BasicFeature) iter.next();
        assertEquals(expFeatureStart + 4, feat.getStart());
        assertEquals(exFeatureEnd + 4, feat.getEnd());
        checkPatternMatches(motif, feat);
    }
View Full Code Here

Examples of org.broad.igv.feature.BasicFeature

        Assert.assertNotNull(header);
        assertTrue(codec.isGffTags());

        Iterator<BasicFeature> iter = bfr.iterator();
        while (iter.hasNext()) {
            BasicFeature feat = iter.next();
            //Note: These are not in general equal, but they are for this data file
            assertEquals(feat.getName(), feat.getIdentifier());
            assertNotNull("No ID found for feature", feat.getIdentifier());
            assertNotNull("No description found for feature", feat.getDescription());
            assertNotNull("Feature not in FeatureDB", FeatureDB.getFeature(feat.getIdentifier()));
        }


    }
View Full Code Here

Examples of org.broad.igv.feature.BasicFeature

        TestUtils.createIndex(bedFile, IgvTools.LINEAR_INDEX, 10000);
        FeatureCodec codec = CodecFactory.getCodec(bedFile, null);

        AbstractFeatureReader<Feature, ?> bfr = AbstractFeatureReader.getFeatureReader(bedFile, codec);
        for (Feature feat : bfr.iterator()) {
            BasicFeature f = (BasicFeature) feat;
            assertEquals(1, f.getLength());
        }
    }
View Full Code Here

Examples of org.broad.igv.feature.BasicFeature

        @Override
        public Collection<? extends NamedFeature> search(String name, int limit) {
            List<NamedFeature> output = new ArrayList<NamedFeature>(this.mult);
            for(int ii=0; ii < this.mult; ii++){
                BasicFeature bf = new BasicFeature();
                bf.setName(name);
                output.add(bf);
            }
            return output.subList(0, Math.min(output.size(), limit));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.