Skip to content

Commit

Permalink
support for multiple vectors added
Browse files Browse the repository at this point in the history
  • Loading branch information
olgatsiouri1996 committed Aug 2, 2021
1 parent 42e8475 commit a1dae15
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions synbio/ligate_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,24 @@
@Gooey(required_cols=3, program_name='digital ligation', header_bg_color= '#DCDCDC', terminal_font_color= '#DCDCDC', terminal_panel_color= '#DCDCDC')
def main():
ap = GooeyParser(description="ligate linear vector with DNA insert")
ap.add_argument("-vr", "--vector", required=True, widget='FileChooser', help="linear vector(fasta format)")
ap.add_argument("-vr", "--vector", required=True, widget='FileChooser', help="linear vector/s (single or multi fasta file)")
ap.add_argument("-in", "--insert", required=True, widget='FileChooser', help="sequence/s to insert in the vector(single or multi fasta file)")
ap.add_argument("-out", "--output", required=True, widget='FileSaver', help="output genbank file with circular sequence/s")
args = vars(ap.parse_args())
# main
# linear vector
for record in SeqIO.parse(args['vector'], "fasta"):
x = str(record.seq)
# DNA insert
output_handle = open(args['output'], "w")
records = [] # setup an empty list
for record in SeqIO.parse(args['insert'], "fasta"):
y = str(record.seq)
# merge
seqad = x + y
# add this record to the list
records.append(SeqRecord(Seq(seqad),id=record.id,description="",annotations={"topology":"circular"}))
for seq in records:
seq.seq.alphabet = generic_dna
# export to fasta
for plasmid in SeqIO.parse(args['vector'], "fasta"):
x = str(plasmid.seq)
# DNA insert
for record in SeqIO.parse(args['insert'], "fasta"):
y = str(record.seq)
# merge
seqad = y + x
# add this record to the list
records.append(SeqRecord(Seq(seqad,generic_dna),id='_'.join([record.id,plasmid.id]),description="",annotations={"topology":"circular"}))
# export to fasta
SeqIO.write(records,output_handle, "genbank")
output_handle.close()

Expand Down

0 comments on commit a1dae15

Please sign in to comment.