From d8a167b346c8257f134b0253afe3902334eabaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20R=2E=20H=C3=B6lzlwimmer?= Date: Sun, 12 Jun 2022 16:40:51 +0200 Subject: [PATCH] fix missing reverse-complement in reference sequence --- APARENT/site_probabilities/dataloader.py | 6 ++++-- APARENT/veff/dataloader.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/APARENT/site_probabilities/dataloader.py b/APARENT/site_probabilities/dataloader.py index 2c5aef347..e6f18640a 100644 --- a/APARENT/site_probabilities/dataloader.py +++ b/APARENT/site_probabilities/dataloader.py @@ -21,7 +21,9 @@ def __init__( self.reference_sequence = reference_sequence self.interval_attrs = interval_attrs - self.variant_seq_extractor = VariantSeqExtractor(reference_sequence=reference_sequence) + if not self.reference_sequence.use_strand: + raise ValueError( + "Reference sequence fetcher does not use strand but this is needed to obtain correct sequences!") self.one_hot = OneHot() @@ -134,5 +136,5 @@ def __init__( super().__init__( regions_of_interest=roi, - reference_sequence=FastaStringExtractor(fasta_file), + reference_sequence=FastaStringExtractor(fasta_file, use_strand=True), ) diff --git a/APARENT/veff/dataloader.py b/APARENT/veff/dataloader.py index 2580f71de..af76eb762 100644 --- a/APARENT/veff/dataloader.py +++ b/APARENT/veff/dataloader.py @@ -23,6 +23,9 @@ def __init__( self.variants = variants self.interval_attrs = interval_attrs + if not self.reference_sequence.use_strand: + raise ValueError( + "Reference sequence fetcher does not use strand but this is needed to obtain correct sequences!") self.variant_seq_extractor = VariantSeqExtractor(reference_sequence=reference_sequence) self.matcher = SingleVariantMatcher( @@ -155,6 +158,6 @@ def __init__( from kipoiseq.extractors import MultiSampleVCF super().__init__( regions_of_interest=roi, - reference_sequence=FastaStringExtractor(fasta_file), + reference_sequence=FastaStringExtractor(fasta_file, use_strand=True), variants=MultiSampleVCF(vcf_file, lazy=vcf_lazy) )