Giter Site home page Giter Site logo

Comments (15)

fpusan avatar fpusan commented on August 23, 2024

Could you share the input bins with me here in a zip file?

from superpang.

cifuj avatar cifuj commented on August 23, 2024

I'm sorry, but I can't share them. Is there any other information I can provide?
I tried running it with another set of bins (5 bins medium- to high-quality >95% ANI) and I have the same error.

from superpang.

fpusan avatar fpusan commented on August 23, 2024

Hm, I wonder what the problem may be. Does test-SuperPang.py work for you?
Are these "standard" bacterial/archaeal genomes? something "strange" about them?
I have an idea of a couple of things that might be throwing that error, but it's hard to know what's really happening without being able to reproduce it myself (of course it is understandable if you can't share your data).

from superpang.

fpusan avatar fpusan commented on August 23, 2024

Let's test a thing
Edit the
/home/jcifuentes/miniconda3/envs/SuperPang/lib/python3.8/site-packages/SuperPang/lib/Assembler.py
In line 292 change
assert len(nvs_) == 2
for
if len(nvs_) != 2: print(nvs_); assert False
This will still die but will print some info about what's going wrong. You can share the output (a horrible bunch of numbers) with me.

EDIT: Fixed a typo in the code

from superpang.

cifuj avatar cifuj commented on August 23, 2024

I only obtained this output after the "Extracting forward component"
[0, 1, 2, 3]

I changed the order of the bins and SuperPang run until comp 246/718 and then it fails also after:
Extracting forward component
[0, 1, 2, 3]
Traceback (most recent call last):
File "/home/jcifuentes/miniconda3/envs/SuperPang/bin/SuperPang.py", line 291, in
main(parse_args())
File "/home/jcifuentes/miniconda3/envs/SuperPang/bin/SuperPang.py", line 144, in main
contigs = Assembler(input_minimap2, args.ksize, args.threads).run(args.minlen, args.mincov, args.bubble_identity_threshold, args.genome_assignment_threshold, args.threads)
File "/home/jcifuentes/miniconda3/envs/SuperPang/lib/python3.8/site-packages/SuperPang/lib/Assembler.py", line 322, in run
psets = get_psets(comp2nvs[nc1] | comp2nvs[nc2])
File "/home/jcifuentes/miniconda3/envs/SuperPang/lib/python3.8/site-packages/SuperPang/lib/Assembler.py", line 292, in get_psets
if len(nvs_) != 2: print(nvs_); assert False
AssertionError

This is how it look lines 291-293

 for nvs_ in psets.values():
    if len(nvs_) != 2: print(nvs_); assert False
 return psets

from superpang.

fpusan avatar fpusan commented on August 23, 2024

Thanks for trying this. It seems like a different case of a bug I'd fixed before, but I would need more info
Can you now try changing the whole get_psets function to this one?

            ### Extract forward component
            def get_psets(nvs):
                """Get a dict with a frozenset of vertices as keys, and the two complementary non-branching paths sharing those vertices as values"""
                psets = defaultdict(list)
                for nv in nvs:
                    pset = frozenset(vertex2NBP[nv])
                    psets[pset].append(nv)
                for fs, nvs_ in psets.items():
                    if len(nvs_) != 2:
                        print('\nERROR!', len(nvs_), fs)
                        print()
                        for nv_ in nvs_:
                            print(nv_, vertex2NBP[nv_])
                        print('\nDONE\n')
                    assert len(nvs_) == 2
                return psets

from superpang.

cifuj avatar cifuj commented on August 23, 2024

This is the output after modifiying Assembler.py
SuperPang_error_cifuj_20220407.txt

from superpang.

fpusan avatar fpusan commented on August 23, 2024

Thanks! This gives me something to work with... I'll come back to you if I need some extra stuff

from superpang.

fpusan avatar fpusan commented on August 23, 2024

Ok, try replacing the function with this

            ### Extract forward component
            def get_psets(nvs):
                """Get a dict with a frozenset of vertices as keys, and the two complementary non-branching paths sharing those vertices as values"""
                psets = defaultdict(list)
                for nv in nvs:
                    pset = frozenset(vertex2NBP[nv])
                    psets[pset].append(nv)
                for ps, nvs_ in psets.items():
                    if len(nvs_) > 2: # If more than two NBPs share the same pset, select the first two that are RC of each other
                        for nv1, nv2 in combinations(nvs_): # this is a temporary patch, I should look into why this happens when I get a proper example
                            NBP1, NBP2 = vertex2NBP[nv1], vertex2NBP[nv2]
                            if NBP1 == NBP2[::-1]:
                                psets[ps] = [nv1, nv2]
                                break
                        else:
                            assert False # if there is no RC pair, die anyways
                for nvs_ in psets.values():         
                    assert len(nvs_) == 2
                return psets

Hopefully this'll work

from superpang.

cifuj avatar cifuj commented on August 23, 2024

I obtained the following error.

Traceback (most recent call last):
File "/home/jcifuentes/miniconda3/envs/SuperPang/bin/SuperPang.py", line 291, in
main(parse_args())
File "/home/jcifuentes/miniconda3/envs/SuperPang/bin/SuperPang.py", line 144, in main
contigs = Assembler(input_minimap2, args.ksize, args.threads).run(args.minlen, args.mincov, args.bubble_identity_threshold, args.genome_assignment_threshold, args.threads)
File "/home/jcifuentes/miniconda3/envs/SuperPang/lib/python3.8/site-packages/SuperPang/lib/Assembler.py", line 331, in run
psets = get_psets(comp2nvs[nc1] | comp2nvs[nc2])
File "/home/jcifuentes/miniconda3/envs/SuperPang/lib/python3.8/site-packages/SuperPang/lib/Assembler.py", line 293, in get_psets
for nv1, nv2 in combinations(nvs_): # this is a temporary patch, I should look into why this happens when I get a proper example
TypeError: combinations() missing required argument 'r' (pos 2)

I tried with 2 different set of bins from 2 different species and I obtained the same error after a different number of "Working on comp XX/YY"

from superpang.

fpusan avatar fpusan commented on August 23, 2024

My fault, was missing an argument

            ### Extract forward component
            def get_psets(nvs):
                """Get a dict with a frozenset of vertices as keys, and the two complementary non-branching paths sharing those vertices as values"""
                psets = defaultdict(list)
                for nv in nvs:
                    pset = frozenset(vertex2NBP[nv])
                    psets[pset].append(nv)
                for ps, nvs_ in psets.items():
                    if len(nvs_) > 2: # If more than two NBPs share the same pset, select the first two that are RC of each other
                        for nv1, nv2 in combinations(nvs_, 2): # this is a temporary patch, I should look into why this happens when I get a proper example
                            NBP1, NBP2 = vertex2NBP[nv1], vertex2NBP[nv2]
                            if NBP1 == NBP2[::-1]:
                                psets[ps] = [nv1, nv2]
                                break
                        else:
                            assert False # if there is no RC pair, die anyways
                for nvs_ in psets.values():         
                    assert len(nvs_) == 2
                return psets

from superpang.

cifuj avatar cifuj commented on August 23, 2024

Now I have a different error in the function #Find reverse complement Non-Branching Paths

Traceback (most recent call last):
File "/home/jcifuentes/miniconda3/envs/SuperPang/bin/SuperPang.py", line 291, in
main(parse_args())
File "/home/jcifuentes/miniconda3/envs/SuperPang/bin/SuperPang.py", line 144, in main
contigs = Assembler(input_minimap2, args.ksize, args.threads).run(args.minlen, args.mincov, args.bubble_identity_threshold, args.genome_assignment_threshold, args.threads)
File "/home/jcifuentes/miniconda3/envs/SuperPang/lib/python3.8/site-packages/SuperPang/lib/Assembler.py", line 332, in run
assert len(psets) == len(comp2nvs[nc1]) == len(comp2nvs[nc1]) # each sequence path should have a reverse complement equivalent (same vertices in the kmer graph, reverse order)
AssertionError

from superpang.

fpusan avatar fpusan commented on August 23, 2024

Hi again!
I managed to reproduce the issue with data from another user. Version 0.9.4beta1 (available in conda) has a temptative fix for this problem. Let me know if it works for you!

from superpang.

cifuj avatar cifuj commented on August 23, 2024

Thank you very much!
It works with the 2 datasets I had problems before.

from superpang.

fpusan avatar fpusan commented on August 23, 2024

Glad to hear. Thanks for testing it!

from superpang.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.