Skip to content

Commit

Permalink
Update 2.1.2_host_prediction_II.md
Browse files Browse the repository at this point in the history
  • Loading branch information
maltesie authored Sep 19, 2024
1 parent 51f2b24 commit 8caa352
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions _episodes/2.1.2_host_prediction_II.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,21 @@ forest model. This model matches the set of proteins with host proteins it was t
> from Bio import SeqIO
>
> def main():
>
>
> # define file paths from the arguments
> assembly_path = os.path.abspath(sys.argv[1])
> assert assembly_path.endswith(".fasta")
>
>
> # set an output directory and create it if it does not exist
> out_dir = os.path.abspath(sys.argv[2])
> if not os.path.exists(out_dir): os.makedirs(out_dir)
>
>
> # loop through the records in the combined assembly
> with open(assembly_path) as handle:
> for record in SeqIO.parse(handle, "fasta"):
> # set a filename per record
> out_fasta = os.path.join(out_dir, f"{record.id}.fasta")
> # write the record to the file
> with open(out_fasta, "w") as fout:
> SeqIO.write([record], fout, "fasta")
>
Expand Down

0 comments on commit 8caa352

Please sign in to comment.