Commit 1b3ad2f1 authored by cmaffeo2's avatar cmaffeo2
Browse files

Updated dnarbd script to use pathlib and to use file's basename rather than full path

parent a83baf1b
......@@ -3,6 +3,7 @@
import argparse
import re
import pathlib
from dnarbd.simulate import multiresolution_simulation as simulate
parser = argparse.ArgumentParser(prog="dnarbd",
......@@ -31,24 +32,23 @@ args = parser.parse_args()
if __name__ == '__main__':
infile = args.input_file
infile = pathlib.Path(args.input_file)
try:
re_result = re.match("(.*)\.([^.]+)",infile)
prefix = re_result.group(1)
extension = re_result.group(2).lower()
prefix = infile.stem
extension = ".".join(infile.suffixes)
except:
raise Exception("Unrecognized input file '{}'".format(infile))
if extension == 'json':
if extension == '.json':
from dnarbd.readers import read_cadnano as read_model
elif extension == 'ma':
elif extension == '.ma':
from dnarbd.readers import read_vhelix as read_model
elif extension == 'pdb':
elif extension == '.pdb':
from dnarbd.readers import read_atomic_pdb as read_model
else:
raise Exception("Unrecognized input file '{}'".format(infile))
model = read_model( infile )
model = read_model( str(infile) )
if args.output_prefix is not None:
prefix = args.output_prefix
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment