0

I'd like to use ScaleHD to analyse some Illumina amplicon sequencing of a trinucleotide repeat region.

https://scalehd.readthedocs.io/en/latest/index.html

https://pypi.org/project/ScaleHD/

I’m using a conda environment in MacOS and installed ScaleHD using pip install scalehd. I think I’ve installed all the dependencies suggested by the developer. But when I try to run it I get a syntax error.

$ ScaleHD -v -c ~/analysis/ScaleHD/config_mf.xml -j "hello_documentation" -o ~/analysis/ScaleHD/output
Traceback (most recent call last):
  File "/Users/michaelflower/opt/anaconda3/envs/bioinfo/bin/ScaleHD", line 5, in <module>
from ScaleHD.sherpa import main
  File "/Users/michaelflower/opt/anaconda3/envs/bioinfo/lib/python3.6/site-packages/ScaleHD/sherpa.py", line 115
except Exception, e:
                ^
SyntaxError: invalid syntax
(bioinfo) 

I’ve read around a bit and seen it could be a problem with how the ScaleHD.sherpa file has written the ‘except’ – What's wrong with my except?. But I'm not sure what can be done about it?

I’ve provided sample R1 and R2 fastq file, the config file and reference files I’m using here: https://1drv.ms/u/s!AvBi5ipmBYfrhbRIKPYjfyk5th5uAQ?e=PYdrbG

Here’s how I’ve set up the directory:

$ tree analysis/ScaleHD/
analysis/ScaleHD/
|-- config.xml
|-- config_mf.xml
|-- data_dir
|   |-- ciosi41CAG_S4_L001_R1_001.fastq
|   `-- ciosi41CAG_S4_L001_R2_001.fastq
|-- output
`-- ref
    |-- 4k-HD-INTER.fa
    `-- 4k-HD-Reverse.fasta

I'd be very grateful for any help getting this up and running. Thanks!

Mike
  • 921
  • 7
  • 26
  • 2
    You need a version which is compatible with python 3. – quamrana Aug 01 '21 at 07:57
  • 1
    Or, conversely, use Python 2 to run it. According to the doco, version 1.0 should be tested with Python 3.7; did you install an older version? – tripleee Aug 01 '21 at 08:01
  • What does the code look like after the except statement? If it uses 'e' then the line should probably read 'except Exception as e:'. If 'e' isn't used then 'except Exception:' will suffice –  Aug 01 '21 at 08:07
  • 1
    @AndyKnight It is inadvisable to suggest to a novice that migrating a third-party library module from Python 2 to Python 3 is a simple matter. If the code has one leftover from Python ≤2.4, it very likely has many others, some of them trickier to fix for someone unfamiliar with the code. – BoarGules Aug 01 '21 at 08:41
  • @AndyKnight, here is the full text in the ScaleHD file: '#!/Users/michaelflower/opt/anaconda3/envs/bioinfo/bin/python3.6 # -*- coding: utf-8 -*- import re import sys from ScaleHD.sherpa import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(main()) ' – Mike Aug 01 '21 at 10:46
  • Thank you everyone. I'll try and find out which version my 'pip' command installed. Unfortunately I can't even run a version check command as I get the same syntax error as above. @tripleee, could I please ask how to run it in python2? I've tried putting python2 ahead of the full ScaleHD ... command above, but get '$ python2 scalehd /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'scalehd': [Errno 2] No such file or directory (bioinfo) '. – Mike Aug 01 '21 at 10:55
  • If you are on a Mac, `/usr/bin/python` should be Python 2.7. But you will probably have to `pip install` the package for this Python version separately (preferably in a new virtual environment). – tripleee Aug 01 '21 at 10:55
  • Thank you, I think I'm making progress. I built a new python2 conda environment, as suggested here: https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/. I'm now getting ScaleHD running, though still have to work out how to assign information in the way it needs. But at least the syntax problem is solved! – Mike Aug 01 '21 at 11:19
  • '$ ScaleHD -v -c ~/analysis/ScaleHD/config_mf.xml -j "hello_documentation" -o ~/analysis/ScaleHD/output shd__ ScaleHD: Automated DNA micro-satellite genotyping. shd__ alastair.maxwell@glasgow.ac.uk shd__ Creating Output with prefix: hello_documentation shd__ XML Config: Specified data directory could not be found. shd__ XML Config: Specified forward reference file could not be found. shd__ XML Config: Specified reverse reference file could not be found. shd__ XML Config: Failure, exiting. (py2) ' – Mike Aug 01 '21 at 11:19

0 Answers0