Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def fetch_from_pgdb(self, tables, cxn, limit=None, force=False): con = None try: con = psycopg2.connect( host=cxn['host'], database=cxn['database'], port=cxn['port'], user=cxn['user'], password=cxn['passwo...
[ "\n Will fetch all Postgres tables from the specified database\n in the cxn connection parameters.\n This will save them to a local file named the same as the table,\n in tab-delimited format, including a header.\n :param tables: Names of tables to fetch\n :param cx...
Please provide a description of the function:def fetch_query_from_pgdb(self, qname, query, con, cxn, limit=None, force=False): if con is None and cxn is None: LOG.error("ERROR: you need to supply connection information") return if con is None and cxn is not None: ...
[ "\n Supply either an already established connection, or connection parameters.\n The supplied connection will override any separate cxn parameter\n :param qname: The name of the query to save the output to\n :param query: The SQL query itself\n :param con: The already-establish...
Please provide a description of the function:def _getcols(cur, table): query = ' '.join(("SELECT * FROM", table, "LIMIT 0")) # for testing cur.execute(query) colnames = [desc[0] for desc in cur.description] LOG.info("COLS (%s): %s", table, colnames) return
[ "\n Will execute a pg query to get the column names for the given table.\n :param cur:\n :param table:\n :return:\n " ]
Please provide a description of the function:def fetch(self, is_dl_forced=False): '''connection details for DISCO''' cxn = {} cxn['host'] = 'nif-db.crbs.ucsd.edu' cxn['database'] = 'disco_crawler' cxn['port'] = '5432' cxn['user'] = config.get_config()['user']['disco'] ...
[]
Please provide a description of the function:def parse(self, limit=None): ''' Over ride Source.parse inherited via PostgreSQLSource ''' if limit is not None: LOG.info("Only parsing first %s rows of each file", limit) if self.test_only: self.test_mode...
[]
Please provide a description of the function:def _process_nlx_157874_1_view(self, raw, limit=None): model = Model(self.graph) with open(raw, 'r') as f1: f1.readline() # read the header row; skip reader = csv.reader(f1, delimiter='\t', quotechar='\"') for li...
[ "\n This table contains the Elements of Morphology data that has been\n screen-scraped into DISCO.\n Note that foaf:depiction is inverse of foaf:depicts relationship.\n\n Since it is bad form to have two definitions,\n we concatenate the two into one string.\n\n Turtle:\n ...
Please provide a description of the function:def _map_eom_terms(self, raw, limit=None): model = Model(self.graph) line_counter = 0 with open(raw, 'r') as f1: f1.readline() # read the header row; skip for line in f1: line_counter += 1 ...
[ "\n This table contains the HP ID mappings from the local tsv file.\n Triples:\n <eom id> owl:equivalentClass <hp id>\n :param raw:\n :param limit:\n :return:\n " ]
Please provide a description of the function:def get_symbol_id_map(self): symbol_id_map = {} f = '/'.join((self.rawdir, self.files['genes']['file'])) with open(f, 'r', encoding="utf8") as csvfile: filereader = csv.reader(csvfile, delimiter='\t', quotechar='\"') ...
[ "\n A convenience method to create a mapping between the HGNC\n symbols and their identifiers.\n :return:\n\n " ]
Please provide a description of the function:def fetch(self, is_dl_forced=False): # check if config exists; if it doesn't, error out and let user know if 'dbauth' not in config.get_config() and 'mgi' \ not in config.get_config()['dbauth']: LOG.error("not configured w...
[ "\n For the MGI resource, we connect to the remote database,\n and pull the tables into local files.\n We'll check the local table versions against the remote version\n :return:\n " ]
Please provide a description of the function:def parse(self, limit=None): if limit is not None: LOG.info("Only parsing first %d rows of each file", limit) LOG.info("Parsing files...") if self.test_only: self.test_mode = True # the following will provide...
[ "\n We process each of the postgres tables in turn.\n The order of processing is important here, as we build\n up a hashmap of internal vs external identifers\n (unique keys by type to MGI id). These include allele, marker (gene),\n publication, strain, genotype, annotation (asso...
Please provide a description of the function:def _process_gxd_genotype_view(self, limit=None): line_counter = 0 if self.test_mode: graph = self.testgraph else: graph = self.graph geno = Genotype(graph) model = Model(graph) raw = '/'.joi...
[ "\n This table indicates the relationship between a genotype\n and it's background strain. It leverages the Genotype class methods\n to do this.\n\n Makes these triples:\n <MGI:genotypeid> GENO:has_reference_part <MGI:strainid>\n <MGI:strainid> a GENO:genomic_background\n\...
Please provide a description of the function:def _process_gxd_genotype_summary_view(self, limit=None): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) line_counter = 0 geno_hash = {} raw = '/'.join(...
[ "\n Add the genotype internal id to mgiid mapping to the idhashmap.\n Also, add them as individuals to the graph.\n We re-format the label to put the background strain in brackets\n after the gvc.\n\n We must pass through the file once to get the ids and\n aggregate the vsl...
Please provide a description of the function:def _process_all_summary_view(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) line_counter = 0 raw = '/'.join((self.rawdir, 'all_summary_view')) ...
[ "\n Here, we get the allele definitions: id, label, description, type\n We also add the id to this source's global idhash for lookup later\n\n <alleleid> a OWL:NamedIndividual\n rdf:label \"allele symbol\"\n dc:description \"long allele name\"\n\n :param limit:\n ...
Please provide a description of the function:def _process_all_allele_view(self, limit): # transmission_key -> inheritance? Need to locate related table. if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) geno =...
[ "\n Add the allele as a variant locus (or reference locus if wild-type).\n If the marker is specified, we add the link to the marker.\n We assume that the MGI ids are available in the idhash,\n added in all_summary_view.\n We add the sequence alteration as a BNode here, if there i...
Please provide a description of the function:def _process_all_allele_mutation_view(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) line_counter = 0 raw = '/'.join((self.rawdir, 'all_allele_muta...
[ "\n This fetches the mutation type for the alleles,\n and maps them to the sequence alteration.\n Note that we create a BNode for the sequence alteration because\n it isn't publicly identified.\n <sequence alteration id> a <SO:mutation_type>\n\n :param limit:\n :retu...
Please provide a description of the function:def _process_voc_annot_view(self, limit): # TODO also get Strain/Attributes (annottypekey = 1000) # TODO what is Phenotype (Derived) vs # non-derived? (annottypekey = 1015) # TODO is evidence in this table? what is the evidence voc...
[ "\n This MGI table represents associations between things.\n\n We add the internal annotation id to the idhashmap.\n It is expected that the genotypes have already been added to the idhash\n\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _process_evidence_view(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) line_counter = 0 LOG.info("getting evidence and pubs for annotations") ...
[ "\n Here we fetch the evidence (code and publication) for the associations.\n The evidence codes are mapped from the standard GO codes to ECO.\n J numbers are added for publications.\n We will only add the evidence if the annotation is in our idhash.\n\n We also pull in evidence q...
Please provide a description of the function:def _process_bib_acc_view(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) # firstpass, get the J number mapping, and add to the global hash LOG.inf...
[ "\n This traverses the table twice:\n once to look up the internal key to J number mapping\n for the id hashmap then again to make the equivalences.\n All internal keys have both a J and MGI identifier.\n This will make equivalences between the different pub ids\n Triples:\...
Please provide a description of the function:def _process_prb_strain_view(self, limit): # Only 9 strain types if we want to map them # recombinant congenci, inbred strain, NA, # congenic, consomic, coisogenic, # recombinant inbred, NS, ...
[ "\n Process a table to get strains (with internal ids), and their labels.\n These strains are created as instances of the species that they are.\n Triples:\n <strain id> a GENO:intrinsic_genotype\n rdf:label \"strain label\"\n RO:in_taxon <NCBI taxon id>...
Please provide a description of the function:def _process_mrk_marker_view(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) geno = Genotype(graph) line_counter = 0 raw = '/'.join((self.ra...
[ "\n This is the definition of markers\n (as in genes, but other genomic loci types as well).\n It looks up the identifiers in the hashmap\n This includes their labels, specific class, and identifiers\n TODO should we use the mrk_mouse_view instead?\n\n Triples:\n <ma...
Please provide a description of the function:def _process_mrk_summary_view(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) LOG.info("getting markers and equivalent ids from mrk_summary_view") l...
[ "\n Here we pull the mgiid of the features, and make equivalent (or sameAs)\n associations to referenced ids.\n Only adding the ENSEMBL genes and NCBI gene ids.\n Will wait on other ids later.\n\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _process_mrk_acc_view(self): # make a pass through the table first, # to create the mapping between the external and internal identifiers line_counter = 0 LOG.info("mapping markers to internal identifiers") raw = '/'.join...
[ "\n Use this table to create the idmap between the internal marker id and\n the public mgiid.\n No triples are produced in this process\n :return:\n\n " ]
Please provide a description of the function:def _process_mrk_acc_view_for_equiv(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) # pass through the file again, # and make the equivalence statem...
[ "\n Add the equivalences, either sameAs or equivalentClass,\n depending on the nature of the marker.\n We only process the ENSEMBL genes and NCBI gene ids.\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _process_prb_strain_acc_view(self, limit): # make a pass through the table first, # to create the mapping between the external and internal identifiers line_counter = 0 if self.test_mode: graph = self.testgraph ...
[ "\n Use this table to create the idmap between\n the internal marker id and the public mgiid.\n Also, add the equivalence statements between strains for MGI and JAX\n Triples:\n <strain_id> a GENO:intrinsic_genotype\n <other_strain_id> a GENO:intrinsic_genotype\n <st...
Please provide a description of the function:def _process_mgi_note_vocevidence_view(self, limit): line_counter = 0 if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) LOG.info("getting free text descriptions fo...
[ "\n Here we fetch the free text descriptions of the phenotype associations.\n Triples:\n <annot_id> dc:description \"description text\"\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def process_mgi_relationship_transgene_genes(self, limit=None): if self.test_mode: graph = self.testgraph else: graph = self.graph LOG.info("getting transgene genes") raw = '/'.join((self.rawdir, 'mgi_relations...
[ "\n Here, we have the relationship between MGI transgene alleles,\n and the non-mouse gene ids that are part of them.\n We augment the allele with the transgene parts.\n\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def process_mgi_note_allele_view(self, limit=None): line_counter = 0 if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) LOG.info("Assembling notes on alleles") ...
[ "\n These are the descriptive notes about the alleles.\n Note that these notes have embedded HTML -\n should we do anything about that?\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _process_prb_strain_genotype_view(self, limit=None): line_counter = 0 if self.test_mode: graph = self.testgraph else: graph = self.graph LOG.info("Getting genotypes for strains") raw = '/'.join((se...
[ "\n Here we fetch the free text descriptions of the phenotype associations.\n Triples:\n <annot_id> dc:description \"description text\"\n :param limit:\n\n :return:\n " ]
Please provide a description of the function:def update_wsnum_in_files(self, vernum): self.version_num = vernum # replace the WSNUMBER in the url paths with the real WS### for f in self.files: url = self.files[f].get('url') url = re.sub(r'WSNUMBER', self.version_...
[ "\n With the given version number ```vernum```,\n update the source's version number, and replace in the file hashmap.\n the version number is in the CHECKSUMS file.\n :param vernum:\n :return:\n\n " ]
Please provide a description of the function:def process_allele_phenotype(self, limit=None): raw = '/'.join((self.rawdir, self.files['allele_pheno']['file'])) if self.test_mode: graph = self.testgraph else: graph = self.graph LOG.info("Processing Allel...
[ "\n This file compactly lists variant to phenotype associations,\n such that in a single row, there may be >1 variant listed\n per phenotype and paper. This indicates that each variant is\n individually assocated with the given phenotype,\n as listed in 1+ papers.\n (Not t...
Please provide a description of the function:def process_gene_interaction(self, limit): raw = '/'.join((self.rawdir, self.files['gene_interaction']['file'])) if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) ...
[ "\n The gene interaction file includes identified interactions,\n that are between two or more gene (products).\n In the case of interactions with >2 genes, this requires creating\n groups of genes that are involved in the interaction.\n From the wormbase help list: In the example...
Please provide a description of the function:def main(): parser = argparse.ArgumentParser() parser.add_argument('--input', '-i', type=str, required=True, help='Location of input file') parser.add_argument('--yaml', '-y', type=str, required=True, help='Lo...
[ "\n Collapse results of scrape-impc.py and manual mappings from impc_procedures.yaml\n Note the manual map exists due to some procedures being served as pdf and not\n parsable by our web scraper. There are also duplicate pages for certain iDs,\n for example:\n {\"JAX_LDT_001\": \"https://www.mouseph...
Please provide a description of the function:def parse(self, limit=None): if limit is not None: LOG.info("Only parsing first %d rows", limit) ensembl_file = '/'.join((self.rawdir, self.files['ensembl2pathway']['file'])) self._parse_reactome_association_file( ens...
[ "\n Override Source.parse()\n Args:\n :param limit (int, optional) limit the number of rows processed\n Returns:\n :return None\n " ]
Please provide a description of the function:def _parse_reactome_association_file( self, file, limit=None, subject_prefix=None, object_prefix=None): eco_map = Reactome.get_eco_map(Reactome.map_files['eco_map']) count = 0 with open(file, 'r') as tsvfile: reader = ...
[ "\n Parse ensembl gene to reactome pathway file\n :param file: file path (not handle)\n :param limit: limit (int, optional) limit the number of rows processed\n :return: None\n " ]
Please provide a description of the function:def _getnode(self, curie): # convention is lowercase names node = None if curie[0] == '_': if self.are_bnodes_skized is True: node = self.skolemizeBlankNode(curie) else: # delete the leading underscore to mak...
[ "\n This is a wrapper for creating a URIRef or Bnode object\n with a given a curie or iri as a string.\n\n If an id starts with an underscore, it assigns it to a BNode, otherwise\n it creates it with a standard URIRef.\n Alternatively, self.skolemize_blank_node is True,\n i...
Please provide a description of the function:def bind_all_namespaces(self): ''' Results in the RDF @prefix directives for every ingest being added to this ingest. ''' for prefix in self.curie_map.keys(): iri = self.curie_map[prefix] self.bind(pref...
[]
Please provide a description of the function:def add_association_to_graph(self): # add the basic association nodes # if rel == self.globaltt[['has disposition']: Assoc.add_association_to_graph(self) # anticipating trouble with onsets ranges that look like curies if sel...
[ "\n The reified relationship between a disease and a phenotype is decorated\n with some provenance information.\n This makes the assumption that both the disease and phenotype\n are classes.\n\n :param g:\n\n :return:\n\n " ]
Please provide a description of the function:def process_catalog(self, limit=None): raw = '/'.join((self.rawdir, self.files['catalog']['file'])) LOG.info("Processing Data from %s", raw) efo_ontology = RDFGraph(False, "EFO") LOG.info("Loading EFO ontology in separate rdf graph") ...
[ "\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _get_curie_and_type_from_id(variant_id): curie = None variant_type = None # remove space before hyphens variant_id = re.sub(r' -', '-', variant_id).strip() if re.search(r' x ', variant_id) or re.search(r',', variant_id): ...
[ "\n Given a variant id, our best guess at its curie and type (snp, haplotype, etc)\n 'None' will be used for both curie and type for IDs that we can't process\n :param variant_id:\n :return:\n " ]
Please provide a description of the function:def getChrPartTypeByNotation(notation, graph=None): # Note that for mouse, # they don't usually include the "q" in their notation, # though UCSC does. We may need to adjust for that here if re.match(r'p$', notation): rti = graph.globaltt['short...
[ "\n This method will figure out the kind of feature that a given band\n is based on pattern matching to standard karyotype notation.\n (e.g. 13q22.2 ==> chromosome sub-band)\n\n This has been validated against human, mouse, fish, and rat nomenclature.\n :param notation: the band (without the chromoso...
Please provide a description of the function:def _get_chrbands(self, limit, taxon): model = Model(self.graph) line_counter = 0 myfile = '/'.join((self.rawdir, self.files[taxon]['file'])) LOG.info("Processing Chr bands from FILE: %s", myfile) geno = Genotype(self.graph) ...
[ "\n For the given taxon, it will fetch the chr band file.\n We will not deal with the coordinate information with this parser.\n Here, we only are concerned with building the partonomy.\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def make_parent_bands(self, band, child_bands): m = re.match(r'([pq][A-H\d]+(?:\.\d+)?)', band) if len(band) > 0: if m: p = str(band[0:len(band)-1]) p = re.sub(r'\.$', '', p) if p is not Non...
[ "\n this will determine the grouping bands that it belongs to, recursively\n 13q21.31 ==> 13, 13q, 13q2, 13q21, 13q21.3, 13q21.31\n\n :param band:\n :param child_bands:\n :return:\n\n " ]
Please provide a description of the function:def map_type_of_region(self, regiontype): if regiontype in self.localtt: so_id = self.resolve(regiontype) else: so_id = self.globaltt['chromosome_part'] LOG.warning( "Unmapped code %s. Defaulting t...
[ "\n Note that \"stalk\" refers to the short arm of acrocentric chromosomes\n chr13,14,15,21,22 for human.\n :param regiontype:\n :return:\n\n " ]
Please provide a description of the function:def get_curie(self, uri): '''Get a CURIE from a URI ''' prefix = self.get_curie_prefix(uri) if prefix is not None: key = self.curie_map[prefix] return '%s:%s' % (prefix, uri[len(key):len(uri)]) return None
[]
Please provide a description of the function:def get_curie_prefix(self, uri): ''' Return the CURIE's prefix:''' for key, value in self.uri_map.items(): if uri.startswith(key): return value return None
[]
Please provide a description of the function:def get_uri(self, curie): ''' Get a URI from a CURIE ''' if curie is None: return None parts = curie.split(':') if len(parts) == 1: if curie != '': LOG.error("Not a properly formed curie: \"%s\"", curie)...
[]
Please provide a description of the function:def fetch(self, is_dl_forced=True): username = config.get_config()['dbauth']['udp']['user'] password = config.get_config()['dbauth']['udp']['password'] credentials = (username, password) # Get patient map file: patient_id_m...
[ "\n Fetches data from udp collaboration server,\n see top level comments for class for more information\n :return:\n " ]
Please provide a description of the function:def parse(self, limit=None): if limit is not None: LOG.info("Only parsing first %d rows", limit) phenotype_file = '/'.join( (self.rawdir, self.files['patient_phenotypes']['file'])) variant_file = '/'.join((self.rawdir...
[ "\n Override Source.parse()\n Args:\n :param limit (int, optional) limit the number of rows processed\n Returns:\n :return None\n " ]
Please provide a description of the function:def _parse_patient_variants(self, file): patient_var_map = self._convert_variant_file_to_dict(file) gene_coordinate_map = self._parse_gene_coordinates( self.map_files['gene_coord_map']) rs_map = self._parse_rs_map_file(self.map_fi...
[ "\n :param file: file handler\n :return:\n " ]
Please provide a description of the function:def _add_variant_gene_relationship(self, patient_var_map, gene_coordinate_map): # genotype = Genotype(self.graph) dipper_util = DipperUtil() model = Model(self.graph) # Note this could be compressed in someway to remove one level of f...
[ "\n Right now it is unclear the best approach on how to connect\n variants to genes. In most cases has_affected_locus/GENO:0000418\n is accurate; however, there are cases where a variant is in the intron\n on one gene and is purported to causally affect another gene down or\n ups...
Please provide a description of the function:def _convert_variant_file_to_dict(varfile): patient_variant_map = {} # line_num = 0 note this is builtin to the reader as reader.line_num reader = csv.reader(varfile, delimiter="\t") col = [ 'patient', 'family', 'chromos...
[ "\n Converts tsv to dicts with this structure\n {\n 'patient_1': {\n 'variant-id': {\n 'build': 'hg19'\n 'chromosome': 'chr7',\n 'reference_allele': 'A',\n 'variant_allele': 'G',\n ...
Please provide a description of the function:def _parse_patient_phenotypes(self, file, limit=None): model = Model(self.graph) line_counter = 0 reader = csv.reader(file, delimiter="\t") for row in reader: (patient_id, hpo_curie, present) = row patient_curi...
[ "\n :param file: file handler\n :param limit: limit rows processed\n :return:\n " ]
Please provide a description of the function:def _parse_gene_coordinates(file): id_map = {} col = ['gene_curie', 'start', 'end', 'strand', 'build'] if os.path.exists(os.path.join(os.path.dirname(__file__), file)): with open(os.path.join(os.path.dirname(__file__), file)) as t...
[ "\n :param file: file path\n :param limit: limit (int, optional) limit the number of rows processed\n :return: dict\n " ]
Please provide a description of the function:def _parse_rs_map_file(rsfile): rs_map = {} col = ['chromosome', 'position', 'rs_id', 'var_type', 'alleles'] if os.path.exists(os.path.join(os.path.dirname(__file__), rsfile)): with open(os.path.join(os.path.dirname(__file__), rsf...
[ "\n Parses rsID mapping file from dbSNP\n Outputs dict where keys are coordinates in the format\n {chromsome}-{position}\n\n {\n chr1-1234: [\n {\n 'type': 'snp'\n 'rs_id': 'rs1234'\n 'alleles': 'A/G/T'\n ...
Please provide a description of the function:def _build_variant_label( build, chromosome, position, reference_allele, variant_allele, gene_symbols=None ): variant_label = '' prefix = '' if gene_symbols and len(gene_symbols) == 1 and gene_symbols[0]: ...
[ "\n Function to build HGVS variant labels\n :param build: {str} build id\n :param chromosome: {str} chromosome\n :param position: {str} variation position as string or int\n :param reference_allele: {str} single letter ref bp\n :param variant_allele: {str} single letter bp ...
Please provide a description of the function:def _add_gene_to_graph(self, gene, variant_bnode, gene_id, relation): model = Model(self.graph) if gene_id: self.graph.addTriple(variant_bnode, relation, gene_id) elif gene: LOG.info("gene %s not mapped to NCBI gene, m...
[ "\n :param gene:\n :param variant_bnode:\n :return:\n " ]
Please provide a description of the function:def _add_variant_sameas_relationships(self, patient_var_map, rs_map): model = Model(self.graph) for patient in patient_var_map: for variant_id, variant in patient_var_map[patient].items(): variant_bnode = self.make_id("{0}...
[ "\n Adds same as relationships between udp variant bnodes and dbsnp ids\n :param patient_var_map:\n :param rs_map:\n :return:\n " ]
Please provide a description of the function:def _get_rs_id(variant, rs_map, variant_type): rs_id = None if variant_type == 'snp': variant_key = "{0}-{1}".format(variant['chromosome'], variant['position']) if variant_key in rs_map: snp_candidates = [ ...
[ "\n Given a variant dict, return unambiguous RS ID\n TODO\n Some sequence alterations appear to have mappings to dbsnp's notation\n for example,\n reference allele: TTTTTTTTTTTTTT\n variant allele: TTTTTTTTTTTTTTT\n Is theoretically the same as -/T, we should clari...
Please provide a description of the function:def fetch(self, is_dl_forced=False): host = config.get_config()['dbauth']['coriell']['host'] key = config.get_config()['dbauth']['coriell']['private_key'] user = config.get_config()['user']['coriell'] passwd = config.get_config()['ke...
[ "\n Here we connect to the coriell sftp server using private connection\n details. They dump bi-weekly files with a timestamp in the filename.\n For each catalog, we ping the remote site and pull the most-recently\n updated file, renaming it to our local latest.csv.\n\n Be sure ...
Please provide a description of the function:def _process_data(self, src_key, limit=None): raw = '/'.join((self.rawdir, self.files[src_key]['file'])) LOG.info("Processing Data from %s", raw) if self.test_mode: # set the graph to build graph = self.testgraph e...
[ "\n This function will process the data files from Coriell.\n We make the assumption that any alleles listed are variants\n (alternates to w.t.)\n\n Triples: (examples)\n\n :NIGMSrepository a CLO_0000008 #repository\n label : NIGMS Human Genetic Cell Repository\n foa...
Please provide a description of the function:def _process_collection(self, collection_id, label, page): # ############# BUILD THE CELL LINE REPOSITORY ############# for graph in [self.graph, self.testgraph]: # TODO: How to devise a label for each repository? model ...
[ "\n This function will process the data supplied internally\n about the repository from Coriell.\n\n Triples:\n Repository a ERO:collection\n rdf:label Literal(label)\n foaf:page Literal(page)\n\n :param collection_id:\n :param label:\n :par...
Please provide a description of the function:def _is_normal_karyotype(karyotype): is_normal = True if karyotype is not None: karyotype = karyotype.strip() if karyotype not in ['46;XX', '46;XY', '']: is_normal = False return is_normal
[ "\n This will default to true if no karyotype is provided.\n This is assuming human karyotypes.\n :param karyotype:\n :return:\n " ]
Please provide a description of the function:def fetch(self, is_dl_forced=False): # create the connection details for Flybase cxn = { 'host': 'chado.flybase.org', 'database': 'flybase', 'port': 5432, 'user': 'flybase', 'password': 'no password'} self.dataset.se...
[ "\n :return:\n\n " ]
Please provide a description of the function:def parse(self, limit=None): if limit is not None: LOG.info("Only parsing first %d rows of each file", limit) LOG.info("Parsing files...") if self.test_only: self.test_mode = True # the following will provide...
[ "\n We process each of the postgres tables in turn.\n The order of processing is important here, as we build up a hashmap of\n internal vs external identifers (unique keys by type to FB id).\n These include allele, marker (gene), publication, strain, genotype,\n annotation (associ...
Please provide a description of the function:def _process_genotypes(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) line_counter = 0 raw = '/'.join((self.rawdir, 'genotype')) LOG.info(...
[ "\n Add the genotype internal id to flybase mapping to the idhashmap.\n Also, add them as individuals to the graph.\n\n Triples created:\n <genotype id> a GENO:intrinsic_genotype\n <genotype id> rdfs:label \"<gvc> [bkgd]\"\n\n :param limit:\n :return:\n " ]
Please provide a description of the function:def _process_stocks(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) line_counter = 0 raw = '/'.join((self.rawdir, 'stock')) LOG.info("build...
[ "\n Stock definitions.\n Here we instantiate them as instances of the given taxon.\n\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _process_pubs(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) line_counter = 0 raw = '/'.join((self.rawdir, 'pub')) LOG.info("building ...
[ "\n Flybase publications.\n\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _process_environments(self): if self.test_mode: graph = self.testgraph else: graph = self.graph raw = '/'.join((self.rawdir, 'environment')) LOG.info("building labels for environment") env_parts = {...
[ "\n There's only about 30 environments in which the phenotypes\n are recorded.\n There are no externally accessible identifiers for environments,\n so we make anonymous nodes for now.\n Some of the environments are comprised of >1 of the other environments;\n we do some sim...
Please provide a description of the function:def _process_features(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) raw = '/'.join((self.rawdir, 'feature')) LOG.info("building labels for featur...
[ "\n These are all of the genomic features genes, variations,\n transgenes, etc\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _process_phendesc(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) raw = '/'.join((self.rawdir, 'phendesc')) LOG.info("processing G2P") ...
[ "\n The description of the resulting phenotypes\n with the genotype+environment\n\n :param limit:\n :return:\n " ]
Please provide a description of the function:def _process_feature_pub(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph raw = '/'.join((self.rawdir, 'feature_pub')) LOG.info("processing feature_pub") line_counter ...
[ "\n The description of the resulting phenotypes\n with the genotype+environment\n\n :param limit:\n :return:\n " ]
Please provide a description of the function:def _process_stock_genotype(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph raw = '/'.join((self.rawdir, 'stock_genotype')) LOG.info("processing stock genotype") line_...
[ "\n The genotypes of the stocks.\n\n :param limit:\n :return:\n " ]
Please provide a description of the function:def _process_pub_dbxref(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) raw = '/'.join((self.rawdir, 'pub_dbxref')) LOG.info("processing pub_dbxref...
[ "\n Xrefs for publications (ie FBrf = PMID)\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _process_dbxref(self): raw = '/'.join((self.rawdir, 'dbxref')) LOG.info("processing dbxrefs") line_counter = 0 with open(raw, 'r') as f: filereader = csv.reader(f, delimiter='\t', quotechar='\"') f.readli...
[ "\n We bring in the dbxref identifiers and store them in a hashmap for\n lookup in other functions.\n Note that some dbxrefs aren't mapped to identifiers.\n For example, 5004018 is mapped to a string,\n \"endosome & imaginal disc epithelial cell | somatic clone...\"\n I...
Please provide a description of the function:def _process_phenotype(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) raw = '/'.join((self.rawdir, 'phenotype')) LOG.info("processing phenotype") ...
[ "\n Get the phenotypes, and declare the classes.\n If the \"observable\" is \"unspecified\", then we assign the phenotype to\n the \"cvalue\" id; otherwise we convert the phenotype into a\n uberpheno-style identifier, simply based on the anatomical part that's\n affected...that is...
Please provide a description of the function:def _process_phenstatement(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) raw = '/'.join((self.rawdir, 'phenstatement')) LOG.info("processing phen...
[ "\n The phenstatements are the genotype-to-phenotype associations,\n in the context of an environment.\n These are also curated to a publication. So we make oban associations,\n adding the pubs as a source. We additionally add the internal key as\n a comment for tracking purposes...
Please provide a description of the function:def _process_phenotype_cvterm(self): line_counter = 0 raw = '/'.join((self.rawdir, 'phenotype_cvterm')) LOG.info("processing phenotype cvterm mappings") with open(raw, 'r') as f: f.readline() # read the header row; skip...
[ "\n These are the qualifiers for the phenotype location itself.\n But are just the qualifiers.\n The actual \"observable\" part of the phenotype is only in\n the phenotype table. These get added to a lookup variable used to\n augment a phenotype association statement.\n :re...
Please provide a description of the function:def _process_cvterm(self): line_counter = 0 raw = '/'.join((self.rawdir, 'cvterm')) LOG.info("processing cvterms") with open(raw, 'r') as f: f.readline() # read the header row; skip filereader = csv.reader(f...
[ "\n CVterms are the internal identifiers for any controlled vocab\n or ontology term. Many are xrefd to actual ontologies. The actual\n external id is stored in the dbxref table, which we place into\n the internal hashmap for lookup with the cvterm id. The name of\n the externa...
Please provide a description of the function:def _process_environment_cvterm(self): line_counter = 0 raw = '/'.join((self.rawdir, 'environment_cvterm')) LOG.info("processing environment to cvterm mappings") with open(raw, 'r') as f: f.readline() # read the header ...
[ "\n This is the mapping between the internal environment id\n and the external ones; here we map the internal environment id to\n the external one in the hashmap.\n :return:\n\n " ]
Please provide a description of the function:def _process_feature_dbxref(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) line_counter = 0 raw = '/'.join((self.rawdir, 'feature_dbxref')) ...
[ "\n This is the mapping between the flybase features and external\n repositories. Generally we want to leave the flybase feature id\n as the primary identifier. But we need to make the equivalences/sameAs.\n\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _get_derived_feature_types(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) raw = '/'.join((self.rawdir, 'feature_relationship')) LOG.info("dete...
[ "\n Make a pass through the feature table in order to properly type\n the FBal (allele) features, which are derived either from other\n sequence features (which can be things like RNAi products)\n or transgenic-transposons. We'll save the allele type into a hasmap.\n\n :param lim...
Please provide a description of the function:def _process_organisms(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) raw = '/'.join((self.rawdir, 'organism')) LOG.info("processing organisms") ...
[ "\n The internal identifiers for the organisms in flybase\n\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _process_organism_dbxref(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) line_counter = 0 raw = '/'.join((self.rawdir, 'organism_dbxref')) ...
[ "\n This is the mapping between the flybase organisms and\n external identifier \"FBsp\". We will want to use the NCBITaxon as\n the primary, if possible, but will default to a blank node/internal id\n if that is all that is available\n But we need to make the equivalences/sameAs....
Please provide a description of the function:def _process_disease_models(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph raw = '/'.join((self.rawdir, self.files['disease_models']['file'])) LOG.info("processing disease mod...
[ "\n Here we make associations between a disease and the supplied \"model\".\n In this case it's an allele.\n FIXME consider changing this... are alleles really models?\n Perhaps map these alleles into actual animals/strains or genotypes?\n :param limit:\n :return:\n\n ...
Please provide a description of the function:def _process_stockprop(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) raw = '/'.join((self.rawdir, 'stockprop')) LOG.info("processing stock-image ...
[ "\n This will add depiction association between a strain and\n images hosted at flybase.\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _get_human_models_file(self): base_url = 'ftp.flybase.net' human_disease_dir = 'releases/current/precomputed_files/human_disease' from ftplib import FTP ftp = FTP(base_url) # connect to host ftp.login() ftp.cw...
[ "\n This function uses ftp to probe the FTP site to get the name of\n the current human_models file, and sets it in the files object.\n :return:\n\n " ]
Please provide a description of the function:def _get_gene_info(self, limit): src_key = 'gene_info' if self.test_mode: graph = self.testgraph else: graph = self.graph geno = Genotype(graph) model = Model(graph) # not unzipping the file ...
[ "\n Currently loops through the gene_info file and\n creates the genes as classes, typed with SO. It will add their label,\n any alternate labels as synonyms, alternate ids as equivlaent classes.\n HPRDs get added as protein products.\n The chromosome and chr band get added as bl...
Please provide a description of the function:def _add_gene_equivalencies(self, xrefs, gene_id, taxon): clique_map = self.open_and_parse_yaml(self.resources['clique_leader']) if self.test_mode: graph = self.testgraph else: graph = self.graph model = Mode...
[ "\n Add equivalentClass and sameAs relationships\n\n Uses external resource map located in\n /resources/clique_leader.yaml to determine\n if an NCBITaxon ID space is a clique leader\n " ]
Please provide a description of the function:def _get_gene_history(self, limit): src_key = 'gene_history' if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) LOG.info("Processing Gene records") line_coun...
[ "\n Loops through the gene_history file and adds the old gene ids\n as deprecated classes, where the new gene id is the replacement for it.\n The old gene symbol is added as a synonym to the gene.\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _get_gene2pubmed(self, limit): src_key = 'gene2pubmed' if self.test_mode: graph = self.testgraph else: graph = self.graph model = Model(graph) LOG.info("Processing Gene records") line_counte...
[ "\n Loops through the gene2pubmed file and adds a simple triple to say\n that a given publication is_about a gene.\n Publications are added as NamedIndividuals.\n\n These are filtered on the taxon.\n\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def add_orthologs_by_gene_group(self, graph, gene_ids): src_key = 'gene_group' LOG.info("getting gene groups") src_file = '/'.join((self.rawdir, self.files[src_key]['file'])) found_counter = 0 # because many of the orthologous...
[ "\n This will get orthologies between human and other vertebrate genomes\n based on the gene_group annotation pipeline from NCBI.\n More information 9can be learned here:\n http://www.ncbi.nlm.nih.gov/news/03-13-2014-gene-provides-orthologs-regions/\n The method for associations i...
Please provide a description of the function:def _get_omim_ids(self): ''' side effect: populate omim_type map from a omim number to an ontology term the ontology terms's labels as - 'gene' when they declare it as a gene ...
[]
Please provide a description of the function:def process_entries( self, omimids, transform, included_fields=None, graph=None, limit=None, globaltt=None ): omimparams = {} # add the included_fields as parameters if included_fields is not None and included_fi...
[ "\n Given a list of omim ids,\n this will use the omim API to fetch the entries, according to the\n ```included_fields``` passed as a parameter.\n If a transformation function is supplied,\n this will iterate over each entry,\n and either add the results to the supplied ```...
Please provide a description of the function:def _process_all(self, limit): omimids = self._get_omim_ids() LOG.info('Have %i omim numbers to fetch records from their API', len(omimids)) LOG.info('Have %i omim types ', len(self.omim_type)) if self.test_mode: graph =...
[ "\n This takes the list of omim identifiers from the omim.txt.Z file,\n and iteratively queries the omim api for the json-formatted data.\n This will create OMIM classes, with the label,\n definition, and some synonyms.\n If an entry is \"removed\",\n it is added as a d...
Please provide a description of the function:def _process_morbidmap(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph line_counter = 0 assoc_count = 0 src_key = 'morbidmap' col = self.files[src_key]['columns'...
[ "\n This will process the morbidmap file to get the links between\n omim genes and diseases. Here, we create anonymous nodes for some\n variant loci that are variants of the gene that causes the disease.\n Triples created:\n <some_anonymous_variant_locus>\n is_allele_of...
Please provide a description of the function:def _make_pheno_assoc( self, graph, gene_id, disorder_num, disorder_label, phene_key ): disorder_id = ':'.join(('OMIM', disorder_num)) rel_label = 'causes condition' rel_id = self.globaltt[rel_label] if disorder_lab...
[ "\n From the docs:\n Brackets, \"[ ]\", indicate \"nondiseases,\" mainly genetic variations\n that lead to apparently abnormal laboratory test values\n (e.g., dysalbuminemic euthyroidal hyperthyroxinemia).\n\n Braces, \"{ }\", indicate mutations that contribute to susceptibility\n...
Please provide a description of the function:def _get_description(entry): description = None if entry is not None and 'textSectionList' in entry: textsectionlist = entry['textSectionList'] for ts in textsectionlist: if ts['textSection']['textSectionName']...
[ "\n Get the description of the omim entity\n from the textSection called 'description'.\n Note that some of these descriptions have linebreaks.\n If printed in turtle syntax, they will appear to be triple-quoted.\n :param entry:\n :return:\n\n " ]
Please provide a description of the function:def _cleanup_label(label): conjunctions = ['and', 'but', 'yet', 'for', 'nor', 'so'] little_preps = [ 'at', 'by', 'in', 'of', 'on', 'to', 'up', 'as', 'it', 'or'] articles = ['a', 'an', 'the'] # remove the abbreviation ...
[ "\n Reformat the ALL CAPS OMIM labels to something more pleasant to read.\n This will:\n 1. remove the abbreviation suffixes\n 2. convert the roman numerals to integer numbers\n 3. make the text title case,\n except for suplied conjunctions/prepositions/articles\n ...
Please provide a description of the function:def _process_phenotypicseries(self, limit): if self.test_mode: graph = self.testgraph else: graph = self.graph LOG.info("getting phenotypic series titles") model = Model(graph) line_counter = 0 ...
[ "\n Creates classes from the OMIM phenotypic series list.\n These are grouping classes to hook the more granular OMIM diseases.\n # TEC what does 'hook' mean here?\n\n :param limit:\n :return:\n\n " ]
Please provide a description of the function:def _get_phenotypicseries_parents(entry, graph): model = Model(graph) omim_num = str(entry['mimNumber']) omim_curie = 'OMIM:' + omim_num # the phenotypic series mappings serieslist = [] if 'phenotypicSeriesExists' in e...
[ "\n Extract the phenotypic series parent relationship out of the entry\n :param entry:\n :return:\n " ]