forked from sriniavireddy/CSE282
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkmers.py
45 lines (31 loc) · 1021 Bytes
/
kmers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import random
import os
def get_random_sequence_kmers(count):
input_file_path = os.path.split(__file__)[0]
input_file_path += '/data/reverseKmers.txt'
f = open(input_file_path, "r")
seqKmers = []
for line in f.readlines():
kmer = line.strip()
seqKmers.append(kmer)
random.shuffle(seqKmers)
seqKmers = seqKmers[0:1000]
return seqKmers
def get_sequence_kmers(input_file):
input_file_path = os.path.split(__file__)[0]
input_file_path += '/data/' + input_file
f = open(input_file_path, "r")
sequence_kmer_list = []
for line in f.readlines():
kmer = line.strip()
sequence_kmer_list.append(kmer)
return sequence_kmer_list
def get_design_kmers():
input_file_path = os.path.split(__file__)[0]
input_file_path += '/data/design_kmers.txt'
f = open(input_file_path, "r")
designKmers = []
for line in f.readlines():
if line[0] != ">":
designKmers.append(line.strip())
return designKmers