本文整理汇总了Java中htsjdk.tribble.readers.AsciiLineReader类的典型用法代码示例。如果您正苦于以下问题:Java AsciiLineReader类的具体用法?Java AsciiLineReader怎么用?Java AsciiLineReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AsciiLineReader类属于htsjdk.tribble.readers包,在下文中一共展示了AsciiLineReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeHeader
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
@Override
String writeHeader(AsciiLineReader reader, PrintWriter writer) {
String nextLine;
try {
nextLine = reader.readLine();
while (nextLine.startsWith("#")) {
writer.println(nextLine);
nextLine = reader.readLine();
}
} catch (IOException e) {
throw new RuntimeIOException(e);
}
return nextLine;
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:17,代码来源:GFFSorter.java
示例2: writeHeader
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
@Override
String writeHeader(AsciiLineReader reader, PrintWriter writer) throws IOException {
String nextLine = reader.readLine();
if (nextLine.startsWith("psLayout")) {
do {
writer.println(nextLine);
nextLine = reader.readLine();
} while (!nextLine.startsWith("-"));
nextLine = reader.readLine();
}
while (nextLine.startsWith("#") ||
nextLine.startsWith("browser") ||
nextLine.startsWith("track") ||
isEmptyLine(nextLine)) {
writer.println(nextLine);
nextLine = reader.readLine();
}
return nextLine;
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:24,代码来源:BedSorter.java
示例3: writeHeader
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
@Override
String writeHeader(AsciiLineReader reader, PrintWriter writer) {
try {
String nextLine = reader.readLine();
while (nextLine.startsWith("#")) {
writer.println(nextLine);
nextLine = reader.readLine();
}
return nextLine;
} catch (IOException e) {
LOG.error("Error writing header", e);
return null;
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:18,代码来源:VCFSorter.java
示例4: readSingleHeader
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
public void readSingleHeader(Path vcfPath, Configuration conf) throws IOException {
FileSystem fs = vcfPath.getFileSystem(conf);
if(!fs.exists(vcfPath))
throw new RuntimeException(vcfPath.toString() + " don't exists.");
if(!fs.isFile(vcfPath)) {
throw new RuntimeException(vcfPath.toString() + " is not a file. GaeaSingleVcfHeader parser only support one vcf file.");
}
FSDataInputStream in = fs.open(vcfPath);
AsciiLineReaderIterator it = new AsciiLineReaderIterator(new AsciiLineReader(in));
VCFCodec codec = new VCFCodec();
Object header = codec.readHeader(it);
vcfHeader = (VCFHeader)(((FeatureCodecHeader)header).getHeaderValue());
sampleNames.addAll(vcfHeader.getGenotypeSamples());
buildHeaderInfo();
it.close();
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:17,代码来源:SingleVCFHeader.java
示例5: GaeaVCFRecordWriter
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
/** A VCFHeader is read from the input Path. */
public GaeaVCFRecordWriter(
Path output, Path input, boolean writeHeader, TaskAttemptContext ctx)
throws IOException
{
final AsciiLineReader r = new AsciiLineReader(
input.getFileSystem(ContextUtil.getConfiguration(ctx)).open(input));
final Object h = codec.readHeader(new AsciiLineReaderIterator(r));
if (!(h instanceof VCFHeader))
throw new IOException("No VCF header found in "+ input);
r.close();
init(output, (VCFHeader)h, writeHeader, ctx);
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:17,代码来源:GaeaVCFRecordWriter.java
示例6: isValid
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
/**
* Validate cytoband file
*
* @param reader
* @param filename
* @return
*/
public static boolean isValid(AsciiLineReader reader, String filename) {
if (reader == null) {
return false;
}
try {
String nextLine;
while ((nextLine = reader.readLine()) != null) {
String[] tokens = nextLine.split("\t");
String chr = tokens[0].trim();
Cytoband cytoData = new Cytoband(chr);
parseData(tokens, cytoData);
}
return true;
} catch (Exception e) {
logger.error("Invalid Cytoband file data : file=" + filename, e);
return false;
}
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:29,代码来源:CytoBandFileParser.java
示例7: parsableMAGE_TAB
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
public static boolean parsableMAGE_TAB(ResourceLocator file) throws IOException {
AsciiLineReader reader = null;
try {
reader = ParsingUtils.openAsciiReader(file);
String nextLine = null;
//skip first row
reader.readLine();
//check second row for MAGE_TAB identifiers
if ((nextLine = reader.readLine()) != null && (nextLine.contains("Reporter REF") ||
nextLine.contains("Composite Element REF") || nextLine.contains("Term Source REF") ||
nextLine.contains("CompositeElement REF") || nextLine.contains("TermSource REF") ||
nextLine.contains("Coordinates REF"))) {
return true;
}
} finally {
if (reader != null) {
reader.close();
}
}
return false;
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:25,代码来源:ExpressionFileParser.java
示例8: loadSampleInfo
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
/**
* Load attributes from an ascii file in "Sample Info" format.
*/
public void loadSampleInfo(ResourceLocator locator) {
AsciiLineReader reader = null;
try {
reader = ParsingUtils.openAsciiReader(locator);
loadSampleTable(reader, locator.getPath());
loadedResources.add(locator);
if (!Globals.isHeadless()) {
IGV.getInstance().resetOverlayTracks();
IGV.getInstance().doRefresh();
}
} catch (IOException ex) {
log.error("Error loading attribute file", ex);
throw new DataLoadException("Error reading attribute file", locator.getPath());
} finally {
if (reader != null) {
reader.close();
}
firePropertyChange(this, ATTRIBUTES_LOADED_PROPERTY, null, null);
}
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:29,代码来源:AttributeManager.java
示例9: writeHeader
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
@Override
String writeHeader(AsciiLineReader reader, PrintWriter writer) {
String nextLine = null;
try {
nextLine = reader.readLine();
while (nextLine.startsWith("#")) {
writer.println(nextLine);
nextLine = reader.readLine();
}
} catch (IOException e) {
e.printStackTrace();
}
return nextLine;
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:17,代码来源:GFFSorter.java
示例10: writeHeader
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
@Override
String writeHeader(AsciiLineReader reader, PrintWriter writer) throws IOException {
String nextLine = reader.readLine();
if (nextLine.startsWith("psLayout")) {
do {
writer.println(nextLine);
nextLine = reader.readLine();
} while (!nextLine.startsWith("-"));
nextLine = reader.readLine();
}
// TODO -- check "browser" line syntax, is it a multi-line directive?
while (nextLine.startsWith("#") ||
nextLine.startsWith("browser") ||
nextLine.startsWith("track") ||
nextLine.trim().length() == 0) {
writer.println(nextLine);
nextLine = reader.readLine();
}
return nextLine;
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:26,代码来源:BedSorter.java
示例11: writeHeader
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
@Override
String writeHeader(AsciiLineReader reader, PrintWriter writer) throws IOException {
String nextLine;
// TODO -- check "browser" line syntax, is it a multi-line directive?
while ((nextLine = reader.readLine()).startsWith("#")) {
writer.println(nextLine); // Comments, directives
}
writer.println(nextLine); // Header
// Contract is to return the first data line!
nextLine = reader.readLine();
return nextLine;
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:18,代码来源:MUTSorter.java
示例12: writeHeader
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
@Override
String writeHeader(AsciiLineReader reader, PrintWriter writer) {
try {
String nextLine = reader.readLine();
// TODO -- check "browser" line syntax, is it a multi-line directive?
while (nextLine.startsWith("#")) {
writer.println(nextLine);
nextLine = reader.readLine();
}
return nextLine;
} catch (IOException e) {
log.error("Error writing header", e);
return null;
}
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:19,代码来源:VCFSorter.java
示例13: isWiggle
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
/**
* Utility method. Returns true if this looks like a wiggle locator. The criteria is to scan
* the first 100 lines looking for a valid "track" line. According to UCSC documentation
* track lines must contain a type attribute, which must be equal to "wiggle_0".
*
* @param file
* @return
*/
public static boolean isWiggle(ResourceLocator file) {
AsciiLineReader reader = null;
try {
reader = ParsingUtils.openAsciiReader(file);
String nextLine = null;
int lineNo = 0;
while ((nextLine = reader.readLine()) != null && (nextLine.trim().length() > 0)) {
if (nextLine.startsWith("track") && nextLine.contains("wiggle_0")) {
return true;
}
if (lineNo++ > 100) {
break;
}
}
} catch (IOException e) {
e.printStackTrace();
return false;
} finally {
if (reader != null) {
reader.close();
}
}
return false;
}
开发者ID:hyounesy,项目名称:ALEA,代码行数:33,代码来源:ToolsWiggleParser.java
示例14: getChromosomes
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
/**
* Gets the set (no duplicates) of chromosomes from a bed file.
*
* @param bedFilePath Path to the bed file.
*
* @return The set of chromosomes (no duplicates)
*
* @throws FileNotFoundException, IOException
*/
public static Set<String> getChromosomes(String bedFilePath) throws FileNotFoundException, IOException {
Set<String> chrs = new LinkedHashSet<>();
File bedFile = FileUtils.getFile(bedFilePath);
try (InputStream is = new FileInputStream(bedFile);
AsciiLineReader alr = new AsciiLineReader(is);
LineIteratorImpl lineIterator = new LineIteratorImpl(alr);) {
BEDCodec bc = new BEDCodec();
while (!bc.isDone(lineIterator)) {
BEDFeature bf = bc.decode(lineIterator);
if (bf != null) {
//see https://github.com/samtools/htsjdk/issues/197
chrs.add(bf.getContig());
}
}
}
return chrs;
}
开发者ID:oicr-gsi,项目名称:gatk3,代码行数:27,代码来源:BEDFileUtils.java
示例15: grep
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
/** returns the number of lines in the file that contain a regular expression (decorated with "MV=" and
* expected to be in an INFO field in a vcf)
*
* @param file File to examine
* @param regex String containing a regular expression to look for in the file
* @return the number of lines that contain regex
*/
private int grep(final File file, final String regex) {
int results = 0;
final Pattern pattern = Pattern.compile(".*"+regex+".*");
try (final LineIteratorImpl li = new LineIteratorImpl(new AsciiLineReader(IOUtil.openFileForReading(file)))) {
while (li.hasNext()) {
final String line = li.next();
if (pattern.matcher(line).matches()) {
results++;
}
}
} catch (final IOException e) {
e.printStackTrace();
}
return results;
}
开发者ID:broadinstitute,项目名称:picard,代码行数:25,代码来源:FindMendelianViolationsTest.java
示例16: VCFRecordWriter
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
/** A VCFHeader is read from the input Path. */
public VCFRecordWriter(
Path output, Path input, boolean writeHeader, TaskAttemptContext ctx)
throws IOException
{
final AsciiLineReader r = new AsciiLineReader(
input.getFileSystem(ctx.getConfiguration()).open(input));
final FeatureCodecHeader h = codec.readHeader(new AsciiLineReaderIterator(r));
if (h == null || !(h.getHeaderValue() instanceof VCFHeader))
throw new IOException("No VCF header found in "+ input);
r.close();
init(output, (VCFHeader) h.getHeaderValue(), writeHeader, ctx);
}
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:17,代码来源:VCFRecordWriter.java
示例17: execute
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
public LineReader execute() throws IOException
{
URLConnection connection = new URL(this.getServiceUrl()).openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("Accept-Charset", this.getCharSet());
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" + this.getCharSet());
if(connection instanceof HttpURLConnection )
{
HttpURLConnection httpConnection = (HttpURLConnection)connection;
httpConnection.setRequestMethod("POST");
httpConnection.setInstanceFollowRedirects(true);
}
String q="query="+URLEncoder.encode(this.getXmlString(),this.getCharSet());
OutputStream output = null;
try {
output = connection.getOutputStream();
output.write(q.getBytes(this.getCharSet()));
output.flush();
} finally {
if (output != null) try { output.close(); } catch (IOException logOrIgnore) {logOrIgnore.printStackTrace();}
}
InputStream response = connection.getInputStream();
AsciiLineReader r=new AsciiLineReader(response);
return r;
}
开发者ID:lindenb,项目名称:jvarkit,代码行数:27,代码来源:BiomartQuery.java
示例18: run
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
/**
* @param maxMemory - in megabytes
* @throws IOException
*
*/
public void run(int maxMemory) throws IOException {
try (
PrintWriter writer = NgbFileUtils.isGzCompressed(outputFile.getName()) ?
new PrintWriter(new OutputStreamWriter(new BlockCompressedOutputStream(outputFile), UTF_8)) :
new PrintWriter(outputFile, UTF_8);
AsciiLineReader reader = NgbFileUtils.isGzCompressed(outputFile.getName()) ?
new AsciiLineReader(new BlockCompressedInputStream(inputFile)) :
new AsciiLineReader(new FileInputStream(inputFile))
) {
SortableRecordCodec codec = new SortableRecordCodec();
SortingCollection cltn = SortingCollection.newInstance(
SortableRecord.class, codec, comparator, maxMemory * 1024 * 1024 / ESTIMATED_RECORD_SIZE, tmpDir);
Parser parser = getParser();
String firstDataRow = writeHeader(reader, writer);
if (firstDataRow != null && !firstDataRow.isEmpty()) {
cltn.add(parser.createRecord(firstDataRow));
}
SortableRecord next;
while ((next = parser.readNextRecord(reader)) != null) {
cltn.add(next);
}
CloseableIterator<SortableRecord> iter = cltn.iterator();
while (iter.hasNext()) {
SortableRecord al = iter.next();
writer.println(al.getText());
}
iter.close();
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:42,代码来源:AbstractFeatureSorter.java
示例19: createIndex
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
private static Index createIndex(InputStream is) throws IOException {
TabixIndexCreator ctor = new TabixIndexCreator(TabixFormat.VCF);
VCFCodec codec = new VCFCodec();
VariantContext lastContext = null;
VariantContext currentContext;
final Map<String, VariantContext> visitedChromos = new HashMap<String, VariantContext>();
AsciiLineReader lineReader = new AsciiLineReader(is);
AsciiLineReaderIterator iterator = new AsciiLineReaderIterator(lineReader);
codec.readActualHeader(iterator);
while (iterator.hasNext()) {
final long position = iterator.getPosition();
currentContext = codec.decode(iterator.next());
checkSorted(lastContext, currentContext);
//should only visit chromosomes once
final String curChr = currentContext.getChr();
final String lastChr = lastContext != null ? lastContext.getChr() : null;
if(!curChr.equals(lastChr)){
if(visitedChromos.containsKey(curChr)){
throw new RuntimeException("Input file must have contiguous chromosomes.");
}else{
visitedChromos.put(curChr, currentContext);
}
}
ctor.addFeature(currentContext, position);
lastContext = currentContext;
}
iterator.close();
return ctor.finalizeIndex(iterator.getPosition());
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:34,代码来源:IndexCreator.java
示例20: seek
import htsjdk.tribble.readers.AsciiLineReader; //导入依赖的package包/类
@Override
public void seek(long pos){
this.pos = pos;
try {
seekableStream.seek(this.pos);
} catch (IOException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e.toString());
}
iterator = new AsciiLineReaderIterator(new AsciiLineReader(seekableStream));
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:12,代码来源:VCFLocalLoader.java
注:本文中的htsjdk.tribble.readers.AsciiLineReader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论