nextgenusfs / funannotate

Eukaryotic Genome Annotation Pipeline
http://funannotate.readthedocs.io
BSD 2-Clause "Simplified" License
300 stars 82 forks source link

funannotate test -t annotate Error 'SimpleLocation' object has no attribute 'nofuzzy_start' #1005

Closed ewmorr closed 4 months ago

ewmorr commented 4 months ago

Are you using the latest release? funannotate v1.8.15 installed via mamba create --name funannotate funannotate

Describe the bug funannotate test -t annotate fails with: AttributeError: 'SimpleLocation' object has no attribute 'nofuzzy_start'

What command did you issue? funannotate test -t annotate --debug

Logfiles STDOUT/STDERR

#########################################################
Running `funannotate annotate` unit testing
Downloading: https://osf.io/97pyn/download?version=1 Bytes: 341476
CMD: funannotate annotate --genbank Genome_one.gbk -o annotate --cpus 2 --iprscan genome_one.iprscan.xml --eggnog genome_one.emapper.annotations
#########################################################
-------------------------------------------------------
[Feb 28 01:32 PM]: OS: CentOS Linux 7, 112 cores, ~ 528 GB RAM. Python: 3.8.15
[Feb 28 01:32 PM]: Running 1.8.15
[Feb 28 01:32 PM]: No NCBI SBT file given, will use default, however if you plan to submit to NCBI, create one and pass it here '--sbt'
[Feb 28 01:32 PM]: Checking GenBank file for annotation
Traceback (most recent call last):
  File ".conda/envs/funannotate/bin/funannotate", line 10, in <module>
    sys.exit(main())
  File ".conda/envs/funannotate/lib/python3.8/site-packages/funannotate/funannotate.py", line 718, in main
    mod.main(arguments)
  File ".conda/envs/funannotate/lib/python3.8/site-packages/funannotate/annotate.py", line 722, in main
    GeneCounts = lib.gb2parts(
  File ".conda/envs/funannotate/lib/python3.8/site-packages/funannotate/library.py", line 4061, in gb2parts
    gb_feature_add2dict(f, record, genes)
  File ".conda/envs/funannotate/lib/python3.8/site-packages/funannotate/library.py", line 4130, in gb_feature_add2dict
    start = f.location.nofuzzy_start
AttributeError: 'SimpleLocation' object has no attribute 'nofuzzy_start'
#########################################################
ERROR: `funannotate annotate` test failed - check logfiles
#########################################################

contents of test-annotate/funannotate-annotate.x.log

[02/28/24 15:25:13]: /mnt/home/.conda/envs/funannotate_new/bin/funannotate annotate --genbank Genome_one.gbk -o annotate --cpus 2 --iprscan genome_one.iprscan.xml --eggnog genome_one.emapper.annotations

[02/28/24 15:25:15]: OS: CentOS Linux 7, 112 cores, ~ 528 GB RAM. Python: 3.8.16
[02/28/24 15:25:15]: Running 1.8.15
[02/28/24 15:25:15]: hmmscan version=HMMER 3.4 (Aug 2023) path=/mnt/home/.conda/envs/funannotate_new/bin/hmmscan
[02/28/24 15:25:15]: hmmsearch version=HMMER 3.4 (Aug 2023) path=/mnt/home/.conda/envs/funannotate_new/bin/hmmsearch
[02/28/24 15:25:15]: diamond version=2.1.8 path=/mnt/home/.conda/envs/funannotate_new/bin/diamond
[02/28/24 15:25:16]: No NCBI SBT file given, will use default, however if you plan to submit to NCBI, create one and pass it here '--sbt'
[02/28/24 15:25:16]: Checking GenBank file for annotation

OS/Install Information

-------------------------------------------------------
Checking dependencies for 1.8.15
-------------------------------------------------------
You are running Python v 3.8.16. Now checking python packages...
biopython: 1.83
goatools: 1.3.11
matplotlib: 3.4.3
natsort: 8.4.0
numpy: 1.24.4
pandas: 1.5.3
psutil: 5.9.8
requests: 2.31.0
scikit-learn: 1.3.2
scipy: 1.10.1
seaborn: 0.13.2
All 11 python packages installed

You are running Perl v b'5.032001'. Now checking perl modules...
Carp: 1.50
Clone: 0.46
DBD::SQLite: 1.72
DBD::mysql: 4.046
DBI: 1.643                                                                                                                                                                               [85/1962]
DB_File: 1.858
Data::Dumper: 2.183
File::Basename: 2.85
File::Which: 1.24
Getopt::Long: 2.54
Hash::Merge: 0.302
JSON: 4.10
LWP::UserAgent: 6.67
Logger::Simple: 2.0
POSIX: 1.94
Parallel::ForkManager: 2.02
Pod::Usage: 1.69
Scalar::Util::Numeric: 0.40
Storable: 3.15
Text::Soundex: 3.05
Thread::Queue: 3.14
Tie::File: 1.06
URI::Escape: 5.17
YAML: 1.30
local::lib: 2.000028
threads: 2.25
threads::shared: 1.61
All 27 Perl modules installed

Checking Environmental Variables...
$FUNANNOTATE_DB=/mnt/home/funannotate_new_db
$PASAHOME=/mnt/home/.conda/envs/funannotate_new/opt/pasa-2.5.3
$TRINITY_HOME=/mnt/home/conda/envs/funannotate_new/opt/trinity-2.8.5
$EVM_HOME=/mnt/home/.conda/envs/funannotate_new/opt/evidencemodeler-1.1.1
$AUGUSTUS_CONFIG_PATH=/mnt/home/.conda/envs/funannotate_new/config/
        ERROR: GENEMARK_PATH not set. export GENEMARK_PATH=/path/to/dir
-------------------------------------------------------
Checking external dependencies...
PASA: 2.5.3
CodingQuarry: 2.0
Trinity: 2.8.5
augustus: 3.5.0
bamtools: bamtools 2.5.1
bedtools: bedtools v2.31.1
blat: BLAT v37x1
diamond: 2.1.8
ete3: 3.1.3
exonerate: exonerate 2.4.0
fasta: 36.3.8g
glimmerhmm: 3.0.4
gmap: 2024-02-22
gmes_petap.pl: 4.71_lic                                                                                                                                                                  [37/1962]
hisat2: 2.2.1
hmmscan: HMMER 3.4 (Aug 2023)
hmmsearch: HMMER 3.4 (Aug 2023)
java: 17.0.3-internal
kallisto: 0.46.1
mafft: v7.520 (2023/Mar/22)
makeblastdb: makeblastdb 2.14.1+
minimap2: 2.26-r1175
pigz: 2.8
proteinortho: 6.3.1
pslCDnaFilter: no way to determine
salmon: salmon 0.14.1
samtools: samtools 1.18
snap: 2006-07-28
stringtie: 2.2.1
tRNAscan-SE: 2.0.12 (Nov 2022)
tantan: tantan 49
tbl2asn: 25.8
tblastn: tblastn 2.14.1+
trimal: trimAl v1.4.rev15 build[2013-12-17]
trimmomatic: 0.39
        ERROR: emapper.py not installed
        ERROR: signalp not installed
ewmorr commented 4 months ago

Thanks for any pointers!

nextgenusfs commented 4 months ago

Can you try to downgrade biopython and see if error is the same?

mamba install -n funannotate "biopython==1.79"
ewmorr commented 4 months ago

I'll give that a try and report back.

ewmorr commented 4 months ago

That solved it. Thanks for the quick response!

nextgenusfs commented 4 months ago

@peterjc What has changed in biopython > 1.80(?) that nofuzzy_start and nofuzzy_end is not longer supported. I suppose I can check for the attribute exists and if not then just use f.location.start and f.location.end. Maybe I'll just pin the recipe to biopython <1.80 to avoid this and other changes....

def gb_feature_add2dict(f, record, genes):
    # abbreviated function here
    if f.type and f.type in [
        "gene",
        "mRNA",
        "CDS",
        "tRNA",
        "rRNA",
        "ncRNA",
        "exon",
        "misc_RNA",
    ]:
    # standard information from every feature
    strand = f.location.strand
    if strand == 1:
        strand = "+"
    elif strand == -1:
        strand = "-"
    start = f.location.nofuzzy_start + 1
    end = f.location.nofuzzy_end
    chr = record.id
    num_parts = len(f.location.parts)
peterjc commented 4 months ago

Quoting https://github.com/biopython/biopython/blob/master/DEPRECATED.rst

There were multiple deprecations in Release 1.80, listed below. The deprecated code was removed in Release 1.82. ...

  • Location attributes location.nofuzzy_start and location.nofuzzy_end - use the location directly or if required int(location.start) and int(location.end). This will fail for the UnknownPosition where the nofuzzy aliases returned None.