Skip to content

Commit

Permalink
Update split.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KennthShang committed Mar 28, 2019
1 parent 198e105 commit 9b81eff
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions 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: "))
Expand All @@ -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()
f.close()

0 comments on commit 9b81eff

Please sign in to comment.