Skip to content
Snippets Groups Projects
Commit fd6c5364 authored by Christoph Stritt's avatar Christoph Stritt
Browse files

... and from the rename rule

parent 3fe32b8f
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,8 @@ rule circlator_removeduplicates:
else:
if not skip:
output_handle.write(line)
output_handle.close()
rule circlator_localassembly:
......@@ -112,26 +114,22 @@ rule rename:
run:
import os
import sys
from Bio import SeqIO
contig_NR = 1
fasta_handle = open(output[0], "w")
with open(input.assembly) as original:
records = SeqIO.parse(original, 'fasta')
for line in original:
if line.startswith('>'):
for record in records:
seq_name = line.split(' ')[0][1:].strip()
seq_name_new = '>' + params.prefix + '_' + str(contig_NR)
fasta_handle.write(seq_name_new + '\n')
contig_NR += 1
record.id = params.prefix + "_" + str(contig_NR)
record.description = ""
SeqIO.write(record, fasta_handle, 'fasta')
contig_NR += 1
else:
fasta_handle.write(line)
fasta_handle.close()
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