FRED-2 / OptiType

Precision HLA typing from next-generation sequencing data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Config parser error, no section 'behavior'

briankarlberg opened this issue · comments

Hello world, I am getting an error relating to the config files:

root@a1576648c921:/usr/local/bin/OptiType# /usr/local/bin/OptiType/OptiTypePipeline.py -i /data/cellline_chr21.fastq -d -o /data/output -c /usr/local/bin/OptiType/config.ini
Traceback (most recent call last):
File "/usr/local/bin/OptiType/OptiTypePipeline.py", line 235, in
unpaired_weight = config.getfloat('behavior', 'unpaired_weight')
File "/usr/lib/python2.7/ConfigParser.py", line 362, in getfloat
return self._get(section, float, option)
File "/usr/lib/python2.7/ConfigParser.py", line 356, in _get
return conv(self.get(section, option))
File "/usr/lib/python2.7/ConfigParser.py", line 607, in get
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'behavior'

config.ini file:
[mapping]\nrazers3=/usr/local/bin/razers3 \nthreads=1 \n\n[ilp]\nsolver=cbc \nthreads=1 \n\n[behavior]\ndeletebam=true \nunpaired_weight=0 \nuse_discordant=false\n
config.ini (END)

Related lines of ConfigParser.py file:
588 class ConfigParser(RawConfigParser):
589
590 def get(self, section, option, raw=False, vars=None):
591 """Get an option value for a given section.
592
593 If vars' is provided, it must be a dictionary. The option is looked up 594 in vars' (if provided), section', and in defaults' in that order.
595
596 All % interpolations are expanded in the return values, unless the
597 optional argument `raw' is true. Values for interpolation keys are
598 looked up in the same manner as the option.
599
600 The section DEFAULT is special.
601 """
602 sectiondict = {}
603 try:
604 sectiondict = self._sections[section]
605 except KeyError:
606 if section != DEFAULTSECT:
607 raise NoSectionError(section)

I have the ConfigParser.py and config.ini files within the directory /usr/local/bin/OptiType/ and am attempting to call OptiType from within that directory per the solution in the closed
ConfigParser.NoSectionError: No section: 'LIBRARIES' issue however it is still returning the error.

Any input for diagnosing this issue is much appreciated.

Hi!

What is this from, did you enter the docker cointainer interactively and ran OptiType like that? And if so, are those \n's literally \n's, or newlines as they should be? Can you do
docker run -it --entrypoint /bin/bash fred2/optitype
and then
cat /usr/local/bin/OptiType/config.ini?

If they aren't real newlines, make a config.ini on the host with the exact same content but the newlines corrected, and supply it with -c. Or if you're doing things inside the container, you can fix those newlines there.

Yes, I'm running OptiType interactively from within the container; correcting the /n's solved the issue.

Solution:
I ran apt-get update then apt-get install vim from within the container.
I then used the vim editor to replace the /n's within the config file to carraige returns.

Edited config.ini file: (compare with orginal above)
[mapping]
razers3=/usr/local/bin/razers3
threads=1

[ilp]
solver=cbc
threads=1

[behavior]
deletebam=true
unpaired_weight=0
use_discordant=false
(END)

Thank you andras86; the prompt guidance is greatly appreciated.