Commit b9a44cd9 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files also generates some VJ recombinations with removes

parent e4df4530
......@@ -11,6 +11,25 @@ def recombine_VJ(seq5, remove5, N, remove3, seq3):
return fasta.Fasta(name, seq)
def random_sequence(characters, length):
return ''.join([random.choice(characters) for x in range(length)])
def recombine_VJ_with_removes(seq5, remove5, Nlength, remove3, seq3):
'''Recombine V and J with a random N, ensuring that the bases in N are not the same that what was ultimately removed from V or J'''
assert(Nlength >= 1)
available = ['A', 'C', 'G', 'T']
if remove5:
if remove3:
c = seq3.seq[remove3-1].upper()
if c in available:
return recombine_VJ(seq5, remove5, random_sequence(available, Nlength), remove3, seq3)
def select_genes(rep5, rep3, at_least=0):
nb = 0
for seq5 in rep5:
......@@ -70,4 +89,7 @@ for code in germlines:
generate_to_file(rep5, rep3, '../data/gen/0-removes-%s.should-vdj.fa' % code,
(lambda seq5, seq3: recombine_VJ(seq5, 0, 'ATCG', 0, seq3)))
generate_to_file(rep5, rep3, '../data/gen/5-removes-%s.should-vdj.fa' % code,
(lambda seq5, seq3: recombine_VJ_with_removes(seq5, 5, 4, 5, seq3)))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment