Package htsjdk.tribble

Examples of htsjdk.tribble.AbstractFeatureReader


    }

    public static <T extends Range> List<T> parse(AsciiFeatureCodec<T> codec, String path) throws IOException {
        List<T> values = new ArrayList<T>();
        AbstractFeatureReader reader = AbstractFeatureReader.getFeatureReader(path, codec, false);
        Iterator<T> iter = reader.iterator();
        while(iter.hasNext()){
            values.add(iter.next());
        }
        return values;
    }
View Full Code Here


        FeatureCodec codec1 = CodecFactory.getCodec(bedFile, genome);
        assertTrue(codec1 instanceof IGVBEDCodec);
        IGVBEDCodec codec = (IGVBEDCodec) codec1;

        AbstractFeatureReader bfr = AbstractFeatureReader.getFeatureReader(bedFile, codec, false);
        FeatureFileHeader header = (FeatureFileHeader) bfr.getHeader();
        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());
View Full Code Here

        String bedFile = TestUtils.DATA_DIR + "bed/intervalTest.bed";

        // Interval index
        TestUtils.createIndex(bedFile, IgvTools.INTERVAL_INDEX, 100);

        AbstractFeatureReader bfr = AbstractFeatureReader.getFeatureReader(bedFile, codec);
        Iterator<Feature> iter = bfr.query("chr1", 0, Integer.MAX_VALUE);
        int count = 0;
        while (iter.hasNext()) {
            Feature feat = iter.next();
            if (count == 0) {
                //Check we don't skip first line
View Full Code Here

        String chr = "chr2";
        int start = 178707289 / 2;
        int end = 179973464 * 2;

        AbstractFeatureReader bfr = AbstractFeatureReader.getFeatureReader(bedFile, codec);
        Iterator<Feature> iter = bfr.query(chr, start, end);
        int count = 0;
        while (iter.hasNext()) {
            Feature feat = iter.next();
            if (count == 0) {
                //Check we don't skip first line
                assertEquals(178707289, feat.getStart() - startOffset);
            }
            check_feat_unigene(feat, chr, start, end);
            count++;
        }

        assertEquals(71, count);

        //Re-query with some restrictions
        count = 0;
        start = 178709699;
        end = 179721089;
        iter = bfr.query(chr, start, end);
        while (iter.hasNext()) {
            Feature feat = iter.next();
            check_feat_unigene(feat, chr, start, end);
            count++;
        }
View Full Code Here

        int start = 1718546;
        int end = 1748915;
        int[] expectedStarts = {1718547, 1718829, 1723079, 1724830, 1731376, 1733967, 1735586, 1736016, 1738594,
                1739272, 1741124, 1742815, 1743224, 1748886, 1748914};

        AbstractFeatureReader bfr = AbstractFeatureReader.getFeatureReader(testFile, codec);
        Iterator<VariantContext> iter = bfr.query(chr, start, end);
        int count = 0;
        while (iter.hasNext()) {
            VariantContext feat = iter.next();
            int expStart = expectedStarts[count];
            assertEquals(expStart, feat.getStart());
View Full Code Here

        Predicate<Feature> overlapPred = FeatureUtils.getOverlapPredicate(chr, start, end);
        Range range = new Range(chr, start, end);

        TrackMenuUtils.exportVisibleFeatures(outPath, loadedTrack, range);

        AbstractFeatureReader bfs = AbstractFeatureReader.getFeatureReader(outPath, CodecFactory.getCodec(outPath, genome), false);
        Iterator<Feature> iter = bfs.iterator();
        int count = 0;
        while(iter.hasNext()){
            Feature feat = iter.next();

            assertTrue(overlapPred.apply(feat));
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testJunctionFile() throws Exception {
        String bedFile = TestUtils.DATA_DIR + "bed/mini.junctions.bed";
        AbstractFeatureReader bfr = AbstractFeatureReader.getFeatureReader(bedFile, new IGVBEDCodec(), false);
        Iterator<BasicFeature> iter = bfr.iterator();
        while (iter.hasNext()) {
            BasicFeature feature = iter.next();
            assertTrue( feature instanceof SpliceJunctionFeature);
            SpliceJunctionFeature sjf = (SpliceJunctionFeature) feature;
            assertTrue(sjf.getJunctionDepth() > 0);
View Full Code Here

        TestUtils.createIndex(testDataPath);
    }

    private Iterable getFeatures(String chr) throws Exception {
        FeatureCodec codec = CodecFactory.getCodec(testDataPath, genome);
        AbstractFeatureReader bfs = AbstractFeatureReader.getFeatureReader(testDataPath, codec, true);
        if(chr == null) return bfs.iterator();
        return bfs.query(chr, 0, Integer.MAX_VALUE);
    }
View Full Code Here

        FeatureCodec codec = CodecFactory.getCodec(vcfFile, genome);
        boolean isVCF = codec.getClass().isAssignableFrom(VCFCodec.class);

        TestUtils.createIndex(vcfFile);

        AbstractFeatureReader basicReader = AbstractFeatureReader.getFeatureReader(vcfFile, codec, true);
        CloseableTribbleIterator it = basicReader.iterator();
        List<VCFVariant> features = new ArrayList<VCFVariant>();
        while (it.hasNext()) {
            VCFVariant next = (VCFVariant) it.next();
            features.add(next);
        }
View Full Code Here

        SQLCodecSource reader = getUnigene(path);
        Iterator<Feature> SQLFeatures = reader.iterator();

        String bedFile = TestUtils.DATA_DIR + "/bed/Unigene.sample.bed";
        AbstractFeatureReader bfr = AbstractFeatureReader.getFeatureReader(bedFile, codec, false);
        Iterator<Feature> fileFeatures = bfr.iterator();

        int count = 0;
        while (SQLFeatures.hasNext()) {
            Feature f = SQLFeatures.next();
            Feature fileFeature = fileFeatures.next();
View Full Code Here

TOP

Related Classes of htsjdk.tribble.AbstractFeatureReader

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.