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

Num Intervening does not always produce result #31

Open
monprin opened this issue May 25, 2016 · 3 comments
Open

Num Intervening does not always produce result #31

monprin opened this issue May 25, 2016 · 3 comments
Labels
Milestone

Comments

@monprin
Copy link
Contributor

monprin commented May 25, 2016

When calling the candidate_genes function with the include_num_intervening option, not all genes will necessarily get this attribute. For instance, when calling with a larger list (from the Sucrose term, in the ZmRoot network in the ZmWallace ontology), this gene:

    {'organism': 'Zea Mays', 'strand': '-', 'num_siblings': 3, 'ID': 'GRMZM2G143499', 'Name': 'GRMZM2G143499', 'biotype': 'protein_coding', 'intervening_rank': 1.0, 'build': '5b', 'parent_locus': '<None>10:145891859-145891859'}

Does not receive the the num_intervening attribute and thus can cause failure.

The relevant section of code can be found in RefGen.py lines 455-468.

@monprin monprin added the bug label May 25, 2016
@monprin
Copy link
Contributor Author

monprin commented May 25, 2016

More info about the offending gene:

    id: GRMZM2G143499
    chrom: 10
    start: 145891859
    end: 145895272
    snp: 10:145891859-145891859
    ldegree: 1
    gdegree: 70
    locality: 0.014285714285714285
    num_intervening: NAN
    rank_intervening: 1.0
    num_siblings: 3

@schae234
Copy link
Member

Not sure where this error is occurring, here is what I see:

In [34]: import camoco as co
In [35]: snp = co.Locus(10,145891859,145891859)
In [36]: Zm5bFGS = co.RefGen('Zm5bFGS')
In [37]: gene = Zm5bFGS['GRMZM2G143499']
In [38]: snp in gene
Out[38]: True

If that is true, then this:

            if include_num_intervening == True:                                 
                num_down = 0                                                    
                num_up = 0                                                      
                # Sort the genes by their distance from the locus               
                genes = sorted(genes,key=lambda x: x-locus)                     
                for gene in genes:                                              
                    if locus in gene:                                           
                        gene.update({'num_intervening':-1})                     
                    elif gene > locus:                                          
                        gene.update({'num_intervening':num_down})               
                        num_down += 1                                           
                    elif gene < locus:                                          
                        gene.update({'num_intervening':num_up})                 
                        num_up += 1 

should have num_intervening be -1.

@monprin
Copy link
Contributor Author

monprin commented May 25, 2016

Well I am about to embark on upgrading camoco to your version, so it might be old, I will do that and see if it is still a problem.

@schae234 schae234 added this to the v0.6.0 milestone Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants