Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in last step! #3

Closed
BJCampbelllab opened this issue Mar 4, 2021 · 6 comments
Closed

Error in last step! #3

BJCampbelllab opened this issue Mar 4, 2021 · 6 comments

Comments

@BJCampbelllab
Copy link

Hi-
I am running about 8 high quality MAGs through CoPTR with about 20 metagenomes. I've gotten everything to work until the middle of the last step. The error is below. The command did generate a coverage-maps-genome folder within my maps folder, and there are PKL files there that look to encompass all possible contigs within each MAGs. I tried lowering the minimum reads and coverage. Any help would be greatly appreciated! Thanks, Barb

[INFO] (Mar 04, 2021 08:53:25) CoPTR: done grouping by reference genome
[INFO] (Mar 04, 2021 08:53:25) CoPTR: the --restart flag can be used to start from here
[INFO] (Mar 04, 2021 08:53:25) CoPTRRef: checking reference genomes
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/bcampbell/anaconda3/envs/coptr/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/home/bcampbell/anaconda3/envs/coptr/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/home/bcampbell/coptr/src/coptr_ref.py", line 813, in _parallel_helper
return (ref_genome, self.estimate_ptrs(coverage_maps))
File "/home/bcampbell/coptr/src/coptr_ref.py", line 763, in estimate_ptrs
read_positions, ref_genome_len, qc_result = rf.filter_reads(cm.read_positions, cm.length)
File "/home/bcampbell/coptr/src/coptr_ref.py", line 108, in filter_reads filtered_read_positions, filtered_genome_length = self.filter_reads_phase1(read_positions, genome_length, bin_size)
File "/home/bcampbell/coptr/src/coptr_ref.py", line 326, in filter_reads_phase1
binned_reads = self.bin_reads(read_positions, genome_length, bin_size)
File "/home/bcampbell/coptr/src/coptr_ref.py", line 445, in bin_reads
nbins = int(math.ceil(genome_length / bin_size))
ZeroDivisionError: float division by zero
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/bcampbell/coptr/coptr.py", line 449, in
ProgramOptions()
File "/home/bcampbell/coptr/coptr.py", line 65, in init
getattr(self, args.command)()
File "/home/bcampbell/coptr/coptr.py", line 287, in estimate
threads=args.threads, plot_folder=args.plot
File "/home/bcampbell/coptr/src/coptr_ref.py", line 935, in estimate_ptrs_coptr_ref
flat_results = pool.map(coptr_ref._parallel_helper, flat_coverage_maps)
File "/home/bcampbell/anaconda3/envs/coptr/lib/python3.7/multiprocessing/pool.py", line 268, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/home/bcampbell/anaconda3/envs/coptr/lib/python3.7/multiprocessing/pool.py", line 657, in get
raise self._value
ZeroDivisionError: float division by zero

@tyjo
Copy link
Owner

tyjo commented Mar 4, 2021

Hi Barb,

Thanks for reaching out! It looks like CoPTR is using the complete reference genome estimator instead of the contig estimator on your MAGs.

You can check if CoPTR is correctly identifying MAGs on the "extract" step with the --check-regex flag. On the example data:

python coptr.py extract example-data/bam example-data/coverage-maps --check-regex

This should output an id for each reference genome. If you see an id for each contig, something has gone wrong. Would you run the above, and let me know the result?

If CoPTR is outputting an id for each contig, then something has gone wrong in the indexing or mapping step. A few possibilities:

  1. Did you index your MAGs and perform read mapping with CoPTR's wrapper around bowtie2? CoPTR adds information to keep track of complete references vs assemblies.
  2. Is each MAG in its own fasta file?

Tyler

@BJCampbelllab
Copy link
Author

BJCampbelllab commented Mar 4, 2021 via email

@tyjo
Copy link
Owner

tyjo commented Mar 4, 2021

Thanks for the detailed report. It sounds like an interesting dataset.

The issue is this step:

python /home/bcampbell/coptr/coptr.py extract --ref-genomes-regex /home/bcampbell/Pelagibacterales/Pelagibacter_for_v7/original_fasta/CoPTR_analyses/CoPTRindex.genomes /home/bcampbell/Pelagibacterales/Pelagibacter_for_v7/original_fasta/CoPTR_analyses/BAM /home/bcampbell/Pelagibacterales/Pelagibacter_for_v7/original_fasta/CoPTR_analyses/

You should delete the old coverage map files, and run without the --ref-genomes-regex flag. It is used for bam files generated outside of CoPTR.

Let me know if you run into any other issues.

@BJCampbelllab
Copy link
Author

BJCampbelllab commented Mar 4, 2021 via email

@tyjo
Copy link
Owner

tyjo commented Mar 26, 2021

I'm going to close this issue for now. Please let me know if you are still running into trouble and we can revisit.

@tyjo tyjo closed this as completed Mar 26, 2021
@BJCampbelllab
Copy link
Author

BJCampbelllab commented Mar 26, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants