当前位置: 首页>>代码示例>>Python>>正文


Python GenomeAnnotationAPI.get_proteins方法代码示例

本文整理汇总了Python中doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI.get_proteins方法的典型用法代码示例。如果您正苦于以下问题:Python GenomeAnnotationAPI.get_proteins方法的具体用法?Python GenomeAnnotationAPI.get_proteins怎么用?Python GenomeAnnotationAPI.get_proteins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI的用法示例。


在下文中一共展示了GenomeAnnotationAPI.get_proteins方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_proteins

# 需要导入模块: from doekbase.data_api.annotation.genome_annotation.api import GenomeAnnotationAPI [as 别名]
# 或者: from doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI import get_proteins [as 别名]
    def get_proteins(self, ctx, ref):
        """
        Retrieve Protein data.
        @return Mapping from protein ID to data about the protein.
        :param ref: instance of type "ObjectReference"
        :returns: instance of mapping from String to type "Protein_data" ->
           structure: parameter "protein_id" of String, parameter
           "protein_amino_acid_sequence" of String, parameter
           "protein_function" of String, parameter "protein_aliases" of list
           of String, parameter "protein_md5" of String, parameter
           "protein_domain_locations" of list of String
        """
        # ctx is the context object
        # return variables are: returnVal
        #BEGIN get_proteins
        ga = GenomeAnnotationAPI_local(self.services, ctx['token'], ref)
        returnVal = ga.get_proteins()
        #END get_proteins

        # At some point might do deeper type checking...
        if not isinstance(returnVal, dict):
            raise ValueError('Method get_proteins return value ' +
                             'returnVal is not type dict as required.')
        # return the results
        return [returnVal]
开发者ID:msneddon,项目名称:genome_annotation_api,代码行数:27,代码来源:GenomeAnnotationAPIImpl.py

示例2: proteins_to_fasta

# 需要导入模块: from doekbase.data_api.annotation.genome_annotation.api import GenomeAnnotationAPI [as 别名]
# 或者: from doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI import get_proteins [as 别名]
def proteins_to_fasta(ws_url='https://ci.kbase.us/services/ws/'):
    """Write FASTA file from a genome reference.

    Args:
        ws_url: Workspace service URL

    Returns:
        Full path to output file
    """
    ref = "ReferenceGenomeAnnotations/kb|g.166819"
    # ref = "ReferenceGenomeAnnotations/kb|g.3899"
    genome_annotation = GenomeAnnotationAPI(
        token=os.environ.get('KB_AUTH_TOKEN'), services={
            'workspace_service_url': ws_url}, ref=ref)

    # Get all the proteins with the Data API
    proteins = genome_annotation.get_proteins()
    # Create an output file and write to it
    outfile = '/tmp/166819_prot.fasta'
    with open(outfile, 'w') as f:
        for fasta_line in get_fasta(proteins):
            f.write(fasta_line)

    return outfile
开发者ID:kbase,项目名称:data_api,代码行数:26,代码来源:genome_annotation_api.py

示例3:

# 需要导入模块: from doekbase.data_api.annotation.genome_annotation.api import GenomeAnnotationAPI [as 别名]
# 或者: from doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI import get_proteins [as 别名]
		gto['contigobj']['source_id'] = extsource["external_source_id"]
		gto['contigobj']['name'] = extsource["external_source_id"]
		gto['source'] = extsource["external_source"]
		gto['source_id'] = extsource["external_source_id"]
	except Exception, e:
		success = 0
		
features = [];
success = 0;
try:
	features = ga.get_features();
	success = 1
except Exception, e:
	success = 0

prot = ga.get_proteins();

if success == 1:
	for ftrid in features.keys():
		ftrdata = features[ftrid]
		if 'feature_type' in ftrdata.keys():
			newfeature = {'id' : ftrid,'type' : ftrdata['feature_type'],'function' : "Unknown",'location' : []}
			array = ftrid.split("_");
			protid = 'protein_'+array[1];
			if array[0] == 'CDS' and protid in prot.keys():
				newfeature['protein_translation'] = prot[protid]['protein_amino_acid_sequence']
			if 'feature_ontology_terms' in ftrdata.keys():
				newfeature['ontology_terms'] = ftrdata['feature_ontology_terms']
			if 'feature_function' in ftrdata.keys():
				newfeature['function'] = ftrdata['feature_function']
			if 'feature_dna_sequence' in ftrdata.keys():
开发者ID:mdejongh,项目名称:MEModeling,代码行数:33,代码来源:get_genome.py


注:本文中的doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI.get_proteins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。