Skip to content

Commit

Permalink
Added Validator -> Fix #32
Browse files Browse the repository at this point in the history
  • Loading branch information
basti committed Jan 6, 2019
1 parent fc9c02c commit b3223d1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
35 changes: 35 additions & 0 deletions bin/3.1_create_gtf/Modules/Validator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class Validator:

"""
Class to validate the gtf-output-file.
@author: Sebastian Beyvers
@contact: sebastian.beyvers@med.uni-giessen.de
"""

def __init__(self, out_file):

# Constructor
# input_parameter: out_file = Path to Outputfile

self.out_file = out_file
self.test_read_file()

def test_read_file(self):

# Method to testread the file

with open(self.out_file) as outfile:
line = outfile.readline()

if line:
if len(line.split("\t")) == 9:
print("Check successfull !")
else:
print("Incorrect output Format: Try again after deleting data folder.")
else:
print("Outputfile not in correct Format: Try again after deleting data Folder.")
exit(1)

# Debug
# v = Validator("/home/basti/Schreibtisch/test_hg38.gtf")
5 changes: 5 additions & 0 deletions bin/3.1_create_gtf/RegGTFExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from Modules.Uniquifier import UniqueFilter
from Modules.SaveResults import ResultSaver
from Modules.CrossMapper import CrossMapper
from Modules.Validator import Validator
import os
import json

Expand Down Expand Up @@ -134,6 +135,10 @@ def main_script(organism, wd, data_dir, out, tissuetype=None):
if x_mappable:
CrossMapper(organism, wd, out, False)

# Validate outputfile

Validator(out)


if __name__ == '__main__':

Expand Down

0 comments on commit b3223d1

Please sign in to comment.