Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Sep 27, 2023
1 parent 1fe61c6 commit b182c3e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 77 deletions.
5 changes: 1 addition & 4 deletions util/get_query_aminoacids_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

def get_query_aminoacids_table(sequence):
if not hasattr(sequence.seq, "query_aminoacids_table"):
try:
sequence.seq.query_aminoacids_table = [translate_to_aminoacids(sequence.seq, i) for i in range(3)]
except Bio.Data.CodonTable.TranslationError as e:
sequence.seq.query_aminoacids_table = e
sequence.seq.query_aminoacids_table = [translate_to_aminoacids(sequence.seq, i) for i in range(3)]

return sequence.seq.query_aminoacids_table
45 changes: 0 additions & 45 deletions util/log.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import inspect
import logging
import os
import select
import subprocess

FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'

Expand All @@ -12,46 +8,5 @@
def error(error):
logger.error(error)

def warning(warning):
logger.warning(warning)

def info(info):
logger.info(info)

def debug(debug):
logger.debug(debug)

def logging_call(popenargs, output_stream, error_function):

"""
Call a subprocess and log the output to stderr to a logfile.
Args:
popenargs: The arguments to run in the subprocess
output_stream: The stream to pipe stdout to
Returns:
A path to the SAM output file created.
"""
process = subprocess.Popen(" ".join(popenargs),
stdout=output_stream,
stderr=subprocess.PIPE,
shell=True,
env=os.environ)

# Get the caller of this function,
# so we can report where we're logging from.
current_frame = inspect.currentframe()
calling_frame = inspect.getouterframes(current_frame, 2)

def check_io():
while True:
err = process.stderr.readline().decode()
if err:
error_function("From " + calling_frame[1][3] + " - " + err.rstrip())
else:
break

# keep checking stdout/stderr until the child exits
while process.poll() is None:
check_io()
28 changes: 0 additions & 28 deletions util/subtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,3 @@ def convert_from_aligned_to_reference(position, alignment):
subtype_pos += 1
if alignment[1][i] != "-":
hxb2_pos += 1

def map_hxb2_positions_to_subtype(subtype):
"""
Convert position numbers in HXB2 to the equivalent in another subtype.
Args:
subtype: subtype position to convert to
"""

sequences = [HXB2(), subtype_sequence(subtype)]
alignment = wrappers.mafft(sequences)
return coords.map_positions(alignment[0], alignment[1])

def map_subtype_positions_to_hxb2(orientation, subtype):
"""
Convert position numbers in HXB2 to the equivalent in another subtype.
Args:
subtype: subtype position to convert to
"""

sequences = [subtype_sequence(subtype), HXB2()]
if orientation == "reverse":
sequences = [SeqRecord.SeqRecord(Seq.reverse_complement(s.seq),
id = s.id, name = s.name) for s in sequences]

alignment = wrappers.mafft(sequences)
return coords.map_positions(alignment[0], alignment[1])

0 comments on commit b182c3e

Please sign in to comment.