# HG changeset patch # User greg # Date 1448370940 18000 # Node ID 2e0ddcc726f9a26be456178d97c640cba55427af # Parent 9ed566138ecb24660d45b3b4057c762122815133 Uploaded diff -r 9ed566138ecb -r 2e0ddcc726f9 cwpair2_util.py --- a/cwpair2_util.py Sat Nov 21 09:01:46 2015 -0500 +++ b/cwpair2_util.py Tue Nov 24 08:15:40 2015 -0500 @@ -225,7 +225,7 @@ def process_file(dataset_path, galaxy_hid, method, threshold, up_distance, - down_distance, binsize, output_files, sort_chromosome, sort_score): + down_distance, binsize, output_files, sort_score): if method == 'all': match_methods = METHODS.keys() else: @@ -240,7 +240,6 @@ down_distance, binsize, output_files, - sort_chromosome, sort_score) statistics.append(stats) if output_files == 'all' and method == 'all': @@ -251,7 +250,7 @@ def perform_process(dataset_path, galaxy_hid, method, threshold, up_distance, - down_distance, binsize, output_files, sort_chromosome, sort_score): + down_distance, binsize, output_files, sort_score): output_details = output_files in ["all", "simple_orphan_detail"] output_plots = output_files in ["all"] output_orphans = output_files in ["all", "simple_orphan", "simple_orphan_detail"] @@ -367,27 +366,12 @@ orphan_output.writerow((cname, cpeak[0], cpeak[1], cpeak[2], cpeak[3])) # Keep track of orphans for statistics. orphans += len(crick) - # Sort output by chromosome if specified. - if sort_chromosome == "asc": - try: - x.sort(key=lambda data: int(data[3])) - x.sort(key=lambda data: int(data[0])) - except: - # Cannot sort because chromosome number is not a numeric. - pass - elif sort_chromosome == "desc": - try: - x.sort(key=lambda data: int(data[0]), reverse=True) - x.sort(key=lambda data: int(data[3]), reverse=True) - except: - # Cannot sort because chromosome number is not a numeric. - pass # Sort output by score if specified. if sort_score == "desc": x.sort(key=lambda data: float(data[5]), reverse=True) elif sort_score == "asc": x.sort(key=lambda data: float(data[5])) - # Writing a summary to txt or gff format file + # Writing a summary to gff format file for row in x: row_tmp = list(row) # Dataset in tuple cannot be modified in Python, so row will