Skip to content

Commit 822d2d6

Browse files
committed
newreference: If gene is not found, print a warning and use entire genome
Currently, if the --gene option is used and the gene is not found, the script will use the entire genome without printing a warning. This commit adds a warning to notify the user of this behavior. If the --gene option is not used, the warning is not printed.
1 parent 570daa6 commit 822d2d6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scripts/newreference.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ def new_reference(referencefile, outgenbank, outfasta, gene):
2222
qualifiers=ref_source_feature.qualifiers)
2323
record.features.append(source_feature)
2424

25+
# If user provides a --gene 'some name' is not found, print a warning and use the entire genome.
26+
# Otherwise do not print a warning.
27+
if(gene != None and startofgene==None and endofgene==None):
28+
print(f"WARNING: No 'gene' or 'CDS' features found with name '{gene}', using entire genome instead.")
29+
2530
SeqIO.write(record, outgenbank, 'genbank')
2631
SeqIO.write(record, outfasta, "fasta")
2732

0 commit comments

Comments
 (0)