From cf4c42e264f87264c33d89e50da205376554b744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20R=2E=20H=C3=B6lzlwimmer?= Date: Thu, 4 Jun 2020 22:38:58 +0200 Subject: [PATCH] make pyranges optional again (#77) --- kipoiseq/extractors/protein.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kipoiseq/extractors/protein.py b/kipoiseq/extractors/protein.py index 5586d0b..6c504b4 100644 --- a/kipoiseq/extractors/protein.py +++ b/kipoiseq/extractors/protein.py @@ -7,7 +7,6 @@ from kipoiseq.extractors.vcf_seq import VariantSeqExtractor from kipoiseq.extractors.vcf_matching import SingleVariantMatcher from typing import List -import pyranges import pandas as pd # TODO: convert print to logs @@ -74,6 +73,7 @@ def _read_cds(gtf_file, duplicate_attr=False): Read, extract and filter valid cds from the given gtf_file :param gtf_file: """ + import pyranges df = pyranges.read_gtf(gtf_file, as_df=True, duplicate_attr=duplicate_attr) cds = CDSFetcher._get_cds_from_gtf(df) @@ -229,6 +229,7 @@ def __init__(self, gtf_file, fasta_file, vcf_file): self.vcf_file = str(vcf_file) self.cds_fetcher = CDSFetcher(self.gtf_file) # dataframe to pyranges + import pyranges pr_cds = pyranges.PyRanges(self.cds_fetcher.cds.reset_index()) # match variant with transcript_id self.single_variant_matcher = SingleVariantMatcher(