Skip to content

Handling of chromosomes not in index #9

@rulixxx

Description

@rulixxx

Currently looking up a chromosome not found in the index of a file croaks with an error in Indexes.overlapchunks because seqid has a value of Nothing. Error is not captured with if condition:

function overlapchunks(tabix::Tabix, interval::Interval)
     seqid = findfirst(isequal(BioGenerics.seqname(interval)), tabix.names)
      if seqid == 0
          throw(ArgumentError("failed to find sequence name '$(BioGenerics.seqname(interval))'"))
      end
      return overlapchunks(tabix.index, seqid, BioGenerics.leftposition(interval):BioGenerics.rightposition(interval))
  end

Suggest to change handling of this situation altogether. In a situation where the chromosome is not found in the tabix.name function should return an empty list of chunks. This would be useful when handling sex chromosomes in a more natural way (just like tabix utility does).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions