Package org.broad.igv.feature

Examples of org.broad.igv.feature.NamedFeature


    @Test
    public void testGetFeaturesByName() throws Exception{

        setupUnigene();
        NamedFeature testFeat = getUnigeneTestFeature();

        Collection<? extends NamedFeature> features = this.source.search(testFeat.getName(), 0);
        List<? extends NamedFeature> list = Lists.newArrayList(features);

        assertEquals(1, list.size());
        NamedFeature resFeat = list.get(0);

        TestUtils.assertNamedFeaturesEqual(testFeat, resFeat);
    }
View Full Code Here


    }

    @Test
    public void testSearchCommand() throws Exception{
        setupUnigene();
        NamedFeature testFeat = getUnigeneTestFeature();

        //Need to call this to attach listener
        MongoFeatureSource.loadFeatureTrack(MongoCollabPluginTest.getTestLocator(), new ArrayList<Track>());

        String searchStr = testFeat.getName();
        SearchCommand cmd = new SearchCommand(null, searchStr, false);
        List<SearchCommand.SearchResult> list = cmd.runSearch(searchStr);

        assertEquals(1, list.size());
        SearchCommand.SearchResult result = list.get(0);

        assertEquals(SearchCommand.ResultType.FEATURE, result.getType());
        NamedFeature resFeat = result.getFeature();

        TestUtils.assertNamedFeaturesEqual(testFeat, resFeat);
    }
View Full Code Here

                    continue;
                } else {
                    identifier = identifiers[0];
                }

                NamedFeature gene = FeatureDB.getFeature(identifier.toUpperCase());
                if (gene == null) {
                    log.debug("Unknown identifier: " + identifier);
                    continue;
                }

                for (int i = 0; i < nColumns; i++) {
                    try {
                        int dataIndex = dataStartColumn + i * skip;

                        // If we are out of value tokens, or the cell is blank, assign NAN to the cell.
                        if ((dataIndex >= nTokens) || (tokens[dataIndex].length() == 0)) {
                            values[i] = Float.NaN;
                        } else {
                            values[i] = Float.parseFloat(tokens[dataIndex]);
                        }

                        String sample = columnHeadings[i];
                        RNAIHairpinValue hairpin = new RNAIHairpinValue(probeId, values[i]);
                        RNAIHairpinCache.getInstance().addHairpinScore(sample, gene.getName(),
                                hairpin);

                        HashMap<String, Float> geneScoreMap = sampleGeneScoreMap.get(sample);

                        if (geneScoreMap == null) {
                            geneScoreMap = new HashMap();
                            sampleGeneScoreMap.put(sample, geneScoreMap);
                        }

                        Float geneScore = geneScoreMap.get(gene.getName());
                        if (geneScore == null) {
                            geneScore = values[i];
                            geneScoreMap.put(gene.getName(), geneScore);
                        } else {

                            geneScore = new Float(Math.min(values[i], geneScore.floatValue()));
                            geneScoreMap.put(gene.getName(), geneScore);
                        }
                    } catch (NumberFormatException numberFormatException) {

                        // This is an expected condition.  IGV uses NaN to
                        // indicate non numbers (missing data values)
View Full Code Here

                String[] tokens = nextLine.split("\t");
                if (tokens.length > maxColumn) {
                    try {
                        String batchId = (batchColumn < 0) ? "" : tokens[batchColumn].trim();
                        String geneName = tokens[geneColumn].trim().toUpperCase();
                        NamedFeature gene = FeatureDB.getFeature(geneName);

                        if (gene != null) {
                            float geneScore = Float.NaN;
                            try {
                                geneScore = Float.parseFloat(tokens[scoreColumn]);
View Full Code Here

        // Convert the loci strings to a list of loci, if the loci represents multiple features (e.g. isoforms) use the largest
        int averageFeatureSize = 0;
        List<NamedFeature> loci = new ArrayList<NamedFeature>(lociStrings.size());
        for (String l : lociStrings) {
            NamedFeature feature = FeatureDB.getFeature(l);
            if (feature == null) {
                feature = Locus.fromString(l);
            }
            if (feature != null) {
                loci.add(feature);
                averageFeatureSize += (feature.getEnd() - feature.getStart());
            }
        }
        if (loci.size() > 0) averageFeatureSize /= loci.size();

        // Determine data types -- all data tracks + mutation, and samples
View Full Code Here

TOP

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

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.