Package htsjdk.tribble

Examples of htsjdk.tribble.FeatureCodec


    @Test
    public void basicTestReadBinary() throws Exception {
        ResultSet rs = DBManagerTest.getAllFromSQLTable("sql/unigene.db", "unigene");
        SQLInputStream is = new SQLInputStream(rs, false, 1, 3);

        FeatureCodec featCodec = new ExampleBinaryCodec();
        PositionalBufferedStream pbs = new PositionalBufferedStream(is);
        int count = 0;
        while (!rs.isAfterLast()) {
            Feature feat = featCodec.decode(pbs);
            checkFeatureIntegrity(feat, "chr2");
            count++;
        }
        assertEquals(72, count);
View Full Code Here


    /**
     * @param table
     * @return a SQLCodecSource, or null if no appropriate codec found
     */
    public static SQLCodecSource getFromTable(DBProfile.DBTable table) {
        FeatureCodec codec = CodecFactory.getCodec("." + table.getFormat(), GenomeManager.getInstance().getCurrentGenome());
        if (codec != null && codec instanceof AsciiFeatureCodec) {
            return new SQLCodecSource(table, (AsciiFeatureCodec) codec);
        }
        return null;
    }
View Full Code Here

            throw new RuntimeException(e);
        }


        Genome genome = null// <= don't do chromosome conversion
        FeatureCodec codec = CodecFactory.getCodec(ifile, genome);
        if (codec != null) {
            try {
                createTribbleIndex(ifile, outputFile, indexType, binSize, codec);
            } catch (TribbleException.MalformedFeatureFile e) {
                StringBuffer buf = new StringBuffer();
View Full Code Here

     * @param collection
     * @param path
     * @return The number of features inserted
     */
    static int insertFeaturesFromFile(DBCollection collection, String path) {
        FeatureCodec codec = CodecFactory.getCodec(path, GenomeManager.getInstance().getCurrentGenome());

        if (codec != null) {
            AbstractFeatureReader<Feature, ?> bfs = AbstractFeatureReader.getFeatureReader(path, codec, false);

            Iterable<Feature> iter = null;
View Full Code Here

    private class TribbleIndexWorker extends IndexWorker<Index> {
        @Override
        protected Index doInBackground() throws Exception {
            int binSize = IgvTools.LINEAR_BIN_SIZE;
            FeatureCodec codec = CodecFactory.getCodec(file.getAbsolutePath(), GenomeManager.getInstance().getCurrentGenome());
            if (codec != null) {
                try {
                    Index index = IndexFactory.createLinearIndex(file, codec, binSize);
                    if (index != null) {
                        IgvTools.writeTribbleIndex(index, idxFile.getAbsolutePath());
View Full Code Here

    /**
     * Return an parser instance appropriate the the file type.  Currently the filename
     * is used to determine file type, this is fragile obviously but what is the alternative?
     */
    public static FeatureParser getInstanceFor(ResourceLocator locator, Genome genome) {
        FeatureCodec codec = CodecFactory.getCodec(locator, genome);
        if (codec != null && codec instanceof AsciiFeatureCodec) {
            return new FeatureCodecParser((AsciiFeatureCodec) codec, genome);
        } else {
            return null;
        }
View Full Code Here

        Genome genome = TestUtils.loadGenome();
        List<Track> tracks = loader.load(locator, genome);

        assertEquals(1, tracks.size());

        FeatureCodec codec = CodecFactory.getCodec(locator, genome);
        AbstractFeatureReader<Feature, ?> bfs = AbstractFeatureReader.getFeatureReader(locator.getPath(), codec, false);
        Iterable<Feature> iter = bfs.iterator();
        int count = 0;
        for (Feature f : iter) {
            if (count == 0) {
View Full Code Here

        Genome genome = TestUtils.loadGenome();
        List<Track> tracks = loader.load(locator, genome);

        assertEquals(1, tracks.size());

        FeatureCodec codec = CodecFactory.getCodec(locator.getPath(), genome);
        AbstractFeatureReader<Feature, ?> bfs = AbstractFeatureReader.getFeatureReader(locator.getPath(), codec, false);
        Iterable<Feature> iter = bfs.iterator();
        int count = 0;
        for (Feature f : iter) {
            if (count == 0) {
View Full Code Here

    CachingFeatureReader cacheReader;

    @Before
    public void setUp() throws IOException {
        Genome genome = null; // <= don't do chromosome alias conversion
        FeatureCodec codec = CodecFactory.getCodec(path, null);
        baseReader =    AbstractFeatureReader.getFeatureReader(path, path + ".tbi", codec, true);
        cacheReader = new CachingFeatureReader(baseReader);

    }
View Full Code Here

        AbstractFeatureReader basicReader = null;
        PrintWriter writer = null;
        try {
            writer = new PrintWriter(new BufferedWriter(new FileWriter(bedFile)));
            Genome genome = null; // Don't do alias converting
            FeatureCodec codec = CodecFactory.getCodec(vcfFile, genome);
            boolean isVCF = codec.getClass().isAssignableFrom(VCFCodec.class);
            basicReader = AbstractFeatureReader.getFeatureReader(vcfFile, codec, true);

            Iterator<VariantContext> iter = basicReader.iterator();

            while (iter.hasNext()) {
View Full Code Here

TOP

Related Classes of htsjdk.tribble.FeatureCodec

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.