Examples of FeatureSource


Examples of org.broad.igv.track.FeatureSource

     * @throws Exception
     */
    @Test
    public void loadBCF() throws Exception {
        String path = TestUtils.DATA_DIR + "bcf/ex2.bcf";
        FeatureSource source = TribbleFeatureSource.getFeatureSource(new ResourceLocator(path), genome);
        Iterator<Feature> features = source.getFeatures("chr20", 14000, 1300000);
        int count = 0;

        while (features.hasNext()) {
            features.next();
            count++;
View Full Code Here

Examples of org.broad.igv.track.FeatureSource

     * @throws Exception
     */
    @Test
    public void compareBCFtoVCF() throws Exception {
        String BCF2path = TestUtils.DATA_DIR + "bcf/ex2.bcf";
        FeatureSource BCF2source = TribbleFeatureSource.getFeatureSource(new ResourceLocator(BCF2path), genome);
        Iterator<Feature> BCF2features = BCF2source.getFeatures("chr20", 14000, 1300000);
        List<VCFVariant> BCF2List = new ArrayList<VCFVariant>();

        String VCFpath = TestUtils.DATA_DIR + "vcf/ex2.vcf";
        TestUtils.createIndex(VCFpath);
        FeatureSource VCFsource = TribbleFeatureSource.getFeatureSource(new ResourceLocator(VCFpath), genome);
        Iterator<Feature> VCFfeatures = VCFsource.getFeatures("chr20", 14000, 1300000);
        List<VCFVariant> VCFList = new ArrayList<VCFVariant>();

        while (BCF2features.hasNext()) {
            VCFVariant bcfV = (VCFVariant) BCF2features.next();
            VCFVariant vcfV = (VCFVariant) VCFfeatures.next();
View Full Code Here

Examples of org.broad.igv.track.FeatureSource

    @Test
    public void testIntersectBED() throws Exception {
        List<Feature> actFeatures = tstOperationBED3("intersect", 4);
        String expectedPath = TestUtils.DATA_DIR + "bed/isect_res.bed";
        TestUtils.createIndex(expectedPath);
        FeatureSource expFeatureSource = TribbleFeatureSource.getFeatureSource(new ResourceLocator(expectedPath), genome);
        Iterator<Feature> expFeatures = expFeatureSource.getFeatures("chr1", 0, (int) 1e6);
        TestUtils.assertFeatureListsEqual(expFeatures, actFeatures.iterator());
    }
View Full Code Here

Examples of org.broad.igv.track.FeatureSource

            Track newTrack = null;
            switch (outputAttr.type) {
                case FEATURE_TRACK:
                    PluginFeatureSource featSource1 = new PluginFeatureSource(cmdList, argumentValues, outputAttr, specPath, this.forbidEmptyOutput);
                    //featSource1.setQueryTracker(queryTracker);
                    FeatureSource featSource = new CachingFeatureSource(featSource1);
                    newTrack = new FeatureTrack(UUID.randomUUID().toString(), name, featSource);
                    break;
                case DATA_SOURCE_TRACK:
                    PluginDataSource dataSource = new PluginDataSource(GenomeManager.getInstance().getCurrentGenome(), cmdList, argumentValues, outputAttr, specPath);
                    //dataSource.setQueryTracker(queryTracker);
                    newTrack = new DataSourceTrack(null, UUID.randomUUID().toString(), name, dataSource);
                    break;
                case VARIANT_TRACK:
                    PluginFeatureSource VfeatSource1 = new PluginFeatureSource(cmdList, argumentValues, outputAttr, specPath, this.forbidEmptyOutput);
                    FeatureSource VfeatSource = new CachingFeatureSource(VfeatSource1);
                    newTrack = new VariantTrack(name, VfeatSource);
                    break;
            }
            newTracks.add(newTrack);
        }
View Full Code Here

Examples of org.broad.igv.track.FeatureSource

        String path = TestUtils.DATA_DIR + "gff/gffWithFasta.gff";
        final ResourceLocator locator = new ResourceLocator(path);

        TribbleFeatureSource tribbleFeatureSource = TribbleFeatureSource.getFeatureSource(locator, genome);
        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

Examples of org.geotools.data.FeatureSource

* @since 1.1.0
*/
public class EditEventListeners {

    public void createAndAddListener(Layer layer, IProgressMonitor monitor) throws IOException {
        FeatureSource source=layer.getResource(FeatureSource.class, monitor);
        source.addFeatureListener(new FeatureListener(){

            public void changed( FeatureEvent featureEvent ) {
                switch( featureEvent.getEventType() ) {
                case FeatureEvent.FEATURES_ADDED:
                    // do something
View Full Code Here

Examples of org.geotools.data.FeatureSource

       
        DataAccess dataStore = service.resolve( DataStore.class, null );
        assertNotNull("DataStore connected", dataStore );
       
        Name typeName = (Name) dataStore.getNames().get(0);;
        FeatureSource featureSource = dataStore.getFeatureSource( typeName );
       
        assertEquals( 4, featureSource.getCount( Query.ALL ) );
       
        //IServiceInfo info = service.getInfo(new NullProgressMonitor());
        IServiceInfo info = getInfo(service, new NullProgressMonitor());
        assertNotNull("Title available", info.getTitle());
        assertNotNull("Description available", info.getDescription());
View Full Code Here

Examples of org.geotools.data.FeatureSource

            }
            features.clear();
           
            if (oldInput != null && oldInput instanceof AdaptableFeatureCollection) {
                AdaptableFeatureCollection old = (AdaptableFeatureCollection) oldInput;
                FeatureSource source = (FeatureSource) old.getAdapter(FeatureSource.class);
                if (source != null) {
                    source.removeFeatureListener(listener);
                }
            }
            if (newInput != null && newInput instanceof AdaptableFeatureCollection) {
                AdaptableFeatureCollection input = (AdaptableFeatureCollection) newInput;
                FeatureSource source = (FeatureSource) input.getAdapter(FeatureSource.class);
                if (source != null) {
                    source.addFeatureListener(listener);
                } else {
                    UiPlugin.trace(UiPlugin.ID, FeatureTableContentProvider.class,
                            "Unable to adapt to FeatureSource (to listen for changes):" + input,
                            null);
                }
View Full Code Here

Examples of org.geotools.data.FeatureSource

           
            // Construct a envelope from the transformed coordinate
            Envelope env = new Envelope(new Coordinate(to[0],to[1]));

            // Query the feature source to get the features that intersect with that coordinate
            FeatureSource source = layer.getResource(FeatureSource.class, ProgressManager.instance().get());
            FeatureCollection features = source.getFeatures(layer.createBBoxFilter(env, ProgressManager.instance().get()));
           
            // do something with the features...
           
        }catch( Throwable t ){
            // do something smart, notify user probably.
View Full Code Here

Examples of org.geotools.data.FeatureSource

    @SuppressWarnings("unchecked")
    public boolean canRender(IRenderContext context) {
        try {
            IGeoResource geoResource = context.getGeoResource();
            if( geoResource.canResolve(ShapefileDataStore.class)){
                FeatureSource featureSource=geoResource.resolve(FeatureSource.class, null);
               
                boolean notAView = !(featureSource instanceof DefaultView);
                boolean isAShapefile = (featureSource.getDataStore() instanceof ShapefileDataStore);
                return notAView && featureSource!=null && isAShapefile;
            }
        }
        catch( Throwable t ) {
        }
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.