Skip to content

Commit

Permalink
Fixing that a string is used to concatenate to a Seq object in a SeqR…
Browse files Browse the repository at this point in the history
…ecord
  • Loading branch information
KatharinaHoff committed Feb 15, 2024
1 parent c979447 commit d5757b6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/getAnnoFastaFromJoingenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Author: Katharina J. Hoff
# E-Mail: [email protected]
# Last modified on August 26th 2019
# Last modified on February 15th 2024
#
# This Python script extracts CDS features from a GTF file, excises
# corresponding sequence windows from a genome FASTA file, stitches the
Expand All @@ -16,7 +16,8 @@
# warning to STDOUT if such genes are in the GTF-file. The IDs of bad genes
# are printed to a file bad_genes.lst. Option -s allows to exclude bad genes
# from the FASTA output file, automatically.
# Beware: the script assumes that the gtf input file is sorted by coordinates!
# Beware: The script assumes that the gtf input file is sorted by coordinates!
# Assumptions on AUGUSTUS-specific GTF format are made.

try:
import argparse
Expand Down Expand Up @@ -161,8 +162,8 @@
if i == 0 and cds_line['strand'] == '+' and cds_line['frame'] != 0:
codingseq[tx].seq += Seq((3 - cds_line['frame'])
* 'N')
codingseq[tx].seq += record.seq[cds_line['start'] -
1:cds_line['end']]
codingseq[tx].seq += Seq(record.seq[cds_line['start'] -
1:cds_line['end']])
if i == (nCDS - 1):
if cds_line['strand'] == '+':
if (len(codingseq[tx].seq) % 3) != 0:
Expand All @@ -175,8 +176,7 @@
if(len(codingseq[tx].seq) % 3) != 0:
codingseq[tx].seq = Seq(
(3 - (len(codingseq[tx].seq) % 3)) * 'N') + codingseq[tx].seq
codingseq[tx].seq = codingseq[
tx].seq.reverse_complement()
codingseq[tx].seq = codingseq[tx].seq.reverse_complement()
except IOError:
print("Error: Failed to open file " + args.genome + "!")
exit(1)
Expand Down

0 comments on commit d5757b6

Please sign in to comment.