Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

How do I create a new GWAS adaptor?

Daniel Zerbino edited this page May 11, 2018 · 3 revisions

In lib/postgap/GWAS.py add a new adaptor class at the second to last line, following the model below:

class my_GWAS_Adaptor_Class(GWAS_source):
	display_name = "My new source of GWAS"
	
	def run(self, diseases, iris):
		"""
			Returns all GWAS SNPs associated to a disease in GWAS_DB
			Args:
			* [ string ] (trait descriptions)
			* [ string ] (trait Ontology IRIs)
			Returntype: [ GWAS_Association ]
		"""
		# ... Connect to DB, filter, etc...
		return [ GWAS_Association(
			pvalue = XXX, # float
			pvalue_description = XXX, # String or None
			snp = SNP(rsID=XXX, chrom=XXX, pos=XXX), # (string, string, int)
			disease = Disease(name = XXX, efo = XXX), # (string, string)
			reported_trait = XXX, # String
			source = self.display_name,
			publication = XXX, # String (PMID\d+)
			study = XXX, # String or None
			sample_size = XXX, # int or "N/A"
			odds_ratio = XXX, String or None
			beta_coefficient = XXX, String or None
			beta_coefficient_unit = XXX, String or None
			beta_coefficient_direction = XXX, String or None
		) ] # This is a list, you can have as many as you want