本文整理汇总了Python中doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI.get_assembly方法的典型用法代码示例。如果您正苦于以下问题:Python GenomeAnnotationAPI.get_assembly方法的具体用法?Python GenomeAnnotationAPI.get_assembly怎么用?Python GenomeAnnotationAPI.get_assembly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI
的用法示例。
在下文中一共展示了GenomeAnnotationAPI.get_assembly方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_fasta
# 需要导入模块: from doekbase.data_api.annotation.genome_annotation.api import GenomeAnnotationAPI [as 别名]
# 或者: from doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI import get_assembly [as 别名]
def generate_fasta(logger,internal_services,token,ref,output_dir,obj_name):
try:
ga = GenomeAnnotationAPI(internal_services,
token=token,
ref= "{}/{}".format(ref,obj_name))
except Exception as e:
raise Exception("Unable to Call GenomeAnnotationAPI : {0}: {1}".format(e))
logger.info("Generating FASTA file from Assembly for {}/{}".format(ref,obj_name))
fasta_start = datetime.datetime.utcnow()
output_file = os.path.join(output_dir,'{}.fasta'.format(obj_name))
with open(output_file, 'w') as fasta_file:
ga.get_assembly().get_fasta().to_file(fasta_file)
fasta_file.close()
fasta_end = datetime.datetime.utcnow()
logger.info("Generating FASTA for {} took {}".format(obj_name, fasta_end - fasta_start))
return output_file
示例2: generate_fasta
# 需要导入模块: from doekbase.data_api.annotation.genome_annotation.api import GenomeAnnotationAPI [as 别名]
# 或者: from doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI import get_assembly [as 别名]
def generate_fasta(logger,internal_services,token,ref,output_dir,obj_name):
try:
ga = GenomeAnnotationAPI(internal_services,
token=token,
ref= ref)
except Exception as e:
raise Exception("Unable to Call GenomeAnnotationAPI : {0}".format("".join(traceback.format_exc())))
logger.info("Generating FASTA file from Assembly for {}".format(obj_name))
fasta_start = datetime.datetime.utcnow()
output_file = os.path.join(output_dir,'{}.fasta'.format(obj_name))
fasta_file= io.open(output_file, 'wb')
try:
ga.get_assembly().get_fasta().to_file(fasta_file)
except Exception as e:
#raise Exception("Unable to Create FASTA file from Genome Annotation : {0}".format(obj_name))
raise Exception("Unable to Create FASTA file from Genome Annotation : {0}".format("".join(traceback.format_exc())))
finally:
fasta_file.close()
fasta_end = datetime.datetime.utcnow()
logger.info("Generating FASTA for {} took {}".format(obj_name, fasta_end - fasta_start))
return output_file
示例3: get_assembly
# 需要导入模块: from doekbase.data_api.annotation.genome_annotation.api import GenomeAnnotationAPI [as 别名]
# 或者: from doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI import get_assembly [as 别名]
def get_assembly(self, ctx, ref):
"""
Retrieve the Assembly associated with this GenomeAnnotation.
@return Reference to AssemblyAPI object
:param ref: instance of type "ObjectReference"
:returns: instance of type "ObjectReference"
"""
# ctx is the context object
# return variables are: returnVal
#BEGIN get_assembly
ga = GenomeAnnotationAPI_local(self.services, ctx['token'], ref)
returnVal = ga.get_assembly(ref_only=True)
#END get_assembly
# At some point might do deeper type checking...
if not isinstance(returnVal, basestring):
raise ValueError('Method get_assembly return value ' +
'returnVal is not type basestring as required.')
# return the results
return [returnVal]
示例4:
# 需要导入模块: from doekbase.data_api.annotation.genome_annotation.api import GenomeAnnotationAPI [as 别名]
# 或者: from doekbase.data_api.annotation.genome_annotation.api.GenomeAnnotationAPI import get_assembly [as 别名]
gto['domain'] = taxon.get_domain()
except Exception, e:
success = 0
try:
gto['genetic_code'] = taxon.get_genetic_code()
except Exception, e:
success = 0
try:
gto['taxonomy'] = ",".join(taxon.get_scientific_lineage())
except Exception, e:
success = 0
assemb = {};
success = 0;
try:
assemb = ga.get_assembly();
success = 1;
except Exception, e:
success = 0
if success == 1:
gto['contigobj'] = {
'id' : sys.argv[6],
'name' : sys.argv[6],
'source' : 'KBase',
'source_id' : sys.argv[6],
'md5' : "",
'type' : "Genome",
'contigs' : []
};