Mercurial > repos > greg > gene_family_aligner
comparison utils.py @ 29:437a43ec5fb4 draft
Uploaded
| author | greg |
|---|---|
| date | Fri, 05 May 2017 10:29:59 -0400 |
| parents | 959926ea2a66 |
| children | 5691bc0a32d2 |
comparison
equal
deleted
inserted
replaced
| 28:4d6e5f90aab8 | 29:437a43ec5fb4 |
|---|---|
| 22 def get_response_buffers(): | 22 def get_response_buffers(): |
| 23 fstderr = os.path.join(os.getcwd(), FSTDERR) | 23 fstderr = os.path.join(os.getcwd(), FSTDERR) |
| 24 fherr = open(fstderr, 'wb') | 24 fherr = open(fstderr, 'wb') |
| 25 fstdout = os.path.join(os.getcwd(), FSTDOUT) | 25 fstdout = os.path.join(os.getcwd(), FSTDOUT) |
| 26 fhout = open(fstdout, 'wb') | 26 fhout = open(fstdout, 'wb') |
| 27 return fherr, fhout | 27 return fstderr, fherr, fstdout, fhout |
| 28 | 28 |
| 29 | 29 |
| 30 def move_directory_files(source_dir, destination_dir): | 30 def move_directory_files(source_dir, destination_dir): |
| 31 source_directory = os.path.abspath(source_dir) | 31 source_directory = os.path.abspath(source_dir) |
| 32 destination_directory = os.path.abspath(destination_dir) | 32 destination_directory = os.path.abspath(destination_dir) |
| 36 source_entry = os.path.join(source_directory, dir_entry) | 36 source_entry = os.path.join(source_directory, dir_entry) |
| 37 shutil.move(source_entry, destination_directory) | 37 shutil.move(source_entry, destination_directory) |
| 38 | 38 |
| 39 | 39 |
| 40 def run_command(cmd): | 40 def run_command(cmd): |
| 41 fherr, fhout = get_response_buffers() | 41 fstderr, fherr, fstdout, fhout = get_response_buffers() |
| 42 proc = subprocess.Popen(args=cmd, stderr=fherr, stdout=fhout, shell=True) | 42 proc = subprocess.Popen(args=cmd, stderr=fherr, stdout=fhout, shell=True) |
| 43 rc = proc.wait() | 43 rc = proc.wait() |
| 44 # Check results. | 44 # Check results. |
| 45 fherr.close() | 45 fherr.close() |
| 46 fhout.close() | 46 fhout.close() |
