make script runnable with self
add in PERMID code
remove revcomp related code