Skip to content

Commit

Permalink
Merge pull request #100 from shjenkins94/fix_u12
Browse files Browse the repository at this point in the history
Fix u12 argument check
  • Loading branch information
kirilenkobm authored Sep 30, 2023
2 parents 6638de5 + c97f2a7 commit 8ccb107
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/sanity_check_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def check_2bit_file_completeness(two_bit_file, chroms_sizes, chrom_file):
return


def check_and_write_u12_file(t_in_bed, u12_arg, temp_wd):
def check_and_write_u12_file(u12_arg, t_in_bed, temp_wd):
"""Sanity check for U12 file."""
if u12_arg is None:
return None
Expand Down
17 changes: 10 additions & 7 deletions toga.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ def __init__(self, args):
self.gene_prefix = args.gene_prefix
self.isoforms_arg = args.isoforms if args.isoforms else None
self.isoforms = None # will be assigned after completeness check
self.u12_arg = args.u12 if args.u12 else None
self.u12 = None # assign after U12 file check
self.chain_jobs = args.chain_jobs_num
self.cesar_binary = (
self.DEFAULT_CESAR if not args.cesar_binary else args.cesar_binary
Expand Down Expand Up @@ -242,6 +244,7 @@ def __init__(self, args):
self.temp_wd, Constants.CESAR_PRECOMPUTED_MEMORY_DATA
)
self.precomp_reg_dir = None

self.u12_arg = args.u12
self.u12 = None # assign after U12 file check

Expand Down Expand Up @@ -324,13 +327,13 @@ def __check_args_correctness(self, args):
def __check_param_files(self):
"""Check that all parameter files exist."""
files_to_check = [
self.u12,
self.t_2bit,
self.q_2bit,
self.cesar_binary,
self.ref_bed,
self.chain_file,
self.isoforms_arg,
self.u12_arg,
]
for item in files_to_check:
if not item:
Expand All @@ -350,7 +353,7 @@ def __check_param_files(self):
# to compare chrom lengths with 2bit
chrom_sizes_in_bed = {x: None for x in chroms_in_bed}
self.isoforms = check_isoforms_file(self.isoforms_arg, t_in_bed, self.temp_wd)
self.u12 = check_and_write_u12_file(t_in_bed, self.u12_arg, self.temp_wd)
self.u12 = check_and_write_u12_file(self.u12_arg, t_in_bed, self.temp_wd)
check_2bit_file_completeness(self.t_2bit, chrom_sizes_in_bed, self.ref_bed)
# need to check that chain chroms and their sizes match 2bit file data
with open(self.chain_file, "r") as f:
Expand All @@ -376,19 +379,19 @@ def __modules_addr(self):
self.LOCATION = os.path.dirname(__file__) # folder containing pipeline scripts
self.CONFIGURE = os.path.join(self.LOCATION, "configure.sh")
self.CHAIN_SCORE_FILTER = os.path.join(
self.LOCATION, "modules", "chain_score_filter"
self.LOCATION, Constants.MODULES_DIR, "chain_score_filter"
)
self.CHAIN_SCORE_FILTER_AWK = os.path.join(
self.LOCATION, "modules", "chain_score_filter.awk"
self.LOCATION, Constants.MODULES_DIR, "chain_score_filter.awk"
)
self.CHAIN_COORDS_CONVERT_LIB = os.path.join(
self.LOCATION, "modules", "chain_coords_converter_slib.so"
self.LOCATION, Constants.MODULES_DIR, "chain_coords_converter_slib.so"
)
self.EXTRACT_SUBCHAIN_LIB = os.path.join(
self.LOCATION, "modules", "extract_subchain_slib.so"
self.LOCATION, Constants.MODULES_DIR, "extract_subchain_slib.so"
)
self.CHAIN_FILTER_BY_ID = os.path.join(
self.LOCATION, "modules", "chain_filter_by_id"
self.LOCATION, Constants.MODULES_DIR, "chain_filter_by_id"
)
self.CHAIN_BDB_INDEX = os.path.join(
self.LOCATION, Constants.MODULES_DIR, "chain_bst_index.py"
Expand Down

0 comments on commit 8ccb107

Please sign in to comment.