Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question : how to get all the elements of Dbxref #574

Open
simonpenel opened this issue Feb 14, 2024 · 0 comments
Open

Question : how to get all the elements of Dbxref #574

simonpenel opened this issue Feb 14, 2024 · 0 comments

Comments

@simonpenel
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant