Repository 'nepenthes_3dpca'
hg clone https://toolshed.g2.bx.psu.edu/repos/mb2013/nepenthes_3dpca

Changeset 3:c2761ec99e82 (2014-05-20)
Previous changeset 2:a2aa2125087e (2014-05-20) Next changeset 4:22dfb371b509 (2014-05-20)
Commit message:
Uploaded
added:
convertply.py
b
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()