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


Java SeqIOTools类代码示例

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


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

示例1: readReference

import org.biojava.bio.seq.io.SeqIOTools; //导入依赖的package包/类
private Sequence readReference() throws IOException, BioException {
    Sequence sequence = null;
    BufferedReader reader = null;
    try {
        reader = reader(referenceFastaFile);
        SequenceIterator sequences = SeqIOTools.readFastaDNA(reader);
        if (!sequences.hasNext()) {
            throw new IOException("reference FASTA file was empty");
        }
        sequence = sequences.nextSequence();
        if (sequences.hasNext()) {
            throw new IOException("reference FASTA file contains more than one sequence");
        }
    }
    finally {
        try {
            reader.close();
        }
        catch (Exception e) {
            // ignore
        }
    }
    return sequence;
}
 
开发者ID:nmdp-bioinformatics,项目名称:ngs,代码行数:25,代码来源:EvaluateScaffolds.java

示例2: readScaffolds

import org.biojava.bio.seq.io.SeqIOTools; //导入依赖的package包/类
private List<Sequence> readScaffolds() throws IOException, BioException {
    BufferedReader reader = null;
    List<Sequence> scaffolds = Lists.newLinkedList();
    try {
        reader = reader(scaffoldsFastaFile);

        for (SequenceIterator sequences = SeqIOTools.readFastaDNA(reader); sequences.hasNext(); ) {
            Sequence sequence = sequences.nextSequence();
            scaffolds.add(sequence);
        }
    }
    finally {
        try {
            reader.close();
        }
        catch (Exception e) {
            // ignore
        }
    }
    return scaffolds;
}
 
开发者ID:nmdp-bioinformatics,项目名称:ngs,代码行数:22,代码来源:EvaluateScaffolds.java

示例3: createSequences

import org.biojava.bio.seq.io.SeqIOTools; //导入依赖的package包/类
/**
 * Create and return zero or more DNA HML Sequences read from the specified reader in FASTA format.
 *
 * @param reader reader to read from, must not be null
 * @return zero or more DNA HML Sequences read from the specified reader in FASTA format
 * @throws IOException if an I/O error occurs
 */
public static Iterable<Sequence> createSequences(final BufferedReader reader) throws IOException {
    checkNotNull(reader);
    List<Sequence> sequences = new ArrayList<Sequence>();
    for (SequenceIterator it = SeqIOTools.readFastaDNA(reader); it.hasNext(); ) {
        try {
            sequences.add(createSequence(it.nextSequence()));
        }
        catch (BioException e) {
            throw new IOException("could not read DNA sequences", e);
        }
    }
    return sequences;
}
 
开发者ID:nmdp-bioinformatics,项目名称:ngs,代码行数:21,代码来源:HmlUtils.java

示例4: readFasta

import org.biojava.bio.seq.io.SeqIOTools; //导入依赖的package包/类
/**
 * Extract consensus sequences from a file in HML format.
 *
 * @param inputHmlFile input HML file, if any
 */
static Map<String, String> readFasta(final File inputFastqFile) throws IOException, NoSuchElementException, BioException{
	
	BufferedReader reader = null;
	HashMap<String, String> fasta = new HashMap<String, String>();
    
	try{
		 reader = reader(inputFastqFile);
		 for (SequenceIterator sequences = SeqIOTools.readFastaDNA(reader); sequences.hasNext(); ) 
		{
             Sequence sequence = sequences.nextSequence();
             String sequenceId = sequence.getName();
             String fastaSeq   = sequence.seqString();
             fasta.put(sequenceId, fastaSeq);
         }
		
	}finally {
        try {
        	reader.close();
        }
        catch (Exception e) {
        	 e.printStackTrace();
        	 System.exit(1);
        }
    }

    
    return fasta;
	
}
 
开发者ID:nmdp-bioinformatics,项目名称:ngs,代码行数:35,代码来源:ExtractBlast.java

示例5: writeSequenceToTempFile

import org.biojava.bio.seq.io.SeqIOTools; //导入依赖的package包/类
/**
 * Write the specified sequence to a temporary file in FASTA format.
 *
 * @param sequence sequence to write
 * @return temporary file in FASTA format
 * @throws IOException if an I/O error occurs
 */
static File writeSequenceToTempFile(final Sequence sequence) throws IOException {
    File tmp = File.createTempFile(sequence.getName() + "-", ".fa");
    try (FileOutputStream outputStream = new FileOutputStream(tmp)) {
        SeqIOTools.writeFasta(outputStream, sequence);
    }
    return tmp;
}
 
开发者ID:nmdp-bioinformatics,项目名称:ngs,代码行数:15,代码来源:FilterInterpretableExons.java

示例6: read

import org.biojava.bio.seq.io.SeqIOTools; //导入依赖的package包/类
private static Sequence read(final String name) throws Exception {
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(AbstractPairwiseAlignmentTest.class.getResourceAsStream(name)))) {
        SequenceIterator sequences = SeqIOTools.readFastaDNA(reader);
        return sequences.hasNext() ? sequences.nextSequence() : null;
    }
}
 
开发者ID:nmdp-bioinformatics,项目名称:ngs,代码行数:7,代码来源:AbstractPairwiseAlignmentTest.java


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