Skip to content

Commit

Permalink
newreference: If gene is not found, print a warning and use entire ge…
Browse files Browse the repository at this point in the history
…nome

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.
  • Loading branch information
j23414 committed Mar 8, 2024
1 parent 570daa6 commit 822d2d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/newreference.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def new_reference(referencefile, outgenbank, outfasta, gene):
qualifiers=ref_source_feature.qualifiers)
record.features.append(source_feature)

# If user provides a --gene 'some name' is not found, print a warning and use the entire genome.
# Otherwise do not print a warning.
if(gene != None and startofgene==None and endofgene==None):
print(f"WARNING: No 'gene' or 'CDS' features found with name '{gene}', using entire genome instead.")

SeqIO.write(record, outgenbank, 'genbank')
SeqIO.write(record, outfasta, "fasta")

Expand Down

0 comments on commit 822d2d6

Please sign in to comment.