本文整理汇总了Java中htsjdk.tribble.util.LittleEndianOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java LittleEndianOutputStream类的具体用法?Java LittleEndianOutputStream怎么用?Java LittleEndianOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LittleEndianOutputStream类属于htsjdk.tribble.util包,在下文中一共展示了LittleEndianOutputStream类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: makeTabixCompressedIndex
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
private void makeTabixCompressedIndex(final File sourceFile, final File indexFile, final AsciiFeatureCodec codec,
final TabixFormat format) throws IOException {
TabixIndexCreator indexCreator = new TabixIndexCreator(format);
try (
BlockCompressedInputStream inputStream = new BlockCompressedInputStream(
new FileInputStream(sourceFile));
LittleEndianOutputStream outputStream = new LittleEndianOutputStream(
new BlockCompressedOutputStream(indexFile))
) {
long p = 0;
String line = inputStream.readLine();
while (line != null) {
//add the feature to the index
Feature decode = codec.decode(line);
if (decode != null) {
indexCreator.addFeature(decode, p);
}
// read the next line if available
p = inputStream.getFilePointer();
line = inputStream.readLine();
}
// write the index to a file
Index index = indexCreator.finalizeIndex(p);
// VERY important! either use write based on input file or pass the little endian a BGZF stream
index.write(outputStream);
}
}
开发者ID:epam,项目名称:NGB,代码行数:31,代码来源:FileManager.java
示例2: addFeature
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
public void addFeature(int tid, Node feature, long filepointer, LittleEndianOutputStream los) throws IOException {
if(tid > BinIndexWriter.SHORT_MAX) throw new IllegalArgumentException("Currently we don't support to index file which has chr numbers larger than 32767.");
los.writeShort(tid);
//edit for case: start == end
if(feature.beg > feature.end) {
throw new IllegalArgumentException(String.format("Feature start position %d > feature end position %d", feature.beg, feature.end));
}
los.writeInt(feature.beg);
if((feature.end - feature.beg) > BinIndexWriter.SHORT_MAX) {
// System.out.println("range:" + (feature.end - feature.beg));
los.writeShort(BinIndexWriter.INT_START);
los.writeInt(feature.end - feature.beg);
} else {
los.writeShort(feature.end - feature.beg);
}
los.writeLong(filepointer);
}
开发者ID:mulinlab,项目名称:vanno,代码行数:20,代码来源:AppendixFileWriter.java
示例3: makeIndex
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
public void makeIndex(final String plusFile, final String path) {
try {
final File tempFile = new File(plusFile + BinIndexWriter.TEMP);
BlockCompressedInputStream reader = BasicUtils.checkStream(new File(path));
LittleEndianOutputStream los = new LittleEndianOutputStream(new BlockCompressedOutputStream(tempFile));
readBGZInputstream(reader, los);
los.writeShort(BinIndexWriter.PLUS_FILE_END);
writeOthers(los);
los.close();
boolean success = tempFile.renameTo(new File(plusFile));
if (!success) {
System.err.println("Make index has completed. But rename from '" + tempFile.getAbsolutePath() + "' to '" + plusFile + "' with error. ");
System.exit(1);
}
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:mulinlab,项目名称:vanno,代码行数:20,代码来源:AppendixFileWriter.java
示例4: makeIndex
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
public void makeIndex() {
try {
final String outputPath = path + IntervalIndex.PLUS_EXTENSION;
final File outputFile = new File(outputPath + IntervalIndex.TEMP);
BlockCompressedInputStream reader = checkStream(new File(path));
LittleEndianOutputStream los = new LittleEndianOutputStream(new BlockCompressedOutputStream(outputFile));
readBGZInputstream(reader, los);
los.writeInt(IntervalIndex.PLUS_FILE_END);
writeOthers(los);
los.close();
boolean success = outputFile.renameTo(new File(outputPath));
if (!success) {
System.err.println("Make index has completed. But rename from '" + outputFile.getAbsolutePath() + "' to '" + outputPath + "' with error. ");
} else {
throw new IllegalArgumentException("We currently support bgz file format. please use bgzip to compress your file!");
}
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:mulinlab,项目名称:vanno,代码行数:24,代码来源:CollectionFileWriter.java
示例5: readBGZInputstream
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
public void readBGZInputstream(BlockCompressedInputStream reader, LittleEndianOutputStream los) throws IOException {
String s, seqName = "", chr;
long filepointer = 0;
int tid = 0, linesSkiped = 0;
Node feature, preFeature = null;
while((s = reader.readLine()) != null) {
if(++linesSkiped > formatSpec.tbiFormat.numHeaderLinesToSkip && (s.trim().charAt(0) != formatSpec.tbiFormat.metaCharacter) && !s.trim().equals("") ) {
feature = decodeFeature(s);
chr = feature.chr;
if(!chr.equals(seqName)) {
System.out.println("Writing plus file for chr " + chr);
addSeqsName(chr);
seqName = chr;
tid = sequenceNames.size() - 1;
preFeature = null;
}
if(preFeature != null) {
if(feature.beg < preFeature.beg) {
throw new IllegalArgumentException(String.format("Features added out of order: next start " + feature + " < previous start" + preFeature + ", please sorted features by chr column, start column, end column."));
}
// else if(feature.beg == preFeature.beg) {
// if(feature.end < preFeature.end) {
// throw new IllegalArgumentException(String.format("Features added out of order: next end " + feature + " < previous end" + preFeature + ", please sorted features by chr column, start column, end column."));
// }
// }
}
addFeature(tid, feature, filepointer, los);
preFeature = feature;
}
filepointer = reader.getFilePointer();
}
reader.close();
}
开发者ID:mulinlab,项目名称:vanno,代码行数:35,代码来源:AppendixFileWriter.java
示例6: addFeature
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
public void addFeature(int tid, Node feature, long filepointer, LittleEndianOutputStream los) throws IOException {
los.writeInt(tid);
if(feature.beg >= feature.end) {
throw new IllegalArgumentException(String.format("Feature start position %d >= feature end position %d", feature.beg, feature.end));
}
los.writeInt(feature.beg);
// System.out.println(feature.beg + "," + feature.end);
los.writeInt(feature.end-feature.beg);
los.writeLong(filepointer);
}
开发者ID:mulinlab,项目名称:vanno,代码行数:11,代码来源:CollectionFileWriter.java
示例7: readBGZInputstream
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
public void readBGZInputstream(BlockCompressedInputStream reader, LittleEndianOutputStream los) throws IOException {
String s, seqName = "", chr;
long filepointer = 0;
int tid = 0;
Node feature, preFeature = null;
while((s = reader.readLine()) != null) {
if(!s.trim().startsWith(VCFHeader.HEADER_INDICATOR) && !s.trim().equals("")) {
feature = decodeFeature(s);
chr = feature.chr;
if(!chr.equals(seqName)) {
addSeqsName(chr);
seqName = chr;
tid = sequenceNames.size() - 1;
preFeature = null;
}
if(preFeature != null) {
if(feature.beg < preFeature.beg) {
throw new IllegalArgumentException(String.format("Features added out of order: next start " + feature + " < previous start" + preFeature + ", please sorted features by chr column, start column, end column."));
} else if(feature.beg == preFeature.beg) {
if(feature.end < preFeature.end) {
throw new IllegalArgumentException(String.format("Features added out of order: next end " + feature + " < previous end" + preFeature + ", please sorted features by chr column, start column, end column."));
}
}
}
addFeature(tid, feature, filepointer, los);
preFeature = feature;
}
filepointer = reader.getFilePointer();
}
reader.close();
}
开发者ID:mulinlab,项目名称:vanno,代码行数:33,代码来源:CollectionFileWriter.java
示例8: createGeneCompressedIndex
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
private void createGeneCompressedIndex(File indexFile, File file, GffCodec.GffType gffType) throws IOException {
AsciiFeatureCodec<GeneFeature> codec = new GffCodec(gffType);
TabixIndexCreator indexCreator = new TabixIndexCreator(TabixFormat.GFF);
try (
BlockCompressedInputStream inputStream = new BlockCompressedInputStream(new FileInputStream(file));
LittleEndianOutputStream outputStream = new LittleEndianOutputStream(
new BlockCompressedOutputStream(indexFile))
) {
long p = 0;
String line = inputStream.readLine();
while (line != null) {
//add the feature to the index
GeneFeature decode = codec.decode(line);
if (decode != null) {
indexCreator.addFeature(decode, p);
}
// read the next line if available
p = inputStream.getFilePointer();
line = inputStream.readLine();
}
// write the index to a file
Index index = indexCreator.finalizeIndex(p);
// VERY important! either use write based on input file or pass the little endian a BGZF stream
index.write(outputStream);
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:30,代码来源:FileManager.java
示例9: writeChromosomeData
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
private static void writeChromosomeData(LittleEndianOutputStream peakWriter,
LinkedHashMap<String, Long> chrIndex,
String currentChr,
List<PeakRecord> records) throws IOException {
chrIndex.put(currentChr, peakWriter.getWrittenCount());
// Compress data for chromosome, then write it out.
BufferedByteWriter buffer = new BufferedByteWriter(100000);
buffer.putNullTerminatedString(currentChr);
buffer.putInt(records.size());
for (PeakRecord record : records) {
buffer.putInt(record.start);
buffer.putInt(record.end);
buffer.putFloat(record.score);
for (int i = 0; i < record.timeScores.length; i++) {
buffer.putFloat(record.timeScores[i]);
}
}
byte[] bytes = buffer.getBytes();
bytes = compressionUtils.compress(bytes);
peakWriter.writeInt(bytes.length);
peakWriter.write(bytes);
records.clear();
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:29,代码来源:BedToPeaks.java
示例10: convert
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
/**
* @param inputPath
* @param outputFile
* @param chromosomeHandler
*/
public static void convert(String inputPath, String outputFile, ChromosomeHandler chromosomeHandler) throws IOException {
Map<String, Integer> chromosomeOrdinals = new HashMap<>();
for (Chromosome c : chromosomeHandler.getChromosomeArray()) {
chromosomeOrdinals.put(c.getName(), c.getIndex());
}
AsciiPairIterator iter = null;
BufferedOutputStream bos = null;
try {
bos = new BufferedOutputStream(new FileOutputStream(outputFile));
LittleEndianOutputStream les = new LittleEndianOutputStream(bos);
iter = new AsciiPairIterator(inputPath, chromosomeOrdinals
);
while (iter.hasNext()) {
AlignmentPair pair = iter.next();
les.writeBoolean(pair.getStrand1());
les.writeInt(pair.getChr1());
les.writeInt(pair.getPos1());
les.writeInt(pair.getFrag1());
les.writeBoolean(pair.getStrand2());
les.writeInt(pair.getChr2());
les.writeInt(pair.getPos2());
les.writeInt(pair.getFrag2());
}
les.flush();
bos.flush();
} finally {
if (iter != null) iter.close();
if (bos != null) bos.close();
}
}
开发者ID:theaidenlab,项目名称:Juicebox,代码行数:40,代码来源:AsciiToBinConverter.java
示例11: writeHeader
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
private void writeHeader(LittleEndianOutputStream les, int dim, float lower, float upper) throws IOException {
// Magic number - 4 bytes
les.writeByte('h');
les.writeByte('i');
les.writeByte('c');
les.writeByte(0);
// Version number
les.writeInt(1);
// Genome --
les.writeString(dataset.getGenomeId());
// Chromosomes
les.writeString(chromosome1.getName());
les.writeString(chromosome1.getName());
// Resolution (bin size)
les.writeInt(binSize);
// Statistics, other attributes
les.writeFloat(lower); // this is supposed to be lower quartile
les.writeFloat(upper); // this is supposed to be upper quartile
les.writeInt(dim); // # rows
les.writeInt(dim); // # cols
les.writeInt(BLOCK_TILE);
}
开发者ID:theaidenlab,项目名称:Juicebox,代码行数:29,代码来源:Pearsons.java
示例12: writeOthers
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
public void writeOthers(final LittleEndianOutputStream los) {
writeOthers(this.formatSpec, sequenceNames, los);
}
开发者ID:mulinlab,项目名称:vanno,代码行数:4,代码来源:AppendixFileWriter.java
示例13: writeOthers
import htsjdk.tribble.util.LittleEndianOutputStream; //导入依赖的package包/类
public void writeOthers(LittleEndianOutputStream los) {
writeOthers(this.formatSpec, sequenceNames, los);
}
开发者ID:mulinlab,项目名称:vanno,代码行数:4,代码来源:CollectionFileWriter.java
注:本文中的htsjdk.tribble.util.LittleEndianOutputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论