Skip to content

EOFError: read end of file #11

@junjunlab

Description

@junjunlab

EOFError: read end of file

Hello, I use while loop to read GFF3 file but I got this error.I do not know how it happens and how to solve it. Here is my code:

# Import the GFF3 module.
using GFF3

exonDict = Dict{String,Int64}()

# Open a GFF3 file.
reader = open(GFF3.Reader, "Homo_sapiens.GRCh38.106.gff3")

# Pre-allocate record.
record = GFF3.Record()

# Iterate over records.
while !eof(reader)
    empty!(record)
    read!(reader,record)
    # do something
    if GFF3.featuretype(record) == "exon"
        transid = split(GFF3.attributes(record,"Parent")[1],":")[2]
        exonLength = abs(GFF3.seqend(record) - GFF3.seqstart(record)) + 1
        # println(exonLength)
        if !haskey(exonDict,transid)
            exonDict[transid] = exonLength
        else
            exonDict[transid] += exonLength
        end
    end
end

# Finally, close the reader.
close(reader)

Thank you for your reply!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions