With python, error debuging starts at the bottom - with the 'last' error found
Also, to parse options, you should loop through the arguments, and use a case statement to identify the current option name 'opt' (which was retrieved from arg[v]).
Have a look at: info getopt and continue reading (PGDN).
Also checkout man getopt, to get a possible location for code Examples.
Note also that inputfile is only defined if a -i inputfile option is present on the command line.
Maybe you want to define it with a default value in case that option is not present. Or, if there is no reasonable default, print an error message and exit if no -i option was found while parsing the options.
Could not find examples on handling file I/O stream.
I have difficulty to understand string[file] I/O stream here. In the example code, the function prototype is def get_overlap_data(m4_filename):
and, calling of the function is by overlap_data, contained_reads = get_overlap_data(inputfile) whereinputfile = arg from argument parsing.
I am not sure what I have missed among the connections, if any stream is involved.
Thanks any way!