Python error at first run [SOLVED]

View previous topic View next topic Go down

Python error at first run [SOLVED]

Post by Clément Goubert on Tue Jan 05, 2016 11:35 am

Here is a summary of an e-mail exchange concerning some Python error occurring during a first attempt to run dnaPipeTE:

Recently, I want to estimate silkworm repeated DNA and TEs using dnaPipeTE software. However, when I run the dnaPipeTE, we found following error,

hanminjin@micro:~/hmj/dnapipeTE/dnaPipeTE$ python3 ./dnaPipeTE.py -input /home/guest/hanminjin/BmSRA/AK_all.fastq -output /home/guest/hanminjin/BmSRA/out_dnapipeTE/AK -cpu 3 -sample_size 500000 -sample_number 2
_ _____ _ _______ ______
| | | __ (_) |__ __| ____|
__| |_ __ __ _| |__) | _ __ ___| | | |__ __|______________
/ _` | '_ \ / _` | ___/ | '_ \ / _ \ | | __| (__|______|_|_|_|_)
| (_| | | | | (_| | | | | |_) | __/ | | |____ |
\__,_|_| |_|\__,_|_| |_| .__/ \___|_| |______|
| |
|_|
De Novo Anssembly and Annotation PIPEline for Transposable Elements
v.b0.31_2015022 4

Let's go !!!

Traceback (most recent call last):
File "./dnaPipeTE.py", line 66, in <module>
parser.add_argument('-sample_size', action='store', default=config['DEFAULT']['Sample_size'], dest='sample_size', help='number of reads to sample')
TypeError: 'ConfigParser' object is not subscriptable

I think I have correctly installed Python3, Trinity, RepeatMasker, blastn, R and GUN Parallel as well as corresponding packages and modules. I do not know the cause of the error. Can you give me some advice or help to solve this problem.



This kind of error could arrive even if you installed dnaPipeTE properly, for example it could came from a bad syntax of the command line or an error in the files path. It looks like a misinterpretation of the command line. Check if your path /home/guest/hanminjin/BmSRA/AK_all.fastq is correct.
Then, if it is OK but still doesn't work, try this:
1- remove the outfolder if it has been created
2- run the same command but without the -sample_size and -sample_number options; normally, it should take the values in the input.ini file.

If there is still the same error, check if ConfigParser is well installed in python, but it is normally built-in...
Alternatively send me your config.ini that I have a look !



when I fixed the default value of -sample_size and -sample_number in the dnaPipeTE.py file, Previous error no longer occurs.
Revised as flowing:
line66: parser.add_argument('-sample_size', action='store', default="500000", dest='sample_size', help='number of reads to sample')
line67: parser.add_argument('-sample_number', action='store', default="2", dest='sample_number', help='number of sample to run')

However, a new problem has arisen. as follows:

python3 ./dnaPipeTE.py -input /home/guest/hanminjin/BmSRA/AK_all.fastq -output /home/guest/hanminjin/BmSRA/out_dnapipeTE/AK -cpu 3 -sample_size 500000 -sample_number 2
_ _____ _ _______ ______
| | | __ (_) |__ __| ____|
__| |_ __ __ _| |__) | _ __ ___| | | |__ __|______________
/ _` | '_ \ / _` | ___/ | '_ \ / _ \ | | __| (__|______|_|_|_|_)
| (_| | | | | (_| | | | | |_) | __/ | | |____ |
\__,_|_| |_|\__,_|_| |_| .__/ \___|_| |______|
| |
|_|
De Novo Anssembly and Annotation PIPEline for Transposable Elements
v.b0.31_2015022 4

Let's go !!!

Start time: Mon Aug 31 23:13:37 2015
number of reads to sample : 500000
fastq : /home/guest/hanminjin/BmSRA/AK_all.fastq
total number of reads : 77116948
sampling 2 samples of 500000 reads...
s_AK_all.fastq done.
s_AK_all.fastq done.
Traceback (most recent call last):
File "./dnaPipeTE.py", line 467, in <module>
Trinity(config['DEFAULT']['Trinity'], config['DEFAULT']['Trinity_memory'], args.cpu, args.output_folder, sample_files, args.sample_number)
TypeError: 'ConfigParser' object is not subscriptable

In addition, we have checked the ConfigParser, it is well installed in python.

hanminjin@micro:~/hmj/dnapipeTE/dnaPipeTE$ python3
Python 3.1.1 (r311:74480, Aug 29 2015, 20:48:10)
[GCC 4.8.4] on linux3
Type "help", "copyright", "credits" or "license" for more information.
>>> import configparser
>>>

Please find attached my config.ini file.

I'm not familiar with python, I feel this problem may be caused by the function of config.


I found two things that could lead to problem in the config.ini:

1 - the trinity path should refer to the trinity executable (you just pointed to the trinity folder). I think this is the reason why python is not happy with Trinity!

2 - Your path to RepeatMasker Library should point to a fasta file, sometimes called "specieslib" (without .fasta, but it is a fasta!), it is usually found in /home/name/RepeatMasker-version/Libraries/20XXXXXX/root/specieslib
If you can't find it, I can provide you mine. Just tell me!

If that doesn't help, I'll talk tomorrow to my colleague that did most of the python implementation and that is more familiar than me with python errors!


My RepeatMasker libraries were download from GIRI (http://www.girinst.org/server/RepBase/index.php), Version:repeatmaskerlibraries-20150807.tar.gz. But, I can't find any " .fasta" file in the libraries. Can you send me your RepeatMasker Library.

I found a phenomenon in the running dnapipeTE.
Line 30 of dnapipeTE.py file: config = configparser.ConfigParser().
I found that the progarm just call the config function, an error (TypeError: 'ConfigParser' object is not subscriptable) occurs .
So I think this problem could be caused by this function(config).


Here is a link to the specieslib file ftp://pbil.univ-lyon1.fr/pub/divers/goubert/specieslib
Actually I found that the new version of repeat masker does not include it as it, so I will now furnish it with dnaPipeTE.

Did you have that error after fixing the Trinity path to the executable ? If yes, could you send me the whole log ?
Usually the errors I had from configparser weren't related to python but more with something that goes wrong with the pipeline, like a bad path to file or program. I could figure out more with the whole log.


Previous problems have been solved. It was caused by the bug of python3.1.1 version.It have been replaced by python3.2.1.
avatar
Clément Goubert
Admin

Posts : 30
Join date : 2016-01-05
Age : 29

View user profile https://lbbe.univ-lyon1.fr/-dnaPipeTE-.html

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum