当前位置: 首页>>代码示例>>Java>>正文


Java CompressionUtils类代码示例

本文整理汇总了Java中org.broad.igv.util.CompressionUtils的典型用法代码示例。如果您正苦于以下问题:Java CompressionUtils类的具体用法?Java CompressionUtils怎么用?Java CompressionUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompressionUtils类属于org.broad.igv.util包,在下文中一共展示了CompressionUtils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TDFReader

import org.broad.igv.util.CompressionUtils; //导入依赖的package包/类
public TDFReader(ResourceLocator locator) {
    //this.path = path;
    this.locator = locator;
    try {
        log.debug("Getting stream");
        seekableStream = IGVSeekableStreamFactory.getInstance().getStreamFor(locator.getPath());
        log.debug("Reading header");
        readHeader();
        log.debug("Done reading header");

    } catch (IOException ex) {
        log.error("Error loading file: " + locator.getPath(), ex);
        throw new DataLoadException("Error loading file: " + ex.toString(), locator.getPath());
    }
    compressionUtils = new CompressionUtils();
}
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:17,代码来源:TDFReader.java

示例2: TDFWriter

import org.broad.igv.util.CompressionUtils; //导入依赖的package包/类
public TDFWriter(File f,
                     String genomeId,
                     TrackType trackType,
                     String trackLine, String[] trackNames,
                     Collection<WindowFunction> windowFunctions,
                     boolean compressed) {

        if (f.getName().endsWith(".tdf")) {
            this.file = f;
        } else {
            this.file = new File(f.getAbsolutePath() + ".tdf");
        }
        this.compressed = compressed;

        try {
//            OutputStream os;
//            if(file != null){
//                os = new FileOutputStream(file);
//            }else{
//                //TODO be able to write TDF to output stream. Would need to buffer because
//                //index position is at the beginning.
//                os = System.out;
//            }
            fos = new BufferedOutputStream(new FileOutputStream(file));
            writeHeader(genomeId, trackType, trackLine, trackNames, windowFunctions);

            TDFGroup rootGroup = new TDFGroup("/");
            groupCache.put(rootGroup.getName(), rootGroup);

        } catch (IOException ex) {
            log.error("Error opening output stream to file: " + file, ex);
            throw new DataLoadException("Error creating file", "" + file);
        }

        compressionUtils = new CompressionUtils();
    }
 
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:37,代码来源:TDFWriter.java

示例3: DatasetReaderV2

import org.broad.igv.util.CompressionUtils; //导入依赖的package包/类
public DatasetReaderV2(String path) throws IOException {

        super(path);
        this.stream = IGVSeekableStreamFactory.getInstance().getStreamFor(path);

        if (this.stream != null) {
            masterIndex = new HashMap<>();
            dataset = new Dataset(this);
        }
        compressionUtils = new CompressionUtils();
        blockIndexMap = new HashMap<>();
    }
 
开发者ID:theaidenlab,项目名称:Juicebox,代码行数:13,代码来源:DatasetReaderV2.java

示例4: BigBedDataBlock

import org.broad.igv.util.CompressionUtils; //导入依赖的package包/类
public BigBedDataBlock(SeekableStream fis, RPTreeLeafNodeItem leafHitItem,
                       HashMap<Integer, String> chromosomeMap, boolean isLowToHigh, int uncompressBufSize) {

    this.leafHitItem = leafHitItem;
    this.chromosomeMap = chromosomeMap;
    this.isLowToHigh = isLowToHigh;

    dataBlockSize = this.leafHitItem.geDataSize();
    byte[] buffer = new byte[(int) dataBlockSize];

    fileOffset = this.leafHitItem.getDataOffset();

    // read Bed data block into a buffer
    try {
        fis.seek(fileOffset);
        fis.readFully(buffer);

        // decompress if necessary - the buffer size is 0 for uncompressed data
        // Note:  BBFile Table C specifies a decompression buffer size
        if (uncompressBufSize > 0)
            bedBuffer = (new CompressionUtils()).decompress(buffer, uncompressBufSize);
        else
            bedBuffer = buffer;    // use uncompressed read buffer directly

    } catch (IOException ex) {
        String error = String.format("Error reading Bed data for leaf item %d \n");
        log.error(error, ex);
        throw new RuntimeException(error, ex);
    }

    // wrap the bed buffer as an input stream
    if (this.isLowToHigh)
        lbdis = new LittleEndianInputStream(new ByteArrayInputStream(bedBuffer));
    else
        dis = new DataInputStream(new ByteArrayInputStream(bedBuffer));

    // initialize unread data size
    remDataSize = bedBuffer.length;

    // use methods getBedData or getNextFeature to extract block data
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:42,代码来源:BigBedDataBlock.java

示例5: BedToPeaks

import org.broad.igv.util.CompressionUtils; //导入依赖的package包/类
public BedToPeaks() {
    compressionUtils = new CompressionUtils();
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:4,代码来源:BedToPeaks.java

示例6: PeakParser

import org.broad.igv.util.CompressionUtils; //导入依赖的package包/类
public PeakParser(String path) throws IOException {
    this.path = path;
    loadHeader();
    compressionUtils = new CompressionUtils();
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:6,代码来源:PeakParser.java

示例7: process

import org.broad.igv.util.CompressionUtils; //导入依赖的package包/类
public void process(String inputFile, String outputFile) throws IOException {

        bytesWritten = 0;
        BufferedReader br = null;
        fos = null;
        currentChr = null;
        currentChrBuffer = null;
        chrPositionMap = new HashMap<String, IndexEntry>();
        compressionUtils = new CompressionUtils();
        EQTLCodec codec = new EQTLCodec(null);

        try {
            fos = new FileOutputStream(outputFile);
            writeHeader();

            br = new BufferedReader(new FileReader(inputFile));
            String nextLine = br.readLine();

            while ((nextLine = br.readLine()) != null) {

                EQTLFeature feature = codec.decode(nextLine);
                String chr = feature.getChr();
                if (!chr.equals(currentChr)) {
                    if (currentChrBuffer != null) {
                        System.out.println(currentChr);
                        writeChrBuffer();
                    }
                    currentChr = chr;
                    currentChrBuffer = new BufferedByteWriter();
                }

                currentChrBuffer.put(feature.encodeBinary());

            }
            if (currentChrBuffer != null) {
                writeChrBuffer();
            }

            long position = bytesWritten;
            int nBytes = writeIndex();
            fos.close();

            writeIndexPosition(outputFile, position, nBytes);

        } finally {
            if (br != null) br.close();
        }

    }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:50,代码来源:EqtlPreprocessor.java


注:本文中的org.broad.igv.util.CompressionUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。