zaidissa / MetaRon

Metagenomic opeRon Prediction pipeline. MetaRon presents the first pipeline for the prediction of metagenomic operons without any functional or experimental data.
Other
7 stars 2 forks source link

contaminating python2 code in python3 build? #3

Open acvill opened 3 years ago

acvill commented 3 years ago

Congratulations on your recent publication in BMC Genomics. I would like to use MetaRon, but there appears to be conflicting information between the MetaRon paper and this repository. The paper states that MetaRon requires Python 3, but the installation prerequisites in this repository state Python 2.7 is needed. Further, your most recent commit is named "python3", so I went ahead with a Python 3 installation.

After resolving an indentation issue...

$ source /programs/miniconda3/bin/activate metaron-2.0
$ metaron --help
  File "/programs/miniconda3/envs/metaron-2.0/bin/metaron", line 234
    gene_name_scaf, strand, gene_st, gene_end, file_name, scaftig_name, gene_name, scaf_name4dict = data_extraction(gene_file, gene_pred_tool)
    ^
IndentationError: unexpected indent

... the --help option now works.

$ source /programs/miniconda3/bin/activate metaron-2.0
$ metaron --help
usage: metaron [-h] [-n SAMPLE] [-p PROCESS] [-rt READ_TYPE] [-rl READ_LENGTH]
               [-pe1 PAIRED_1] [-pe2 PAIRED_2] [-pm PAIRED_MERGED] [-i IGP]
               [-j ISC] [-t TOOL] [-o OUTPUT]

optional arguments:
  -h, --help            show this help message and exit
  -n SAMPLE, --sample SAMPLE
                        Sample name without any dot, underscore or dash
  -p PROCESS, --process PROCESS
                        1. ago: assembly gene prediction and operon prediciton
                        2. op: operon prediction only. If 'ago', please
                        provide the following parameters:
                        -n,-rl,-rt,[-pe1,pe2|-pm],
  -rt READ_TYPE, --read_type READ_TYPE
                        Enter read type. 'merge' if the reads are paired-end
                        in two file. 'paired' if the reads are paired-end in
                        one file.
  -rl READ_LENGTH, --read_length READ_LENGTH
                        Enter 'l'if read length is longer than 128 bases and
                        'r' if read length is shorter than 128 bases
  -pe1 PAIRED_1, --paired_1 PAIRED_1
                        Enter enter paired read file 1
  -pe2 PAIRED_2, --paired_2 PAIRED_2
                        Enter enter paired read file 2
  -pm PAIRED_MERGED, --paired_merged PAIRED_MERGED
                        Enter the paired end read file if both pairedend reads
                        are in one file
  -i IGP, --igp IGP     Select the gene prediction .tab file generated via
                        MetageneMark or Prodigal
  -j ISC, --isc ISC     Select the file containing all scaftigs
  -t TOOL, --tool TOOL  Enter 1 for MetaGeneMark, 2 for Prodigal
  -o OUTPUT, --output OUTPUT
                        Enter output destination folder

But running both the example data and my own data through the op process lead to additional errors.

Error 1

$ metaron --sample ERR022075 --process op --igp /home/metaron/data/ERR022075 --isc /home/metaron/data/ERR022075_scaffold.fa --tool 2 --output ./out/
All parameters checked
Sample name:     ERR022075
OUTPUT DIRECTORY:     ./out/MetaRon_ERR022075
config_file_check start
/programs/miniconda3/envs/metaron-2.0/bin
config_file_check completed
********************************** METAGENOMIC OPERON PREDICTION **********************************
Formatting assembly file
Traceback (most recent call last):
  File "/programs/miniconda3/envs/metaron-2.0/bin/metaron", line 1659, in <module>
    main()
  File "/programs/miniconda3/envs/metaron-2.0/bin/metaron", line 233, in main
    gff2tab(sample_name)
  File "/programs/miniconda3/envs/metaron-2.0/bin/metaron", line 444, in gff2tab
    writer.writerows(zoo)
TypeError: a bytes-like object is required, not 'str'

