File: conftest.py

package info (click to toggle)
pyranges 0.0.111%2Bds-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,996 kB
  • sloc: python: 5,546; makefile: 37; sh: 6
file content (91 lines) | stat: -rw-r--r-- 2,041 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import pytest

import pandas as pd

from pyranges import PyRanges

def pytest_configure(config):
    config.addinivalue_line(
        "markers", "bedtools: tests rely on",
    )

    config.addinivalue_line(
        "markers", "explore: functionality not ready for prime-time"
    )

@pytest.fixture
def names():
    return "Chromosome  Start  End  Name Score Strand".split()


@pytest.fixture
def chip_10(names):

    df = pd.read_csv("tests/chip_10.bed", header=None, names=names, sep="\t")

    gr = PyRanges(df)

    assert gr.stranded

    return gr


@pytest.fixture
def f1(names):

    df = pd.read_csv(
        "tests/f1.bed",
        sep="\t",
        header=None,
        names="Chromosome  Start  End  Name Score Strand".split())

    return PyRanges(df)


@pytest.fixture
def f2(names):

    df = pd.read_csv("tests/f2.bed", sep="\t", header=None, names=names)

    return PyRanges(df)


@pytest.fixture
def chromsizes():

    from io import StringIO
    df = pd.read_csv(
        StringIO("""
chr1                     249250621
chr2                     243199373
chr3                     198022430
chr4                     191154276
chr5                     180915260
chr6                     171115067
chr7                     159138663
chrX                     155270560
chr8                     146364022
chr9                     141213431
chr10                    135534747
chr11                    135006516
chr12                    133851895
chr13                    115169878
chr14                    107349540
chr15                    102531392
chr16                     90354753
chr17                     81195210
chr18                     78077248
chr20                     63025520
chrY                      59373566
chr19                     59128983
chr22                     51304566
chr21                     48129895"""),
        sep="\s+",
        header=None,
        index_col=0)

    df.insert(0, "Start", 0)
    df = df.reset_index()
    df.columns = ["Chromosome", "Start", "End"]

    return PyRanges(df)