Skip to content
Snippets Groups Projects
Commit b69bdbc2 authored by Ivan Vanát's avatar Ivan Vanát
Browse files

cleanup after solo_ltr and trf; correct solo_ltr numbering

parent b3de6c8e
No related branches found
No related tags found
1 merge request!23Feature/custom discovery tool
......@@ -41,6 +41,7 @@ class SoloLtrs(object):
def create_ltr_multifasta(self, tes, seq):
offset = len(self.ltr_lengths.keys())
num = 1
with open("{}_ltrs.fa".format(self.seqId), 'a+') as file:
for i in range(len(self.ltr_lengths.keys()), len(self.ltr_lengths.keys()) + len(tes)):
if (intervals.length(tes[i - offset].ltr_left_location) < 100
......@@ -48,9 +49,10 @@ class SoloLtrs(object):
or math.isnan(tes[i - offset].tsr_right[0])):
continue
file.write(">ltr_" + str(i) + "\n")
file.write(">ltr_" + str(num) + "\n")
file.write(str(seq[tes[i - offset].ltr_left_location[0]:tes[i - offset].ltr_left_location[1] + 1]) + "\n")
self.ltr_lengths["ltr_" + str(i)] = len(str(seq[tes[i - offset].ltr_left_location[0]:tes[i - offset].ltr_left_location[1] + 1]))
num += 1
def run_blastn(self):
args = dict(config['blastx']['args'])
......@@ -114,6 +116,7 @@ class SoloLtrs(object):
result.difference(intersections.keys())
result.add(real_best)
# refactor this
def cleanup(self):
if os.path.isfile("{}.nhr".format(self.ltrs_fasta_path)):
os.remove("{}.nhr".format(self.ltrs_fasta_path))
......@@ -121,4 +124,13 @@ class SoloLtrs(object):
os.remove("{}.nin".format(self.ltrs_fasta_path))
if os.path.isfile("{}.nsq".format(self.ltrs_fasta_path)):
os.remove("{}.nsq".format(self.ltrs_fasta_path))
if os.path.isfile("{}.ndb".format(self.ltrs_fasta_path)):
os.remove("{}.ndb".format(self.ltrs_fasta_path))
if os.path.isfile("{}.not".format(self.ltrs_fasta_path)):
os.remove("{}.not".format(self.ltrs_fasta_path))
if os.path.isfile("{}.ntf".format(self.ltrs_fasta_path)):
os.remove("{}.ntf".format(self.ltrs_fasta_path))
if os.path.isfile("{}.nto".format(self.ltrs_fasta_path)):
os.remove("{}.nto".format(self.ltrs_fasta_path))
......@@ -74,6 +74,9 @@ def get_candidates(seqid):
split = entry.split(' ')
candidates.append(TandemRepeat([int(split[0]), int(split[1])], int(split[2]), float(split[3]),
int(split[5]), int(split[6]), int(split[7]), float(split[12]), split[-1]))
cleanup()
return candidates
def filter_candidates(candidates):
......@@ -101,5 +104,11 @@ def filter_candidates(candidates):
repeats.append(candidate)
return repeats
def cleanup():
if os.path.isfile("{}.fa.2.5.7.80.10.50.2000.dat".format(seqid)):
os.remove("{}.fa.2.5.7.80.10.50.2000.dat".format(seqid))
if os.path.isfile("{}.fa.2.5.7.80.10.50.2000.mask".format(seqid)):
os.remove("{}.fa.2.5.7.80.10.50.2000.mask".format(seqid))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment