<commit_before>from loaders.gene_loader import GeneLoader
from intermine.webservice import Service
from files import *
from mod import MOD


class SGD(MOD):
	species = "Saccharomyces cerevisiae"

	def __init__(self):
		self.service = Service("http://yeastmine.yeastgenome.org/yeastmine/service")

	@staticmethod
	def gene_href(gene_id):
		return "http://www.yeastgenome.org/locus/" + gene_id + "/overview"

	@staticmethod
	def get_organism_names():
		return ["Saccharomyces cerevisiae", "S. cerevisiae", "YEAST"]

	@staticmethod
	def gene_id_from_panther(panther_id):
		# example: SGD=S000000226
		return panther_id.split("=")[1]

	def load_genes(self):
		path = "tmp"
		S3File("mod-datadumps", "SGD_0.3.0_1.tar.gz", path).download()
		TARFile(path, "FB_0.3.0_1.tar.gz").extract_all()
		return GeneLoader(path + "/SGD_0.3_basicGeneInformation.json").get_data()

	def load_go(self):
		query = self.service.new_query("Gene")
		query.add_view(
			"primaryIdentifier", "symbol", "secondaryIdentifier",
			"goAnnotation.ontologyTerm.identifier", "goAnnotation.ontologyTerm.name",
			"goAnnotation.ontologyTerm.namespace"
		)
		query.add_constraint("organism.shortName", "=", "S. cerevisiae", code = "A")

		print("Fetching go data from Yeastmine...")
		list = []
		for row in query.rows():
			list.append({"gene_id": row["primaryIdentifier"], "go_id": row["goAnnotation.ontologyTerm.identifier"], "species": SGD.species})
		return list
<commit_msg>Fixing tar filename<commit_after>from loaders.gene_loader import GeneLoader
from intermine.webservice import Service
from files import *
from mod import MOD


class SGD(MOD):
	species = "Saccharomyces cerevisiae"

	def __init__(self):
		self.service = Service("http://yeastmine.yeastgenome.org/yeastmine/service")

	@staticmethod
	def gene_href(gene_id):
		return "http://www.yeastgenome.org/locus/" + gene_id + "/overview"

	@staticmethod
	def get_organism_names():
		return ["Saccharomyces cerevisiae", "S. cerevisiae", "YEAST"]

	@staticmethod
	def gene_id_from_panther(panther_id):
		# example: SGD=S000000226
		return panther_id.split("=")[1]

	def load_genes(self):
		path = "tmp"
		S3File("mod-datadumps", "SGD_0.3.0_1.tar.gz", path).download()
		TARFile(path, "SGD_0.3.0_1.tar.gz").extract_all()
		return GeneLoader(path + "/SGD_0.3_basicGeneInformation.json").get_data()

	def load_go(self):
		query = self.service.new_query("Gene")
		query.add_view(
			"primaryIdentifier", "symbol", "secondaryIdentifier",
			"goAnnotation.ontologyTerm.identifier", "goAnnotation.ontologyTerm.name",
			"goAnnotation.ontologyTerm.namespace"
		)
		query.add_constraint("organism.shortName", "=", "S. cerevisiae", code = "A")

		print("Fetching go data from Yeastmine...")
		list = []
		for row in query.rows():
			list.append({"gene_id": row["primaryIdentifier"], "go_id": row["goAnnotation.ontologyTerm.identifier"], "species": SGD.species})
		return list

{'fraction_non_alphanumeric': 0.14932595921189076, 'fraction_numerical': 0.014517801590044937, 'mean_word_length': 5.3885209713024285, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6182228', 'n_tokens_mistral': 1127, 'n_tokens_neox': 994, 'n_words': 188}