Skip to content

Commit

Permalink
update handling of files w/ special characters
Browse files Browse the repository at this point in the history
  • Loading branch information
treangen committed Feb 5, 2015
1 parent 4d11013 commit c24b787
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Parsnp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
from multiprocessing import *

reroot_tree = True #use --midpoint-reroot

try:
import dendropy
except ImportError:
reroot_tree = False


#check for sane file names
special_chars = [",","[","]","{","}","(",")","!","\'","\"","*","\%","\<" ,"\>", "|", " ", "`"]
CSI=""#"\x1B["
reset=""#CSI+"m"
BOLDME = ""#CSI+'\033[1m'
Expand Down Expand Up @@ -651,7 +653,15 @@ def usage():
reflen = 0
fnafiles1 = []
for file in files:

nameok = True
for char in special_chars:
if char in file:

print "WARNING: File %s contains a non-supported special character (\'%s\') in file name. Please remove if you'd like to include. For best practices see: http://support.apple.com/en-us/HT202808"%(file,char)
nameok = False
break
if not nameok:
continue
#any file in genome dir will be added..
if file[0] != "." and file[-1] != "~":

Expand All @@ -678,6 +688,15 @@ def usage():
reflen = len(data)
ff.close()
for file in files:
nameok = True

for char in special_chars:
if char in file:
#print "WARNING: File %s contains a non-supported special character (%s) in file name. Please remove if you'd like to include. For best practices see: http://support.apple.com/en-us/HT202808"%(file,char)
nameok = False
break
if not nameok:
continue
if file[0] != "." and file[-1] != "~":
ff = open(seqdir+os.sep+file,'r')
hdr = ff.readline()
Expand Down

0 comments on commit c24b787

Please sign in to comment.