rsemeraro / PyPore

A python tool box for fast and accurate quality control, conversion and alignment of nanopore sequencing data
GNU General Public License v3.0
20 stars 5 forks source link

Error in pypor alignment #2

Open JMiguelRamirez opened 5 years ago

JMiguelRamirez commented 5 years ago

Hi,

I was trying to us pypor alignment but it gave me this error:

File "~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alignment.py", line 26, in MainReader th = args.threads AttributeError: 'Namespace' object has no attribute 'threads'

Maybe instead of args.threads, it should be used threads_number

What do you think?

Thank you,

rsemeraro commented 5 years ago

Hi, yes! You're right! I just fixed it. Thank you!

JMiguelRamirez commented 5 years ago

Perfect, thank you,

Now, I am trying to run it and I get errors with all three mappers.

If I try: pypore alignment -i my_fastq -r my_ref -l sample_label -a b -s yes I get: [PyPore][INFO] - [Alignment] - Start alignment with bwa... [PyPore][INFO] - Error estimation... [E::bwa_idx_load_from_disk] fail to locate the index files Traceback (most recent call last): File "\~/.local/bin/pypore", line 11, in load_entry_point('PyPore==0.1', 'console_scripts', 'pypore')() File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/pypore.py", line 61, in main run_subtool(mod, ags, parser) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/pypore.py", line 16, in run_subtool sq.run(ags) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alignment.py", line 106, in run MainReader(args) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alignment.py", line 32, in MainReader sq.run(ags) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 824, in run als_parser(als) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 791, in als_parser tooldict[a]() File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 725, in bwaal PairDict = sam_parser(bwaline, bwa_ext_dir) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 596, in sam_parser zip([sorted(OutDict[ev].keys())[0]] + list(diff(sorted(OutDict[ev].keys()))), [ IndexError: list index out of range

If I try: pypore alignment -i my_fastq -r my_ref -l sample_label -a m -s yes

[PyPore][INFO] - [Alignment] - Start alignment with minimap2... Traceback (most recent call last): File "\~/.local/bin/pypore", line 11, in load_entry_point('PyPore==0.1', 'console_scripts', 'pypore')() File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/pypore.py", line 61, in main run_subtool(mod, ags, parser) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/pypore.py", line 16, in run_subtool sq.run(ags) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alignment.py", line 106, in run MainReader(args) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alignment.py", line 32, in MainReader sq.run(ags) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 824, in run als_parser(als) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 791, in als_parser tooldict[a]() File "\~/joramirez/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 688, in minimap2al str(mmi_ref), str(fast_Q_file)], stdout=subprocess.PIPE) File "/usr/lib64/python2.7/subprocess.py", line 711, in init errread, errwrite) File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

And if I try: pypore alignment -i my_fastq -r my_ref -l sample_label -a m -s yes I get:

[PyPore][INFO] - [Alignment] - Start alignment with ngmlr... Traceback (most recent call last): File "\~/.local/bin/pypore", line 11, in load_entry_point('PyPore==0.1', 'console_scripts', 'pypore')() File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/pypore.py", line 61, in main run_subtool(mod, ags, parser) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/pypore.py", line 16, in run_subtool sq.run(ags) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alignment.py", line 106, in run MainReader(args) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alignment.py", line 32, in MainReader sq.run(ags) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 824, in run als_parser(als) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 791, in als_parser tooldict[a]() File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 756, in ngmlral stdout=subprocess.PIPE) File "/usr/lib64/python2.7/subprocess.py", line 711, in init errread, errwrite) File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

Do you have any idea of what is happening? Am I using it wrong or do I miss some package?

Thank you very much and sorry for the inconvenience

rsemeraro commented 5 years ago

Hi, no problem! I have two ideas. First: in your report i read "[E::bwa_idx_load_from_disk] fail to locate the index files" so, i think that the fastq file index is missing, you can create it with bwa index function. Second: OSError: [Errno 2] No such file or directory. This error suggests me that minimap2 is missing? Have you minimap2 installed on your machine? Can you invoke it with minimap2 command? The same for ngmlr. If their missing, install them and try again. Alternatively if you prefer to work with bwa (is very slow on nanopore data), create the index and rerun pypore.

If something goes wrong don't esitate to write me!

JMiguelRamirez commented 5 years ago

Thank you for your help, I double checked the installation of minimap2 and ngmlr, and they are installed. Regarding bwa, I forgot to create the index, sorry for that, now, if I try to run: pypore alignment -i my_fastq -r my_ref -l sample_label -a b -s yes. I get this error:

[PyPore][INFO] - [Alignment] - Start alignment with bwa... [PyPore][INFO] - Error estimation... [M::bwa_idx_load_from_disk] read 0 ALT contigs [M::process] read 51436 sequences (10000041 bp)... [M::process] read 26027 sequences (5010532 bp)... [M::mem_process_seqs] Processed 51436 reads in 14.580 CPU sec, 14.608 real sec [M::mem_process_seqs] Processed 26027 reads in 7.159 CPU sec, 14.281 real sec [main] Version: 0.7.12-r1039 [main] CMD: bwa mem -x ont2d -t 1 my_ref my_fastq [main] Real time: 37.654 sec; CPU: 21.948 sec Traceback (most recent call last): File "\~/.local/bin/pypore", line 11, in load_entry_point('PyPore==0.1', 'console_scripts', 'pypore')() File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/pypore.py", line 61, in main run_subtool(mod, ags, parser) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/pypore.py", line 16, in run_subtool sq.run(ags) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alignment.py", line 106, in run MainReader(args) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alignment.py", line 32, in MainReader sq.run(ags) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 824, in run als_parser(als) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 791, in als_parser tooldict[a]() File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 725, in bwaal PairDict = sam_parser(bwaline, bwa_ext_dir) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 633, in sam_parser plot_stats(OutDict, sorted_unmapfraqseq, mapped_frac_size, chr_cov_dict, out_dir) File "\~/.local/lib/python2.7/site-packages/PyPore-0.1-py2.7.egg/lib/alg_routines_unix.py", line 394, in plot_stats if 'chr' not in c_c_dict.keys()[0]: IndexError: list index out of range

It creates a bam file inside PyPore_results, but it is half of the bam file that I get if I run bwa on its own. I am running it in a cluster, and I am getting the same errors for minimap2 and ngmlr after double checking installation.

Thank you,

rsemeraro commented 5 years ago

Hi, sorry for the delay but i was not in lab for holidays. I have few questions: What's the mean length of your reads? Which reference are you using? Could you re run pypore with the -v flag set to 3?