/tools/visualization/GMAJ.py

https://bitbucket.org/h_morita_dbcls/galaxy-central · Python · 23 lines · 12 code · 4 blank · 7 comment · 4 complexity · d5926aaaa7adfaa03c636e6fbea1dd34 MD5 · raw file

  1. #!/usr/bin/env python
  2. """
  3. Script that Creates a zip file for use by GMAJ
  4. """
  5. import sys, zipfile
  6. def __main__():
  7. #create a new zip file
  8. out_file = zipfile.ZipFile( sys.argv[1], "w" )
  9. #add info files
  10. out_file.write( sys.argv[3], "input.gmaj" ) #THIS FILE MUST BE ADDED FIRST
  11. out_file.write( sys.argv[2], "input.maf" )
  12. #add annotation files
  13. for line in open( sys.argv[4] ):
  14. try:
  15. out_file.write( *[ field.strip() for field in line.split( "=", 1 ) ] )
  16. except:
  17. continue
  18. out_file.close()
  19. if __name__ == "__main__": __main__()