Skip to content
Permalink
Browse files

Update split.py

  • Loading branch information
KennthShang committed Mar 28, 2019
1 parent 198e105 commit 9b81eff454d2445ac75cc2fe6dc7f5997a161e6d
Showing with 6 additions and 3 deletions.
  1. +6 −3 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()
f.close()

0 comments on commit 9b81eff

Please sign in to comment.
You can’t perform that action at this time.