We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 92a7a8f commit 54fb18cCopy full SHA for 54fb18c
archive/scripts/protein_converter.py
@@ -0,0 +1,22 @@
1
+import sys
2
+from Bio import SeqIO
3
+
4
+# Get input and output file paths from command-line arguments
5
+# Daniel Paiva Agustinho
6
+input_file = sys.argv[1]
7
+output_file = sys.argv[2]
8
9
+with open(input_file, "r") as input_handle:
10
+ with open(output_file, "w") as output_handle:
11
+ for record in SeqIO.parse(input_handle, "fasta"):
12
+ protein_seq = record.seq.translate()
13
14
+ # Extract the entire original header
15
+ original_header = record.description
16
17
+ # Create a new sequence record with the original header
18
+ protein_seq = SeqIO.SeqRecord(
19
+ protein_seq, id=record.id, description=original_header
20
+ )
21
+ SeqIO.write(protein_seq, output_handle, "fasta")
22
+print("done",str(output_file))
0 commit comments