From 6ed7d989766323e6e834268171c50f89199babef Mon Sep 17 00:00:00 2001 From: basti Date: Fri, 11 Jan 2019 13:18:05 +0100 Subject: [PATCH] Added sorted outputs to improve handling in IGV -> Fix #55 --- bin/3.1_create_gtf/Modules/Validator.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/3.1_create_gtf/Modules/Validator.py b/bin/3.1_create_gtf/Modules/Validator.py index ee34471..ae66f75 100644 --- a/bin/3.1_create_gtf/Modules/Validator.py +++ b/bin/3.1_create_gtf/Modules/Validator.py @@ -1,7 +1,10 @@ +import os + + class Validator: """ - Class to validate the gtf-output-file. + Class to validate and sort the gtf-output-file. @author: Sebastian Beyvers @contact: sebastian.beyvers@med.uni-giessen.de @@ -13,8 +16,17 @@ def __init__(self, out_file): # input_parameter: out_file = path to output file self.out_file = out_file + self.sort_file() self.test_read_file() + def sort_file(self): + + # function that utilizes linux sort to sort the output by chromosome and start coordinate, + # this improves handling in tools like IGV + + command = "sort -V -k1,1 -k4,4n -o "+self.out_file+" "+self.out_file + os.system(command) + def test_read_file(self): # Method to test the output file-format