本文整理汇总了Python中dipper.models.Genotype.Genotype.addDerivesFrom方法的典型用法代码示例。如果您正苦于以下问题:Python Genotype.addDerivesFrom方法的具体用法?Python Genotype.addDerivesFrom怎么用?Python Genotype.addDerivesFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dipper.models.Genotype.Genotype
的用法示例。
在下文中一共展示了Genotype.addDerivesFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _process_data
# 需要导入模块: from dipper.models.Genotype import Genotype [as 别名]
# 或者: from dipper.models.Genotype.Genotype import addDerivesFrom [as 别名]
#.........这里部分代码省略.........
affected = 'affected'
elif affected == 'No':
affected = 'unaffected'
gender = gender.lower()
patient_label = ' '.join((affected, gender, relprob))
if relprob == 'proband':
patient_label = \
' '.join(
(patient_label.strip(), 'with', short_desc))
else:
patient_label = \
' '.join(
(patient_label.strip(), 'of proband with',
short_desc))
# ############# BUILD THE CELL LINE #############
# Adding the cell line as a typed individual.
cell_line_reagent_id = 'CLO:0000031'
gu.addIndividualToGraph(
g, cell_line_id, line_label, cell_line_reagent_id)
# add the equivalent id == dna_ref
if dna_ref != '' and dna_ref != catalog_id:
equiv_cell_line = 'Coriell:'+dna_ref
# some of the equivalent ids are not defined
# in the source data; so add them
gu.addIndividualToGraph(
g, equiv_cell_line, None, cell_line_reagent_id)
gu.addSameIndividual(g, cell_line_id, equiv_cell_line)
# Cell line derives from patient
geno.addDerivesFrom(cell_line_id, patient_id)
geno.addDerivesFrom(cell_line_id, cell_type)
# Cell line a member of repository
gu.addMember(g, repository, cell_line_id)
if cat_remark != '':
gu.addDescription(g, cell_line_id, cat_remark)
# Cell age_at_sampling
# TODO add the age nodes when modeled properly in #78
# if (age != ''):
# this would give a BNode that is an instance of Age.
# but i don't know how to connect
# the age node to the cell line? we need to ask @mbrush
# age_id = '_'+re.sub('\s+','_',age)
# gu.addIndividualToGraph(
# g,age_id,age,self.terms['age'])
# gu.addTriple(
# g,age_id,self.properties['has_measurement'],age,
# True)
# ############# BUILD THE PATIENT #############
# Add the patient ID as an individual.
gu.addPerson(g, patient_id, patient_label)
# TODO map relationship to proband as a class
# (what ontology?)
# Add race of patient
# FIXME: Adjust for subcategories based on ethnicity field
# EDIT: There are 743 different entries for ethnicity...
# Too many to map?
示例2: _process_data
# 需要导入模块: from dipper.models.Genotype import Genotype [as 别名]
# 或者: from dipper.models.Genotype.Genotype import addDerivesFrom [as 别名]
def _process_data(self, raw, limit=None):
logger.info("Processing Data from %s", raw)
gu = GraphUtils(curie_map.get())
if self.testMode:
g = self.testgraph
else:
g = self.graph
geno = Genotype(g)
line_counter = 0
gu.loadAllProperties(g)
gu.loadObjectProperties(g, geno.object_properties)
# with open(raw, 'r', encoding="utf8") as csvfile:
with gzip.open(raw, 'rt') as csvfile:
filereader = csv.reader(csvfile, delimiter=',', quotechar='\"')
next(filereader, None) # skip the header row
for row in filereader:
line_counter += 1
(marker_accession_id, marker_symbol, phenotyping_center, colony, sex, zygosity, allele_accession_id,
allele_symbol, allele_name, strain_accession_id, strain_name, project_name, project_fullname,
pipeline_name, pipeline_stable_id, procedure_stable_id, procedure_name,
parameter_stable_id, parameter_name,
top_level_mp_term_id, top_level_mp_term_name, mp_term_id, mp_term_name,
p_value, percentage_change, effect_size, statistical_method, resource_name) = row
if self.testMode and marker_accession_id not in self.test_ids:
continue
###### cleanup some of the identifiers ######
zygosity_id = self._map_zygosity(zygosity)
# colony ids sometimes have <> in them, and break our system; replace these with underscores
colony_id = '_'+re.sub('[<>\s]', '_', colony)
if self.nobnodes:
colony_id = ':'+colony_id
if not re.match('MGI', allele_accession_id):
allele_accession_id = '_IMPC-'+re.sub(':', '', allele_accession_id)
if self.nobnodes:
allele_accession_id = ':'+allele_accession_id
if re.search('EUROCURATE', strain_accession_id):
strain_accession_id = '_'+strain_accession_id # the eurocurate links don't resolve at IMPC
if self.nobnodes:
strain_accession_id = ':'+strain_accession_id
elif not re.match('MGI', strain_accession_id):
logger.info("Found a strange strain accession...%s", strain_accession_id)
strain_accession_id = 'IMPC:'+strain_accession_id
############## BUILD THE COLONY #############
# first, let's describe the colony that the animals come from
# The Colony ID refers to the ES cell clone used to generate a mouse strain.
# Terry sez: we use this clone ID to track ES cell -> mouse strain -> mouse phenotyping.
# The same ES clone maybe used at multiple centers, so we have to concatenate the two to have a
# unique ID.
# some useful reading about generating mice from ES cells:
# http://ki.mit.edu/sbc/escell/services/details
# here, we'll make a genotype that derives from an ES cell with a given allele. the strain is not
# really attached to the colony.
# the colony/clone is reflective of the allele, with unknown zygosity
stem_cell_class = 'CL:0000034'
gu.addIndividualToGraph(g, colony_id, colony, stem_cell_class)
# vslc of the colony has unknown zygosity
# note that we will define the allele (and it's relationship to the marker, etc.) later
vslc_colony = '_'+allele_accession_id+geno.zygosity['indeterminate']
vslc_colony = re.sub(':', '', vslc_colony)
if self.nobnodes:
vslc_colony = ':'+vslc_colony
vslc_colony_label = allele_symbol+'/<?>'
gu.addIndividualToGraph(g, vslc_colony, vslc_colony_label,
geno.genoparts['variant_single_locus_complement'])
geno.addPartsToVSLC(vslc_colony, allele_accession_id, None, geno.zygosity['indeterminate'],
geno.object_properties['has_alternate_part'])
gu.addTriple(g, colony_id, geno.object_properties['has_genotype'], vslc_colony)
############## BUILD THE ANNOTATED GENOTYPE #############
# now, we'll build the genotype of the individual that derives from the colony/clone
# genotype that is attached to phenotype = colony_id + strain + zygosity + sex
# (and is derived from a colony)
genotype_id = self.make_id((colony_id+phenotyping_center+zygosity+strain_accession_id))
geno.addDerivesFrom(genotype_id, colony_id)
# as with MGI, the allele is the variant locus. IF the marker is not known, we will call it a
# sequence alteration. otherwise, we will create a BNode for the sequence alteration.
sequence_alteration_id = variant_locus_id = variant_locus_name = sequence_alteration_name = None
# extract out what's within the <> to get the symbol
if re.match('.*<.*>', allele_symbol):
sequence_alteration_name = re.match('.*<(.*)>', allele_symbol).group(1)
else:
sequence_alteration_name = allele_symbol
if marker_accession_id is not None and marker_accession_id != '':
variant_locus_id = allele_accession_id
#.........这里部分代码省略.........