利用BioJava列出序列中的注释

  • A+
所属分类:Script

当你读取象GenBank或EMBL这样的序列注释文件时,文件提供的不仅仅是序列本身还有一些更细节的序列信息。如果这个信息拥有位置的话,就可以当作是特征。如果这个信息是很通用的信息比如说是物种名称的话,就可以当作是注释。Biojava 注释(Annotation)对象有些象图(Map)对象,它包括键值映射。

下面就是EMBL文件的开头部分:

ID AY130859 standard; DNA; HUM; 44226 BP.
XX
AC AY130859;
XX
SV AY130859.1
XX
DT 25-JUL-2002 (Rel. 72, Created)
DT 25-JUL-2002 (Rel. 72, Last updated, Version 1)
XX
DE Homo sapiens cyclin-dependent kinase 7 (CDK7) gene, complete cds.
XX
KW .
XX
OS Homo sapiens (human)
OC Eukaryota; Metazoa; Chordata; Craniata; Vertebrata; Euteleostomi; Mammalia;
OC Eutheria; Primates; Catarrhini; Hominidae; Homo.
XX
RN [1]
RP 1-44226
RA Rieder M.J., Livingston R.J., Braun A.C., Montoya M.A., Chung M.-W.,
RA Miyamoto K.E., Nguyen C.P., Nguyen D.A., Poel C.L., Robertson P.D.,
RA Schackwitz W.S., Sherwood J.K., Witrak L.A., Nickerson D.A.;
RT ;
RL Submitted (11-JUL-2002) to the EMBL/GenBank/DDBJ databases.
RL Genome Sciences, University of Washington, 1705 NE Pacific, Seattle, WA
RL 98195, USA
XX
CC To cite this work please use: NIEHS-SNPs, Environmental Genome
CC Project, NIEHS ES15478, Department of Genome Sciences, Seattle, WA
CC (URL: http://egp.gs.washington.edu).

下面的程序读取EMBL文件并且列出所有的注释属性。程序的输出附在后面。

import java.io.*;
import java.util.*;
import org.biojava.bio.*;
import org.biojava.bio.seq.*;
import org.biojava.bio.seq.io.*;

public class ListAnnotations {
public static void main(String[] args){
try {
// 读取EMBL纪录

BufferedReader br = new BufferedReader(new FileReader(args[0]));
SequenceIterator seqs = SeqIOTools.readEmbl(br);

// 对于每条序列列出它的注释

while(seqs.hasNext()){
Annotation anno = seqs.nextSequence().getAnnotation();

// 打印每个键值对

for(Iterator i = anno.keys().iterator();i.hasNext(); ) {
Object key = i.next();
System.out.println(key+" : "+ anno.getProperty(key));
}
} 
}
catch (Exception ex){
ex.printStackTrace();
}
}
}

程序输出:

RN : [1] 
KW : . 
RL : [Submitted (11-JUL-2002) to the EMBL/GenBank/DDBJ databases., Genome Sciences, University of Washington, 1705 NE Pacific, Seattle, WA, 98195, USA] 
embl_accessions : [AY130859] 
DE : Homo sapiens cyclin-dependent kinase 7 (CDK7) gene, complete cds. 
SV : AY130859.1 
AC : AY130859; 
FH : Key Location/Qualifiers 
XX : 
OC : [Eukaryota; Metazoa; Chordata; Craniata; Vertebrata; Euteleostomi; Mammalia;, Eutheria; Primates; Catarrhini; Hominidae; Homo.] 
RA : [Rieder M.J., Livingston R.J., Braun A.C., Montoya M.A., Chung M.-W.,, Miyamoto K.E., Nguyen C.P., Nguyen D.A., Poel C.L., Robertson P.D.,, Schackwitz W.S., Sherwood J.K., Witrak L.A., Nickerson D.A.;] 
ID : AY130859 standard; DNA; HUM; 44226 BP. 
DT : [25-JUL-2002 (Rel. 72, Created), 25-JUL-2002 (Rel. 72, Last updated, Version 1)] 
CC : [To cite this work please use: NIEHS-SNPs, Environmental Genome, Project, NIEHS ES15478, Department of Genome Sciences, Seattle, WA, (URL: http://egp.gs.washington.edu).] 
RT : ; 
OS : Homo sapiens (human) 
RP : 1-44226

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: