Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update logging level #171

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion htsinfer/get_library_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def run_kallisto_quantification(
Raises:
KallistoProblem: Kallisto quantification failed.
"""
LOGGER.debug(f"Running Kallisto quantification for: {fastq}")
LOGGER.info(f"Running Kallisto quantification for: {fastq}")

with tempfile.TemporaryDirectory(
prefix="kallisto_",
Expand Down
3 changes: 2 additions & 1 deletion htsinfer/get_library_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def fastq_get_stats_read_length(fastq: Path) -> Tuple[
FileProblem: Could not process FASTQ file.
"""
LOGGER.debug(
uniqueg marked this conversation as resolved.
Show resolved Hide resolved
f"Extracting read length statistics in: {fastq}")
f"Extracting read length statistics in: {fastq}"
)
min_len: int = 1000000
max_len: int = 0
total_lengths: int = 0
Expand Down
18 changes: 9 additions & 9 deletions htsinfer/get_library_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _evaluate_mate_relationship(
self.library_source.file_1.short_name is not None or
self.library_source.file_2.short_name is not None
):
LOGGER.debug("Determining mate relationship by alignment...")
LOGGER.info("Determining mate relationship by alignment...")
self.mapping.library_type.relationship \
= StatesTypeRelationship.not_available
self.mapping.library_source = self.library_source
Expand All @@ -146,7 +146,7 @@ def _evaluate_mate_relationship(
self.library_source.file_1.short_name is not None or
self.library_source.file_2.short_name is not None
):
LOGGER.debug("Determining mate relationship by alignment...")
LOGGER.info("Determining mate relationship by alignment...")
self.mapping.library_type.relationship \
= StatesTypeRelationship.not_available
self.mapping.library_source = self.library_source
Expand All @@ -155,7 +155,7 @@ def _evaluate_mate_relationship(
self._align_mates()
else:
self.results.relationship = StatesTypeRelationship.not_available
LOGGER.debug(
LOGGER.info(
"Sequence IDs and library source are not determined, "
"mate relationship cannot be inferred."
)
Expand Down Expand Up @@ -220,9 +220,9 @@ def _align_mates(self):
aligned_mate1 = len(list(filter(None, mate1)))
aligned_mate2 = len(list(filter(None, mate2)))

LOGGER.debug(f"Number of aligned reads file 1: {aligned_mate1}")
LOGGER.debug(f"Number of aligned reads file 2: {aligned_mate2}")
LOGGER.debug(f"Number of concordant reads: {concordant}")
LOGGER.info(f"Number of aligned reads file 1: {aligned_mate1}")
LOGGER.info(f"Number of aligned reads file 2: {aligned_mate2}")
LOGGER.info(f"Number of concordant reads: {concordant}")

self._update_relationship_type(
concordant, min(aligned_mate1, aligned_mate2)
Expand Down Expand Up @@ -351,7 +351,7 @@ def evaluate(self) -> None:
with open(self.path, encoding="utf-8") as _f: # type: ignore

# Get sequence identifier format from first record
LOGGER.debug(
LOGGER.info(
"Determining identifier and library type from first "
"record..."
)
Expand All @@ -375,13 +375,13 @@ def evaluate(self) -> None:
raise FileProblem(f"File is empty: {self.path}") from exc

if self.seq_id_format is not None:
LOGGER.debug(
LOGGER.info(
"Sequence identifier format: "
f"{self.seq_id_format.name}"
)
else:
self.result = StatesType.not_available
LOGGER.debug(
LOGGER.info(
"Could not determine sequence identifier format."
)

Expand Down
22 changes: 11 additions & 11 deletions htsinfer/get_read_orientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def evaluate(self) -> ResultsOrientation:
self.library_source.file_1.short_name is not None or
self.library_source.file_2.short_name is not None
):
LOGGER.debug("Determining read relationship by alignment...")
LOGGER.info("Determining read relationship by alignment...")
self.mapping.evaluate()

return self.process_alignments(star_dirs=self.mapping.star_dirs)
Expand Down Expand Up @@ -155,7 +155,7 @@ def process_single(
f"Failed to open SAM file: '{sam}'"
) from exc

LOGGER.debug("Deciding read orientation...")
LOGGER.info("Deciding read orientation...")
reads = len(states)
fractions = [
self.get_frequencies(*state) for state in states.values()
Expand All @@ -182,12 +182,12 @@ def process_single(
reads, fractions_all_states, orientation, paired=False
)

LOGGER.debug(
LOGGER.info(
f"Required number of mapped reads: {self.min_mapped_reads}"
)
LOGGER.debug(f"Number of mapped reads: {orient_df.iloc[0, 0]}")
LOGGER.debug(f"Fraction of SF: {orient_df.iloc[0, 1]}")
LOGGER.debug(f"Fraction of SR: {orient_df.iloc[0, 2]}")
LOGGER.info(f"Number of mapped reads: {orient_df.iloc[0, 0]}")
LOGGER.info(f"Fraction of SF: {orient_df.iloc[0, 1], 3}")
LOGGER.info(f"Fraction of SR: {orient_df.iloc[0, 2], 3}")
LOGGER.debug(f"Orientation: {orient_df.iloc[0, 3]}")

self.write_orientation_to_json(orient_df, self.paths[0].name)
Expand Down Expand Up @@ -268,7 +268,7 @@ def process_paired( # pylint: disable=R0912,R0915
) from exc

# deciding read orientation
LOGGER.debug("Deciding read orientation...")
LOGGER.info("Deciding read orientation...")
reads = len(states)
fractions = [
self.get_frequencies(*state) for state in states.values()
Expand Down Expand Up @@ -309,12 +309,12 @@ def process_paired( # pylint: disable=R0912,R0915
reads, fractions_all_states, orientation, paired=True, file_index=2
)

LOGGER.debug(
LOGGER.info(
f"Required number of mapped reads: {self.min_mapped_reads}"
)
LOGGER.debug(f"Number of mapped reads: {orient_df_1.iloc[0, 0]}")
LOGGER.debug(f"Fraction of ISF: {orient_df_1.iloc[0, 1]}")
LOGGER.debug(f"Fraction of ISR: {orient_df_1.iloc[0, 2]}")
LOGGER.info(f"Number of mapped reads: {orient_df_1.iloc[0, 0]}")
LOGGER.info(f"Fraction of ISF: {orient_df_1.iloc[0, 1], 3}")
LOGGER.info(f"Fraction of ISR: {orient_df_1.iloc[0, 2], 3}")
LOGGER.debug(f"Orientation file 1: {orient_df_1.iloc[0, 3]}")
LOGGER.debug(f"Orientation file 2: {orient_df_2.iloc[0, 3]}")
LOGGER.debug(
Expand Down
2 changes: 1 addition & 1 deletion htsinfer/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def generate_star_alignments(commands: Dict[Path, List[str]]) -> None:
Raises:
StarProblem: Generating alignments failed.
"""
LOGGER.debug("Aligning reads with STAR...")
LOGGER.info("Aligning reads with STAR...")

# execute commands
for out_dir, cmd in commands.items():
Expand Down
Loading