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

Extract start and end positions from a PairwiseAlignment #73

Open
rohanmaddamsetti opened this issue Mar 28, 2022 · 1 comment
Open

Comments

@rohanmaddamsetti
Copy link

rohanmaddamsetti commented Mar 28, 2022

Hello, I have a feature request, that is related to some other open issues related to the API of this package.

Currently, there is no API to extract the start and end positions from a PairwiseAlignment. It would be great if the client can easily extract the location of matches (start, end) between the reference and the sequence of the PairwiseAlignment object.

Here is the hack that I wrote to solve this problem for myself, but it would be great if the API could expose an abstraction for locations of matches, or some analogous methods/functions so that the client doesn't have to mess with internal "private" fields.

function GetPairwiseAlignmentSeqStart(aln::PairwiseAlignment)
    return aln.a.aln.anchors[1].seqpos + 1
end

function GetPairwiseAlignmentRefStart(aln::PairwiseAlignment)
    return aln.a.aln.anchors[1].refpos + 1
end

function GetPairwiseAlignmentSeqEnd(aln::PairwiseAlignment)
    return aln.a.aln.anchors[end].seqpos
end

function GetPairwiseAlignmentRefEnd(aln::PairwiseAlignment)
    return aln.a.aln.anchors[end].refpos
end

Thanks for your consideration, hope this suggestion is helpful for both users as well as the designers and implementors of this package.

@CiaranOMara
Copy link
Member

I believe the first and last reference positions are stored in Alignment. Two of the proposed functions might simplify to the following.

function firstref(aln::PairwiseAlignment)
    return aln.a.aln.firstref
end

function lastref(aln::PairwiseAlignment)
    return aln.a.aln.lastref
end

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

No branches or pull requests

3 participants