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


Java ProteinSequence类代码示例

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


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

示例1: translateMultiFasta

import org.biojava3.core.sequence.ProteinSequence; //导入依赖的package包/类
/**
 * Translates a DNA multi-fasta file into ammino acids
 * @param fastaDnaFile the input DNA multi-fasta file
 * @param fastaProteinFile the output protein multi-fasta file
 * @throws Exception 
 */
public void translateMultiFasta(File fastaDnaFile, File fastaProteinFile) throws Exception
{
    LinkedHashMap<String, DNASequence> dnaSeqs = FastaReaderHelper.readFastaDNASequence(fastaDnaFile);
    //FastaReaderHelper.readFastaDNASequence for DNA sequences
    Writer out = new BufferedWriter(new FileWriter(fastaProteinFile));
    for (Entry<String, DNASequence> entry : dnaSeqs.entrySet())
    {
        //System.out.println(entry.getValue().getOriginalHeader() + "=" + entry.getValue().getSequenceAsString());
        RNASequence rna = entry.getValue().getRNASequence();
        ProteinSequence aa = rna.getProteinSequence();
        out.write(">" + entry.getKey() + "\n");
        out.write(aa + "\n");
    }
    out.close();
}
 
开发者ID:ethering,项目名称:GenomeHelper,代码行数:22,代码来源:FastaTranslator.java

示例2: testFastqToFastaSixFrameTranslation

import org.biojava3.core.sequence.ProteinSequence; //导入依赖的package包/类
/**
 * Test of fastqToFastaSixFrameTranslation method, of class FastqParser.
 */
@Test
public void testFastqToFastaSixFrameTranslation() throws Exception
{
    System.out.println("fastqToFastaSixFrameTranslation");
    File fastqIn = new File("test/test_data_in/piculus_test_left.fastq");
    File fastaOut = new File("test/test_data_out/piculus_test_left_translated.fasta");
    boolean includeDNASeq = false;
    FastqParser instance = new FastqParser();
    instance.fastqToFastaSixFrameTranslation(fastqIn, fastaOut, includeDNASeq);
    long fastqCount = FastqQCTest.countLines(fastqIn);
    long fastaCount = FastqQCTest.countLines(fastaOut);
    //for every fastq seq (4 lines) there should be 6 fasta seqs (12 lines)
    assertEquals(fastqCount, fastaCount / 3);
    LinkedHashMap<String, ProteinSequence> seqs = FastaReaderHelper.readFastaProteinSequence(fastaOut);
    //there should be 6 protein sequences for every fastq
    assertEquals((fastqCount / 4) * 6, seqs.values().size());

    //include the DNA sequence so there should be 7 protein sequences for every fastq
    includeDNASeq = true;
    instance.fastqToFastaSixFrameTranslation(fastqIn, fastaOut, includeDNASeq);
    fastqCount = FastqQCTest.countLines(fastqIn);
    seqs = FastaReaderHelper.readFastaProteinSequence(fastaOut);
    assertEquals((fastqCount / 4) * 7, seqs.values().size());
}
 
开发者ID:ethering,项目名称:GenomeHelper,代码行数:28,代码来源:FastqParserTest.java

示例3: n50avaluation

import org.biojava3.core.sequence.ProteinSequence; //导入依赖的package包/类
private void n50avaluation(CommandLine cl) throws Exception {
	ArrayList<Integer> lenghts = new ArrayList<Integer>();
	LinkedHashMap<String, ProteinSequence> a = FastaReaderHelper
			.readFastaProteinSequence(new File(cl.getOptionValue("n50")));
	for (Entry<String, ProteinSequence> entry : a.entrySet()) {
		int l = entry.getValue().getLength();
		lenghts.add(l);
	}
	System.out.println("Number of sequences in the file: " + lenghts.size());
	System.out.println("N50: " + N50.n50(lenghts));
	System.out.println("----------------------");

}
 
开发者ID:combogenomics,项目名称:medusa,代码行数:14,代码来源:Scaffolder.java

示例4: translateFasta

import org.biojava3.core.sequence.ProteinSequence; //导入依赖的package包/类
/**
 * Translate a DNASequence into a ProteinSequence
 * @param dna the DNASequence to be translated
 * @return the translated ProteinSequence
 * @throws Exception 
 */
public ProteinSequence translateFasta(DNASequence dna) throws Exception
{
    RNASequence rna = dna.getRNASequence();
    ProteinSequence aa = rna.getProteinSequence();
    System.out.println(dna.getAccession());
    System.out.println(aa);
    aa.setAccession(dna.getAccession());
    return aa;
}
 
开发者ID:ethering,项目名称:GenomeHelper,代码行数:16,代码来源:FastaTranslator.java

示例5: testTranslateFasta

import org.biojava3.core.sequence.ProteinSequence; //导入依赖的package包/类
/**
 * Test of translateFasta method, of class FastaTranslator.
 */
@Test
public void testTranslateFasta() throws Exception
{
    System.out.println("translateFasta");
    AccessionID id = new AccessionID("seq1");
    DNASequence dna = new DNASequence("atg");
    dna.setAccession(id);
    FastaTranslator instance = new FastaTranslator();
    ProteinSequence result = instance.translateFasta(dna);
    assertEquals(result.toString(), "M");
}
 
开发者ID:ethering,项目名称:GenomeHelper,代码行数:15,代码来源:FastaTranslatorTest.java

示例6: getSequenceForId

import org.biojava3.core.sequence.ProteinSequence; //导入依赖的package包/类
private static ProteinSequence getSequenceForId(String uniProtId) throws Exception {
	try (InputStream stream = new URL(String.format(URL, uniProtId)).openStream()) {
		return FastaReaderHelper.readFastaProteinSequence(stream).get(uniProtId); // why does this throw Exception?
	}
}
 
开发者ID:dmyersturnbull,项目名称:network_merge,代码行数:6,代码来源:NeedlemanWunschWeight.java


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