java feature get_如何利用BioJava创建一个特征feature

import org.biojava.bio.*;

import org.biojava.bio.seq.*;

import org.biojava.bio.symbol.*;

import org.biojava.util.*;

public class MakeFeature {

public static void main(String[] args){

// 从链状特征中得到一个特征模版

strandedFeature.Template templ = new StrandedFeature.Template();

// 填充模版

templ.annotation = Annotation.EMPTY_ANNOTATION;

templ.location = new RangeLocation(3,6);

templ.strand = StrandedFeature.POSITIVE;

templ.type = "interesting motif";

try {

// 拥有这个特征的序列

Sequence seq = DNATools.createDNASequence("atgcgcttaag","seq1");

System.out.println(seq.getName()+" contains "+seq.countFeatures()+" features");

System.out.println("adding new feature...");

// 创建一个序列特征

Feature f = seq.createFeature(templ);

System.out.println(seq.getName()+" contains "+seq.countFeatures()+" features");

// 创建一个和序列特征的模版一致的模版

templ =(StrandedFeature.Template)f.makeTemplate();

// 重新设置特征位置和类型

templ.location = new PointLocation(4);

templ.type = "point mutation";

System.out.println("adding nested feature...");

// 将新特征变成旧特征的嵌套特征

f.createFeature(templ);

// 注意countFeature()方法如何仅仅计算顶级(top level)特征

System.out.println(seq.getName()+" contains "+seq.countFeatures()+" features ");

System.out.println(f.getSource()+" contains "+seq.countFeatures()+" features ");

}

catch (Exception ex) {

ex.printStackTrace();

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值