How to use the kipoiseq.extractors.vcf_matching.BaseVariantMatcher._read_intervals function in kipoiseq

To help you get started, we’ve selected a few kipoiseq 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 kipoi / kipoiseq / tests / extractors / test_vcf_matching.py View on Github external
pr = BaseVariantMatcher._read_intervals(
            intervals=intervals, interval_attrs=['gene_id'])

    pr = BaseVariantMatcher._read_intervals(gtf_path=gtf_file)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
    assert pr.Start.tolist() == [200, 200, 200, 1049, 3029]
    assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5

    pr = BaseVariantMatcher._read_intervals(bed_path=example_intervals_bed)
    assert pr.Chromosome.tolist() == ['chr1'] * 4
    assert pr.Start.tolist() == [2, 2, 2, 602]
    assert pr.End.tolist() == [1000, 5000, 1002, 604]
    # assert len(pr.intervals.tolist()) == 4

    pr = BaseVariantMatcher._read_intervals(pranges=pranges)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
    assert pr.Start.tolist() == [200, 200, 200, 1049, 3029]
    assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5

    pr = BaseVariantMatcher._read_intervals(intervals=intervals)
    assert pr.df.Chromosome.tolist() == ['chr1', 'chr1']
    assert pr.df.Start.tolist() == [1, 23]
    assert pr.df.End.tolist() == [10, 30]
    assert pr.df.Strand.tolist() == ['+', '-']
    assert len(pr.intervals.tolist()) == 2
github kipoi / kipoiseq / tests / extractors / test_vcf_matching.py View on Github external
assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5

    pr = BaseVariantMatcher._read_intervals(bed_path=example_intervals_bed)
    assert pr.Chromosome.tolist() == ['chr1'] * 4
    assert pr.Start.tolist() == [2, 2, 2, 602]
    assert pr.End.tolist() == [1000, 5000, 1002, 604]
    # assert len(pr.intervals.tolist()) == 4

    pr = BaseVariantMatcher._read_intervals(pranges=pranges)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
    assert pr.Start.tolist() == [200, 200, 200, 1049, 3029]
    assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5

    pr = BaseVariantMatcher._read_intervals(intervals=intervals)
    assert pr.df.Chromosome.tolist() == ['chr1', 'chr1']
    assert pr.df.Start.tolist() == [1, 23]
    assert pr.df.End.tolist() == [10, 30]
    assert pr.df.Strand.tolist() == ['+', '-']
    assert len(pr.intervals.tolist()) == 2
github kipoi / kipoiseq / tests / extractors / test_vcf_matching.py View on Github external
def test_BaseVariantMatcher__read_intervals():
    pranges = pyranges.read_gtf(gtf_file)

    with pytest.raises(ValueError):
        pr = BaseVariantMatcher._read_intervals(
            pranges=pranges, gtf_path=gtf_file)

    with pytest.raises(ValueError):
        pr = BaseVariantMatcher._read_intervals(
            intervals=intervals, interval_attrs=['gene_id'])

    pr = BaseVariantMatcher._read_intervals(gtf_path=gtf_file)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
    assert pr.Start.tolist() == [200, 200, 200, 1049, 3029]
    assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5

    pr = BaseVariantMatcher._read_intervals(bed_path=example_intervals_bed)
    assert pr.Chromosome.tolist() == ['chr1'] * 4
    assert pr.Start.tolist() == [2, 2, 2, 602]
    assert pr.End.tolist() == [1000, 5000, 1002, 604]
    # assert len(pr.intervals.tolist()) == 4

    pr = BaseVariantMatcher._read_intervals(pranges=pranges)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
github kipoi / kipoiseq / tests / extractors / test_vcf_matching.py View on Github external
def test_BaseVariantMatcher__read_intervals():
    pranges = pyranges.read_gtf(gtf_file)

    with pytest.raises(ValueError):
        pr = BaseVariantMatcher._read_intervals(
            pranges=pranges, gtf_path=gtf_file)

    with pytest.raises(ValueError):
        pr = BaseVariantMatcher._read_intervals(
            intervals=intervals, interval_attrs=['gene_id'])

    pr = BaseVariantMatcher._read_intervals(gtf_path=gtf_file)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
    assert pr.Start.tolist() == [200, 200, 200, 1049, 3029]
    assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5

    pr = BaseVariantMatcher._read_intervals(bed_path=example_intervals_bed)
    assert pr.Chromosome.tolist() == ['chr1'] * 4
    assert pr.Start.tolist() == [2, 2, 2, 602]
    assert pr.End.tolist() == [1000, 5000, 1002, 604]
github kipoi / kipoiseq / tests / extractors / test_vcf_matching.py View on Github external
def test_BaseVariantMatcher__read_intervals():
    pranges = pyranges.read_gtf(gtf_file)

    with pytest.raises(ValueError):
        pr = BaseVariantMatcher._read_intervals(
            pranges=pranges, gtf_path=gtf_file)

    with pytest.raises(ValueError):
        pr = BaseVariantMatcher._read_intervals(
            intervals=intervals, interval_attrs=['gene_id'])

    pr = BaseVariantMatcher._read_intervals(gtf_path=gtf_file)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
    assert pr.Start.tolist() == [200, 200, 200, 1049, 3029]
    assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5

    pr = BaseVariantMatcher._read_intervals(bed_path=example_intervals_bed)
    assert pr.Chromosome.tolist() == ['chr1'] * 4
    assert pr.Start.tolist() == [2, 2, 2, 602]
    assert pr.End.tolist() == [1000, 5000, 1002, 604]
    # assert len(pr.intervals.tolist()) == 4

    pr = BaseVariantMatcher._read_intervals(pranges=pranges)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
    assert pr.Start.tolist() == [200, 200, 200, 1049, 3029]
    assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5
github kipoi / kipoiseq / tests / extractors / test_vcf_matching.py View on Github external
with pytest.raises(ValueError):
        pr = BaseVariantMatcher._read_intervals(
            pranges=pranges, gtf_path=gtf_file)

    with pytest.raises(ValueError):
        pr = BaseVariantMatcher._read_intervals(
            intervals=intervals, interval_attrs=['gene_id'])

    pr = BaseVariantMatcher._read_intervals(gtf_path=gtf_file)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
    assert pr.Start.tolist() == [200, 200, 200, 1049, 3029]
    assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5

    pr = BaseVariantMatcher._read_intervals(bed_path=example_intervals_bed)
    assert pr.Chromosome.tolist() == ['chr1'] * 4
    assert pr.Start.tolist() == [2, 2, 2, 602]
    assert pr.End.tolist() == [1000, 5000, 1002, 604]
    # assert len(pr.intervals.tolist()) == 4

    pr = BaseVariantMatcher._read_intervals(pranges=pranges)
    assert pr.Chromosome.tolist() == ['chr1'] * 5
    assert pr.Start.tolist() == [200, 200, 200, 1049, 3029]
    assert pr.End.tolist() == [4230, 4230, 402, 1340, 4230]
    # assert len(pr.intervals.tolist()) == 5

    pr = BaseVariantMatcher._read_intervals(intervals=intervals)
    assert pr.df.Chromosome.tolist() == ['chr1', 'chr1']
    assert pr.df.Start.tolist() == [1, 23]
    assert pr.df.End.tolist() == [10, 30]
    assert pr.df.Strand.tolist() == ['+', '-']