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

Problem with insertions #49

Closed
genevievebo opened this issue Sep 28, 2018 · 4 comments
Closed

Problem with insertions #49

genevievebo opened this issue Sep 28, 2018 · 4 comments

Comments

@genevievebo
Copy link

I'm trying to get a translation for an insertion. Using the default SNPFiltering, I do not see the insertion in the sequence. I think it's not added to the sequence (it's is present in the db) and/or is treated as a SequenceSNP. Everything works great for snp.

I tried creating my own filter to support the insertion as explained in #33, but I get this error :

File "/u/boucherg/.virtualenvs/pyGeno_git/pyGeno/pyGeno/SNP.py", line 64, in __getattribute__ return Raba.__getattribute__(self, k) File "build/bdist.linux-x86_64/egg/rabaDB/Raba.py", line 648, in __getattribute__ TypeError: attribute name must be string, not 'int'

I'm not sure what I'm doing wrong. Here is the code and the snspset entry.

chromosomeNumber uniqueId start end ref alleles quality caller
5 1 170837542 170837543 - TCTT 0 custom

from pyGeno.Genome import *
 from pyGeno.importation.SNPs import * 
 from pyGeno.SNPFiltering import SNPFilter

 class MyFilter(SNPFilter) :
   	def __init__(self) :
   		SNPFilter.__init__(self)
   	def filter(self, chromosome, snp_custom) :
   		from pyGeno.SNPFiltering import  SequenceInsert, SequenceSNP, SequenceDel
   		for s in snp_custom:
   			if s.alleles != '-' and s.ref != '-':
   				return SequenceSNP(s.alleles)
   			elif s.alleles == '-':
   				return SequenceDel(len(s.ref))
   			elif s.ref == '-':
   				return SequenceInsert(s.alleles)

   if 'snp_custom' in getSNPSetsList() : 
   	deleteSNPs('snp_custom')

   importSNPs("snps_tmp")
   genome = Genome(name = 'GRCh37.75', SNPs='snp_custom', SNPFilter = MyFilter())
   gene = genome.get(Gene, name='NPM1')[0]
   tr = gene.get(Transcript, name='NPM1-001')[0]
   tr.sequence

[package_infos]
description = SNPs for testing purposes
maintainer = The Maintainer
maintainer_contact = maintainer [at] email.ca
version = 1

[set_infos]
species = human
name = snp_custom
type = agnosticsnp
source = Where do these snps come from?

[snps]
filename = snps.txt

@genevievebo
Copy link
Author

genevievebo commented Sep 28, 2018

I found the problem in my code. Since I only have one snp, I can not iterate over it. The filtering function should be :

class MyFilter(SNPFilter) :
	def __init__(self) :
		SNPFilter.__init__(self)
	def filter(self, chromosome, snp_custom) :	
		from pyGeno.SNPFiltering import  SequenceInsert, SequenceSNP, SequenceDel
		snp_custom = [snp_custom]
		for s in snp_custom :
			s.alleles = str(s.alleles)
			if s.alleles != '-' and s.ref != '-':
				return SequenceSNP(s.alleles)
			elif s.alt == '-':
				return SequenceDel(lenght=len(s.ref), ref=s.ref, bases=s.alleles)
			elif s.ref == '-':
				return SequenceInsert(bases=s.alleles, ref=s.ref)

However, I'm still have a lot of trouble getting the sequence.

@tariqdaouda
Copy link
Owner

What kind of trouble?

@genevievebo
Copy link
Author

How do I retrieve the transcript sequence with the insertion?

@tariqdaouda
Copy link
Owner

As you did with:

genome = Genome(name = 'GRCh37.75', SNPs='snp_custom', SNPFilter = MyFilter())
tr = genome.get(Transcript, name='NPM1-001')[0]  #you can go for the transcript directly

tr.sequence


If the polymorphism passes the filter it should be present in the sequence.

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