Question : how to get all the elements of Dbxref
simonpenel opened this issue · comments
Hello,
I am using bio::io::gff to read gff files. I would like to get all the cross-references of mRNA associated to the Dbxref attribute, however I was unable to get more than the first cross-reference.
It seems that I get the first element of the array and not the array itself.
An example of code :
extern crate bio;
use bio::io::gff;
fn main() {
let mut reader = gff::Reader::from_file("test.gff",gff::GffType::GFF3).unwrap();
for result in reader.records() {
let record = result.expect("Error during gff record parsing");
if record.feature_type() == "mRNA" {
println!("Attributes = {:?}",record.attributes());
println!("Dbxref = {:?}",record.attributes().get("Dbxref"));
}
}
}
With the following input:
NC_000001.11 BestRefSeq mRNA 65419 71585 . + . ID=rna-NM_001005484.2;Parent=gene-OR4F5;Dbxref=Ensembl:ENST00000641515.2,GeneID:79501,GenBank:NM_001005484.2,HGNC:HGNC:14825;Name=NM_001005484.2;gbkey=mRNA;gene=OR4F5;product=olfactory receptor family 4 subfamily F member 5;tag=MANE Select;transcript_id=NM_001005484.2
I got the following output
./target/debug/test_gff3
Attributes = {"transcript_id": ["NM_001005484.2"], "ID": ["rna-NM_001005484.2"], "gbkey": ["mRNA"], "Name": ["NM_001005484.2"], "Dbxref": ["Ensembl:ENST00000641515.2", "GeneID:79501", "GenBank:NM_001005484.2", "HGNC:HGNC:14825"], "tag": ["MANE Select"], "product": ["olfactory receptor family 4 subfamily F member 5"], "Parent": ["gene-OR4F5"], "gene": ["OR4F5"]}
Dbxref = Some("Ensembl:ENST00000641515.2")
I tried several ways to get an array instead of the first string of the array, unsuccessfully...
thanks a lot for any help!
all the best,
simon