Examples of AsciiFeatureCodec


Examples of htsjdk.tribble.AsciiFeatureCodec

    public void testDecode() throws Exception {

        String line = "chr22\t16847690\t16857344\t.\t354\t.\t5.141275\t14.1\t-1";
        EncodePeakCodec codec = new EncodePeakCodec();

        AsciiFeatureCodec codec2 = new EncodePeakCodec();

        assertTrue(codec.getClass() == codec2.getClass());

        Feature feature =  codec.decode(line);
        Feature feature2 = codec2.decode(line);

        assertEquals("chr22", feature.getChr());


    }
View Full Code Here

Examples of htsjdk.tribble.AsciiFeatureCodec

        ResultSet rs = DBManagerTest.getAllFromSQLTable("sql/unigene.db", "unigene");
        InputStream is = new SQLInputStream(rs, true);
        BufferedReader in = new BufferedReader(new InputStreamReader(is));
        int totalLines = 0;
        String val = "";
        AsciiFeatureCodec featureCodec = new IGVBEDCodec(genome);
        while ((val = in.readLine()) != null) {
            Feature feat = featureCodec.decode(val);
            checkFeatureIntegrity(feat, "chr2");
            totalLines += 1;
        }
        assertEquals(72, totalLines);
View Full Code Here

Examples of htsjdk.tribble.AsciiFeatureCodec

import static junit.framework.Assert.assertNotNull;

public class SQLCodecSourceTest {

    private SQLCodecSource getUnigene(String path) {
        AsciiFeatureCodec codec = new IGVBEDCodec();
        String host = (new File(TestUtils.DATA_DIR)).getAbsolutePath();

        String url = DBManager.createConnectionURL("sqlite", host, path, null);
        ResourceLocator locator = new ResourceLocator(url);
        String tableName = "unigene";
View Full Code Here

Examples of htsjdk.tribble.AsciiFeatureCodec

    }

    @Test
    public void testLoadBED() throws Exception {

        AsciiFeatureCodec codec = new IGVBEDCodec();
        String path = "sql/unigene.db";

        SQLCodecSource reader = getUnigene(path);
        Iterator<Feature> SQLFeatures = reader.iterator();
View Full Code Here

Examples of htsjdk.tribble.AsciiFeatureCodec

        checkConnectUCSC();
    }

    @Test
    public void testLoadUCSC() throws Exception {
        AsciiFeatureCodec codec = new UCSCGeneTableCodec(UCSCGeneTableCodec.Type.UCSCGENE, genome);

        String host = UCSC_HOST;

        String path = "hg18";
        String port = null;
View Full Code Here

Examples of htsjdk.tribble.AsciiFeatureCodec

    }


    public static CursorTrack loadTrack(String peakFile) throws IOException {

        AsciiFeatureCodec codec = (AsciiFeatureCodec) CodecFactory.getCodec(new ResourceLocator(peakFile), null);
//        if(codec == null) {
//            // TODO -- inform user
//            System.out.println("Skipping " + peakFile);
//            return null;
//        }

//        EncodePeakCodec codec = new EncodePeakCodec();

        Map<String, List<BasicFeature>> featureMap = new HashMap<String, List<BasicFeature>>();
        BufferedReader br = null;
        TrackProperties props = null;
        try {
            br = ParsingUtils.openBufferedReader(peakFile);

            String nextLine;
            while ((nextLine = br.readLine()) != null) {
                if (nextLine.startsWith("track")) {
                    props = new TrackProperties();
                    ParsingUtils.parseTrackLine(nextLine, props);
                } else {
                    BasicFeature f = (BasicFeature) codec.decode(nextLine);
                    if (f != null) {
                        String chr = f.getChr();
                        List<BasicFeature> featureList = featureMap.get(chr);
                        if (featureList == null) {
                            featureList = new ArrayList<BasicFeature>();
                            featureMap.put(chr, featureList);
                        }
                        featureList.add(f);
                    }
                }
            }
        } finally {
            if (br != null) br.close();
        }


        for (List<BasicFeature> featureList : featureMap.values()) {
            Collections.sort(featureList, new Comparator<BasicFeature>() {
                @Override
                public int compare(BasicFeature o1, BasicFeature o2) {
                    return o1.getStart() - o2.getStart();
                }
            });

        }

        CursorTrack track = new CursorTrack(featureMap, codec.getFeatureType());
        String trackName = (new File(peakFile)).getName();
        Color trackColor = null;
        if (props != null) {
            trackColor = props.getColor();
            trackName = props.getName();
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.