# HG changeset patch # User mb2013 # Date 1400570731 14400 # Node ID c2761ec99e82a26ddc0e2643badfe62ecb93ade5 # Parent a2aa2125087e2efce238e171230679da034c5b62 Uploaded diff -r a2aa2125087e -r c2761ec99e82 convertply.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/convertply.py Tue May 20 03:25:31 2014 -0400 @@ -0,0 +1,40 @@ +#Converter for ply to ply in Galaxy. +#MB +#last update: 9-5-2014 + +#This programm extracts the enters of the header, +#caused by importing it to Galaxy. + +import sys + +# removing all the empty lines in the ply file + +# Function main +def main(): + name_file_ply = sys.argv[1] # name of the ply file + name_output = sys.argv[2] # name of the output file + + # open the input and output file + file_ply = open(name_file_ply) + output = open(str(name_output), 'w') + + lines = file_ply.readlines() + file_ply.close() + + file_ply = open(name_file_ply) # re-open the file + remove_empty_lines(lines, name_file_ply, output) + +# Function remove empty line +def remove_empty_lines(lines,name_file_ply, output): + file_ply = open(name_file_ply) + for x in range(0,len(lines)): + line = file_ply.readline().strip() + line2 = line.strip().split() + + #writing all the correct lines to the ouputfile + if len(line2) != 0: + output.write('%s\n'%(line)) + + output.close() + +main()