How to use the pyensembl.find_nearest_locus function in pyensembl

To help you get started, we’ve selected a few pyensembl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openvax / pyensembl / test / test_search.py View on Github external
def test_find_nearest_BRAF_exon(ensembl):
    braf = ensembl.genes_by_name("BRAF")[0]
    braf_transcripts = braf.transcripts
    exons = braf_transcripts[0].exons
    for exon in exons:
        # immediately before exon
        result_before = find_nearest_locus(
            start=exon.start - 2,
            end=exon.start - 1,
            loci=exons)
        eq_(result_before, (1, exon))

        # overlapping with exon
        result_overlap = find_nearest_locus(
            start=exon.start - 2,
            end=exon.start + 1,
            loci=exons)
        eq_(result_overlap, (0, exon))

        # immediately after exon
        result_after = find_nearest_locus(
            start=exon.end + 1,
            end=exon.end + 2,
github openvax / pyensembl / test / test_search.py View on Github external
def test_find_nearest_BRAF_transcript(ensembl):
    braf_transcript = ensembl.genes_by_name("BRAF")[0].transcripts[0]
    egfr_transcript = ensembl.genes_by_name("EGFR")[0].transcripts[0]
    transcripts = [braf_transcript, egfr_transcript]
    for transcript in transcripts:
        # immediately before transcript
        result_before = find_nearest_locus(
            start=transcript.start - 2,
            end=transcript.start - 1,
            loci=transcripts)
        eq_(result_before, (1, transcript))

        # overlapping with transcript
        result_overlap = find_nearest_locus(
            start=transcript.start - 2,
            end=transcript.start + 1,
            loci=transcripts)
        eq_(result_overlap, (0, transcript))

        # immediately after transcript
        # may overlap with other transcripts
        result_after = find_nearest_locus(
            start=transcript.end + 1,
            end=transcript.end + 2,
            loci=transcripts)
        eq_(result_after, (1, transcript))
github openvax / pyensembl / test / test_search.py View on Github external
def test_find_nearest_BRAF_transcript(ensembl):
    braf_transcript = ensembl.genes_by_name("BRAF")[0].transcripts[0]
    egfr_transcript = ensembl.genes_by_name("EGFR")[0].transcripts[0]
    transcripts = [braf_transcript, egfr_transcript]
    for transcript in transcripts:
        # immediately before transcript
        result_before = find_nearest_locus(
            start=transcript.start - 2,
            end=transcript.start - 1,
            loci=transcripts)
        eq_(result_before, (1, transcript))

        # overlapping with transcript
        result_overlap = find_nearest_locus(
            start=transcript.start - 2,
            end=transcript.start + 1,
            loci=transcripts)
        eq_(result_overlap, (0, transcript))

        # immediately after transcript
        # may overlap with other transcripts
        result_after = find_nearest_locus(
            start=transcript.end + 1,
github openvax / pyensembl / test / test_search.py View on Github external
def test_find_nearest_BRAF_exon(ensembl):
    braf = ensembl.genes_by_name("BRAF")[0]
    braf_transcripts = braf.transcripts
    exons = braf_transcripts[0].exons
    for exon in exons:
        # immediately before exon
        result_before = find_nearest_locus(
            start=exon.start - 2,
            end=exon.start - 1,
            loci=exons)
        eq_(result_before, (1, exon))

        # overlapping with exon
        result_overlap = find_nearest_locus(
            start=exon.start - 2,
            end=exon.start + 1,
            loci=exons)
        eq_(result_overlap, (0, exon))

        # immediately after exon
        result_after = find_nearest_locus(
            start=exon.end + 1,
            end=exon.end + 2,
            loci=exons)
        eq_(result_after, (1, exon))
github openvax / pyensembl / test / test_search.py View on Github external
# immediately before exon
        result_before = find_nearest_locus(
            start=exon.start - 2,
            end=exon.start - 1,
            loci=exons)
        eq_(result_before, (1, exon))

        # overlapping with exon
        result_overlap = find_nearest_locus(
            start=exon.start - 2,
            end=exon.start + 1,
            loci=exons)
        eq_(result_overlap, (0, exon))

        # immediately after exon
        result_after = find_nearest_locus(
            start=exon.end + 1,
            end=exon.end + 2,
            loci=exons)
        eq_(result_after, (1, exon))
github openvax / pyensembl / test / test_search.py View on Github external
result_before = find_nearest_locus(
            start=transcript.start - 2,
            end=transcript.start - 1,
            loci=transcripts)
        eq_(result_before, (1, transcript))

        # overlapping with transcript
        result_overlap = find_nearest_locus(
            start=transcript.start - 2,
            end=transcript.start + 1,
            loci=transcripts)
        eq_(result_overlap, (0, transcript))

        # immediately after transcript
        # may overlap with other transcripts
        result_after = find_nearest_locus(
            start=transcript.end + 1,
            end=transcript.end + 2,
            loci=transcripts)
        eq_(result_after, (1, transcript))