From 9b81eff454d2445ac75cc2fe6dc7f5997a161e6d Mon Sep 17 00:00:00 2001 From: Kenneth Shang Date: Thu, 28 Mar 2019 19:18:03 +0800 Subject: [PATCH] Update split.py --- split.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/split.py b/split.py index 8d75072..757204d 100644 --- a/split.py +++ b/split.py @@ -1,3 +1,4 @@ +import os # Input Hint filename = input("Input filename: ") k = int(input("how many files you want to split to: ")) @@ -14,14 +15,16 @@ # Splitting the file for i in range(k-1): temp = file[i*length_seq_num*2:i*length_seq_num*2+length_seq_num*2] - f = open("virus"+str(i+1)+".fa", 'w') + os.system("mkdir splitted"+str(i+1)) + f = open("splitted"+str(i+1)+"/splitted"+".fa", 'w') for L in temp: f.write(L) f.close() # For the Last splitted file, save all the remained reads +os.system("mkdir splitted"+str(k)) temp = file[(k-1)*length_seq_num:] -f = open("virus"+str(k)+".fa", 'w') +f = open("splitted"+str(k)+"/splitted"+".fa", 'w') for L in temp: f.write(L) -f.close() \ No newline at end of file +f.close()