# Does Bio support EMBL and/or IMGT/HLA format ?

**URL:** <https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541>\
**Category:** Biology, Health, and Medicine\
**Created:** [March 30, 2019, 1:23pm UTC](https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541 "2019-03-30T13:23:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zimoun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zimoun/32/7745_2.png) [@zimoun](https://discourse.julialang.org/u/zimoun)\
**Post date:** [March 30, 2019, 1:23pm UTC](https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541/1 "2019-03-30T13:23:05Z")

</div>

Dear,

I am not able to find in the doc if the metapackage `Bio` supports the format EMBL and/or the specific one about HLA database [1] (`hla.dat`).

The wiki [2] mentions EMBL but is it accurate ?

Thank you in advance for any pointer and/or comment ?

All the best,  
simon

[1] [IPD-IMGT/HLA Database](https://www.ebi.ac.uk/ipd/imgt/hla/)  
[2] [core features · BioJulia/Bio.jl Wiki · GitHub](https://github.com/BioJulia/Bio.jl/wiki/core-features)

---

<div class="post-metadata">

**Author:** ![jgreener64](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jgreener64/32/2483_2.png) [@jgreener64](https://discourse.julialang.org/u/jgreener64)\
**Post date:** [April 1, 2019, 10:30am UTC](https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541/2 "2019-04-01T10:30:32Z")

</div>

If it did it would probably be via the [BioSequences.jl](https://github.com/BioJulia/BioSequences.jl) package, but I don’t think it’s implemented.

The wiki is pretty out of date now - thankfully, many of the proposed features are now available (though perhaps not the one you want).

---

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [April 1, 2019, 12:23pm UTC](https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541/3 "2019-04-01T12:23:34Z")

</div>

What data are you trying to open exactly ? It seems they have fasta files available, which you can open without problems with `BioSequences`.

ftp://ftp.ebi.ac.uk/pub/databases/ipd/imgt/hla/fasta/

---

<div class="post-metadata">

**Author:** ![zimoun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zimoun/32/7745_2.png) [@zimoun](https://discourse.julialang.org/u/zimoun)\
**Post date:** [April 1, 2019, 1:40pm UTC](https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541/4 "2019-04-01T13:40:00Z")

</div>

Yes, there are FASTA but I am not interested in because it only represents some sequences and not all the known database. I mean that I am interested in meta-data (which Exon or Intron is sequenced, the coordinates, etc.).

Other said, some alleles are not in the FASTA files because e.g., the sequence does not have the full genomic sequence known yet. For instance, consider the incomplete A\*01:239 for which only the exons 2 and 3 are sequenced and nothing more; so it is in `hla.dat` and not in `hla_gen.fasta` and from `hla_nuc.fasta` you cannot deduce the length of the exon 2 or exon 3.

Basically, all this information is in this file:  
[https://media.githubusercontent.com/media/ANHIG/IMGTHLA/Latest/hla.dat](https://media.githubusercontent.com/media/ANHIG/IMGTHLA/Latest/hla.dat)  
which is a variant of EMBL format.

---

<div class="post-metadata">

**Author:** ![jgreener64](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jgreener64/32/2483_2.png) [@jgreener64](https://discourse.julialang.org/u/jgreener64)\
**Post date:** [April 1, 2019, 2:11pm UTC](https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541/5 "2019-04-01T14:11:48Z")

</div>

If you want specific pieces of data then iterating over the lines with `eachline` and extracting what you want seems like the best way to go.

For example, you could extract exon coordinate data with something like:

```julia
exons = Dict{String, Vector{Tuple{Int, Int}}}()

open("hla.dat") do f
    current_id = ""
    for line in eachline(f)
        # Read ID
        if startswith(line, "ID")
            current_id = split(line[3:end])[1][1:(end-1)]
        # Find exon lines
        elseif startswith(line, "FT") && split(line)[2] == "exon"
            # Find exon start/end
            exon_start, exon_end = parse.(Int, split(split(line)[3], ".."))
            if haskey(exons, current_id)
                push!(exons[current_id], (exon_start, exon_end))
            else
                exons[current_id] = [(exon_start, exon_end)]
            end
        end
    end
end

```

Warning: not tested and may not be what you want.

---

<div class="post-metadata">

**Author:** ![zimoun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zimoun/32/7745_2.png) [@zimoun](https://discourse.julialang.org/u/zimoun)\
**Post date:** [April 1, 2019, 3:20pm UTC](https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541/6 "2019-04-01T15:20:31Z")

</div>

Thank you for the chunk.

If I am able to schedule some time, then I will try to improve the readers to add IMGT/HLA and/or EMBL.  
In the meantime, I am using BioPython. 😉

All the best

---

<div class="post-metadata">

**Author:** ![jgreener64](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jgreener64/32/2483_2.png) [@jgreener64](https://discourse.julialang.org/u/jgreener64)\
**Post date:** [April 1, 2019, 3:23pm UTC](https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541/7 "2019-04-01T15:23:15Z")

</div>

Cool. If you do make any progress it would be a useful contribution to BioJulia.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [April 1, 2019, 5:03pm UTC](https://discourse.julialang.org/t/does-bio-support-embl-and-or-imgt-hla-format/22541/8 "2019-04-01T17:03:28Z")

</div>

> [@zimoun](#):
>
> If I am able to schedule some time, then I will try to improve the readers to add IMGT/HLA and/or EMBL.

That would be great! Contributions like this are definitely welcomed
