Skip to content

Commit 9c9eff5

Browse files
committed
merge master
2 parents 7bcf03e + 8d45f57 commit 9c9eff5

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ variables:
3434
name: Install conda dependencies
3535
command: |
3636
source activate kipoi-dev
37-
apt update -y
38-
apt install build-essential -y
37+
apt-get --allow-releaseinfo-change update -y
38+
apt-get install build-essential -y
3939
conda install -y cython
4040
conda install -y -c bioconda cyvcf2 pybedtools pyfaidx biopython
4141
install_kipoi: &install_kipoi

kipoiseq/dataclasses.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ def start(self):
8585
"""
8686
return self.pos - 1
8787

88+
@property
89+
def end(self):
90+
"""1-based variant end position
91+
"""
92+
return self.start + len(self.ref)
93+
8894
@classmethod
8995
def from_cyvcf(cls, obj):
9096
if len(obj.ALT) > 1:

kipoiseq/dataloaders/sequence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pandas as pd
22
import numpy as np
3+
import pyranges as pr
34
from copy import deepcopy
45
from kipoi.metadata import GenomicRanges
56
from kipoi.data import Dataset, kipoi_dataloader
@@ -459,7 +460,6 @@ def __init__(self, gtf_file, fasta_file,
459460
transform=one_hot_dna,
460461
interval_attrs=["gene_id", "Strand"],
461462
use_strand=True):
462-
import pyranges as pr
463463

464464
# Read and filter gtf
465465
gtf = pr.read_gtf(gtf_file).df

kipoiseq/extractors/vcf_matching.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def variants_to_pyranges(variants: List[Variant]) -> PyRanges:
3131
(
3232
v.chrom,
3333
v.start,
34-
v.start + max(len(v.ref), len(v.alt)),
34+
v.end,
3535
v
3636
)
3737
for v in variants
@@ -271,7 +271,7 @@ def iter_rows(self):
271271
for _, row in df.iterrows():
272272
yield row
273273

274-
def __iter__(self):
274+
def __iter__(self) -> (Interval, Variant):
275275
"""
276276
Iterate interval and variant object.
277277
"""

tests/extractors/test_vcf_matching.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,18 @@ def test_SingleVariantMatcher__iter__():
118118
assert (inters[0], variants[0]) in pairs
119119
assert (inters[0], variants[1]) in pairs
120120
assert (inters[1], variants[2]) in pairs
121-
assert (inters[2], variants[1]) in pairs
122121
assert (inters[2], variants[2]) in pairs
123122

124-
assert len(pairs) == 5
123+
assert len(pairs) == 4
125124

126125
matcher = SingleVariantMatcher(vcf_file, pranges=pr)
127126
pairs = list(matcher)
128127

129128
assert (inters[0], variants[0]) in pairs
130129
assert (inters[0], variants[1]) in pairs
131130
assert (inters[1], variants[2]) in pairs
132-
assert (inters[2], variants[1]) in pairs
133131
assert (inters[2], variants[2]) in pairs
134-
assert len(pairs) == 5
132+
assert len(pairs) == 4
135133

136134
matcher = SingleVariantMatcher(variants=variants, pranges=pr)
137135
pairs = list(matcher)

0 commit comments

Comments
 (0)