Skip to content

Commit

Permalink
input genes of interest as a text file only and no more as list
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiia committed Dec 11, 2018
1 parent d236c95 commit f4532e8
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions find_exons.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def parse_args():
required_arguments = parser.add_argument_group('required arguments')
required_arguments.add_argument('--gtf_genes', help='a .gtf file with genes', required=True)
required_arguments.add_argument('--gtf_exons', help='a .gtf file with exons', required=True)
required_arguments.add_argument('--genes_of_interest', nargs='*', dest='genes_of_interest', help='a .txt file or a list with genes one is interested in', required=True)
required_arguments.add_argument('--genes_of_interest', nargs='*', dest='genes_of_interest', help='a .txt file with genes of interest containing one columnt with gene names', required=True)

#all other arguments are optional
parser.add_argument('--output_directory', default='output', const='output', nargs='?', help='output directory, by default ./output/')
Expand All @@ -46,16 +46,6 @@ def check_directory(directory):
os.makedirs(directory)
print('a new directory ' + directory + ' was created')

def remove_file(file):
if os.path.isfile(file):
os.remove(file)

def make_name_from_path(full_path, output_directory, ending):
return os.path.join(output_directory, get_name_from_path(full_path) + ending)

def get_name_from_path(full_path):
return os.path.splitext(os.path.basename(full_path))[0]

def check_existing_input_files(args):

print('checking the input files')
Expand All @@ -70,8 +60,9 @@ def check_existing_input_files(args):

if len(args.genes_of_interest) == 1:
if not os.path.isfile(args.genes_of_interest[0]):
print('working with one gene of interest')
genes_of_interest = args.genes_of_interest
#print('working with one gene of interest')
#genes_of_interest = args.genes_of_interest
print('please provide a file with genes of interest in .txt format containint one column with names of genes you are interested in')
else:
print('reading from the file with genes')
#there is a file with list of genes. Extract them and return in an array
Expand All @@ -90,8 +81,9 @@ def check_existing_input_files(args):
genes_of_interest = genes

else: #there is a list of genes of interest
print('working with a list of genes')
genes_of_interest = args.genes_of_interest
#print('working with a list of genes')
#genes_of_interest = args.genes_of_interest
print('please provide only one file with genes of interest')

return genes_of_interest

Expand Down

0 comments on commit f4532e8

Please sign in to comment.