From fbb90f43ca5d3b72b458057296c38d4927b5e486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Balajti?= Date: Wed, 2 Oct 2024 17:32:06 +0200 Subject: [PATCH] feat: add read orient single json output --- htsinfer/get_read_orientation.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htsinfer/get_read_orientation.py b/htsinfer/get_read_orientation.py index b6671a5..b4ffef2 100644 --- a/htsinfer/get_read_orientation.py +++ b/htsinfer/get_read_orientation.py @@ -183,8 +183,13 @@ def process_single( f"Required number of mapped reads pairs: {self.min_mapped_reads}" ) LOGGER.debug(f"Number of reads mapped: {reads}") - LOGGER.debug(f"Fraction of states: {fractions_all_states}") - LOGGER.debug(f"Orientation: {orientation}") + LOGGER.debug( + f"Fraction of SF: {fractions_all_states.get(StatesOrientation.stranded_forward)}" + ) + LOGGER.debug( + f"Fraction of SR: {fractions_all_states.get(StatesOrientation.stranded_reverse)}" + ) + LOGGER.debug(f"Orientation: {orientation.value}") # write data frame (in JSON) to file filename = ( @@ -193,8 +198,9 @@ def process_single( LOGGER.debug(f"Writing results to file: {filename}") orientation_df = pd.DataFrame([{ 'Number of mapped reads': reads, - 'Fraction of states': fractions_all_states.get(StatesOrientation.stranded_forward, 0), - 'Orientation': orientation + 'Fraction SF': fractions_all_states.get(StatesOrientation.stranded_forward), + 'Fraction SR': fractions_all_states.get(StatesOrientation.stranded_reverse), + 'Orientation': orientation.value }]) orientation_df.to_json( filename,