aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-03-21 13:42:54 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2014-03-21 13:42:54 -0400
commitf363df2ac34c34b1c2f223bb5a81c456a764ac38 (patch)
treeb353cc9cb2666a9fea870ef92ac62b07bcab77f3 /src
parent8a6d1d0373b1acbe563a777f6da2850a06178c34 (diff)
add end of sequences in as points in our array
Diffstat (limited to 'src')
-rwxr-xr-xsrc/score_mers.py21
-rw-r--r--src/sequence_end_points.c (renamed from src/sequence_length.c)1
2 files changed, 21 insertions, 1 deletions
diff --git a/src/score_mers.py b/src/score_mers.py
index 6f0c6db..5c1a194 100755
--- a/src/score_mers.py
+++ b/src/score_mers.py
@@ -15,6 +15,8 @@ import pdb
fg_mers = {}
bg_mers = {}
+seq_ends = []
+
if(len(sys.argv) == 5):
selectivity_fn = sys.argv[1]
fg_fasta_fn = sys.argv[2]
@@ -181,8 +183,13 @@ def score(combination):
for mer in combination:
fg_pts = fg_pts + fg_mers[mer].pts
+ fg_pts = fg_pts + seq_ends
+
fg_pts.sort()
+ if fg_pts[0] is not 0:
+ fg_pts = [0] + fg_pts
+
# fg distances
fg_dist = np.diff(fg_pts)
@@ -221,6 +228,18 @@ def score(combination):
return [combination, score, fg_mean_dist, fg_std_dist, bg_ratio]
+def load_end_points(fn):
+
+ end_points = []
+
+ cmd = "sequence_end_points < " + fn
+
+ points_fh = Popen(cmd, stdout=PIPE, shell=True)
+ for line in points_fh.stdout:
+ end_points.append(int(line))
+
+ return end_points
+
def load_heterodimer_dic(selected_mers):
'''
Generate a heterodimer dict which contains every possible combination of
@@ -265,6 +284,8 @@ def main():
selected_mers = [row[0] for row in selected]
# print selected_mers
+ print "Populating sequence end points"
+ seq_ends = load_end_points(fg_fasta_fn)
print "Populating foreground locations"
map(pop_fg, selected_mers)
diff --git a/src/sequence_length.c b/src/sequence_end_points.c
index 3df7175..dc03dd9 100644
--- a/src/sequence_length.c
+++ b/src/sequence_end_points.c
@@ -24,7 +24,6 @@ int main() {
for(i = 0; i < len; i++) {
if(buffer[i] == '>') {
printf("%llu\n", seq_length);
- seq_length = 0;
header = true;
continue;
}