comparison convertply.py @ 3:c2761ec99e82 draft

Uploaded
author mb2013
date Tue, 20 May 2014 03:25:31 -0400
parents
children
comparison
equal deleted inserted replaced
2:a2aa2125087e 3:c2761ec99e82
1 #Converter for ply to ply in Galaxy.
2 #MB
3 #last update: 9-5-2014
4
5 #This programm extracts the enters of the header,
6 #caused by importing it to Galaxy.
7
8 import sys
9
10 # removing all the empty lines in the ply file
11
12 # Function main
13 def main():
14 name_file_ply = sys.argv[1] # name of the ply file
15 name_output = sys.argv[2] # name of the output file
16
17 # open the input and output file
18 file_ply = open(name_file_ply)
19 output = open(str(name_output), 'w')
20
21 lines = file_ply.readlines()
22 file_ply.close()
23
24 file_ply = open(name_file_ply) # re-open the file
25 remove_empty_lines(lines, name_file_ply, output)
26
27 # Function remove empty line
28 def remove_empty_lines(lines,name_file_ply, output):
29 file_ply = open(name_file_ply)
30 for x in range(0,len(lines)):
31 line = file_ply.readline().strip()
32 line2 = line.strip().split()
33
34 #writing all the correct lines to the ouputfile
35 if len(line2) != 0:
36 output.write('%s\n'%(line))
37
38 output.close()
39
40 main()