It seems like this error with writer.writerows() is documented in StackOverflow: TypeError: a bytes-like object is required, not 'str' in python and CSV

Note that my config.txt file reads:

NNPP2.2_path=/home/metaron/NNPP2.2/bin/fa2TDNNpred-PRO.linux

which points to my local installation of NNPP2.2. I've confirmed that the standalone NNPP2.2 program works fine.

In the absence of a config file, I see a second error that also looks to be caused by python3 trying to compile python2 code:

Error 2

Traceback (most recent call last):
  File "/programs/miniconda3/envs/metaron-2.0/bin/metaron", line 1659, in <module>
    main()
  File "/programs/miniconda3/envs/metaron-2.0/bin/metaron", line 180, in main
    config_file_check()
  File "/programs/miniconda3/envs/metaron-2.0/bin/metaron", line 1615, in config_file_check
    NNPP2_path = raw_input('Enter path for NNPP2.2 directory test2')
NameError: name 'raw_input' is not defined

Again, StackOverflow: How do I use raw_input in Python 3

So, should metaron-2.0 be compiled and run in a python2 environment, despite the documentation in the paper and elsewhere that metaron is written in python3?

acvill commented 3 years ago

Just wanted to write and say that my colleague was able to replicate these errors, so I have more confidence that what I'm seeing is not a problem with my environment / installation.

Ql-cy commented 2 years ago

I have met the same errors. The raw_input and xrange in python script metaron are not difined when I tested the example data. Have you solved these problems? I will be much appreciated if you can give me some suggestions.

acvill commented 2 years ago

I have met the same errors. The raw_input and xrange in python script metaron are not difined when I tested the example data. Have you solved these problems? I will be much appreciated if you can give me some suggestions.

Sorry, QI-cy, I have not solved these problems, and I am still unable to implement MetaRon. If you're looking for alternatives, I can suggest POEM, though its outputs are annoying to parse.

Ql-cy commented 2 years ago

    Thank you so much for you suggestion. POEM looks great to me and I will try it.      Best wishes,     Lu Qian     ------------------ Original ------------------ From:  "Albert @.>; Date:  Tue, Sep 28, 2021 11:25 PM To: @.>; Cc: @.>; @.>; Subject:  Re: [zaidissa/MetaRon] contaminating python2 code in python3 build? (#3)

 

I have met the same errors. The raw_input and xrange in python script metaron are not difined when I tested the example data. Have you solved these problems? I will be much appreciated if you can give me some suggestions.

Sorry, QI-cy, I have not solved these problems, and I am still unable to implement MetaRon. If you're looking for alternatives, I can suggest POEM, though its outputs are annoying to parse.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

TRANSLATE with x English ArabicHebrewPolish BulgarianHindiPortuguese CatalanHmong DawRomanian Chinese SimplifiedHungarianRussian Chinese TraditionalIndonesianSlovak CzechItalianSlovenian DanishJapaneseSpanish DutchKlingonSwedish EnglishKoreanThai EstonianLatvianTurkish FinnishLithuanianUkrainian FrenchMalayUrdu GermanMalteseVietnamese GreekNorwegianWelsh Haitian CreolePersian

TRANSLATE with  x
English    ArabicHebrewPolish 

BulgarianHindiPortuguese CatalanHmong DawRomanian Chinese SimplifiedHungarianRussian Chinese TraditionalIndonesianSlovak CzechItalianSlovenian DanishJapaneseSpanish DutchKlingonSwedish EnglishKoreanThai EstonianLatvianTurkish FinnishLithuanianUkrainian FrenchMalayUrdu GermanMalteseVietnamese GreekNorwegianWelsh Haitian CreolePersian

lucaswaldburger commented 2 years ago

any update on this?

acvill commented 2 years ago

any update on this?

Nothing from me. If I ever get MetaRon to work, I'll be sure to post my solution here.

alexweisberg commented 1 year ago

I would love to use this too but ran into the same problems.

if you modify the main metaron script to make the following changes:

You will also have to remove any "region" lines from your gff file as it doesn't handle those well.

Then it will run on python3.

However there are weird issues with parsing gff files so it still doesn't run completely...