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


Python Text.set_meta方法代码示例

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


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

示例1: set_meta

# 需要导入模块: from galaxy.datatypes.data import Text [as 别名]
# 或者: from galaxy.datatypes.data.Text import set_meta [as 别名]
 def set_meta( self, dataset, **kwd ):
     Text.set_meta(self, dataset, **kwd )
     data_dir = dataset.extra_files_path
     ## search data_dir/genome_version for files
     regulation_pattern = 'regulation_(.+).bin'
     #  annotation files that are included in snpEff by a flag
     annotations_dict = {'nextProt.bin' : '-nextprot','motif.bin': '-motif'}
     regulations = []
     annotations = []
     if data_dir and os.path.isdir(data_dir):
         for root, dirs, files in os.walk(data_dir):
             for fname in files:
                 if fname.startswith('snpEffectPredictor'):
                     # if snpEffectPredictor.bin download succeeded
                     genome_version = os.path.basename(root)
                     dataset.metadata.genome_version = genome_version
                 else:
                     m = re.match(regulation_pattern,fname)
                     if m:
                         name = m.groups()[0]
                         regulations.append(name)
                     elif fname in annotations_dict:
                         value = annotations_dict[fname]
                         name = value.lstrip('-')
                         annotations.append(name)
         dataset.metadata.regulation = regulations
         dataset.metadata.annotation = annotations
开发者ID:TorHou,项目名称:galaxytools,代码行数:29,代码来源:snpeff.py

示例2: set_meta

# 需要导入模块: from galaxy.datatypes.data import Text [as 别名]
# 或者: from galaxy.datatypes.data.Text import set_meta [as 别名]
 def set_meta( self, dataset, **kwd ):
     Text.set_meta(self, dataset, **kwd )
     data_dir = dataset.extra_files_path
     # search data_dir/genome_version for files
     regulation_pattern = 'regulation_(.+).bin'
     #  annotation files that are included in snpEff by a flag
     annotations_dict = {'nextProt.bin' : '-nextprot', 'motif.bin': '-motif'}
     regulations = []
     annotations = []
     genome_version = None
     snpeff_version = None
     if data_dir and os.path.isdir(data_dir):
         for root, dirs, files in os.walk(data_dir):
             for fname in files:
                 if fname.startswith('snpEffectPredictor'):
                     # if snpEffectPredictor.bin download succeeded
                     genome_version = os.path.basename(root)
                     dataset.metadata.genome_version = genome_version
                     # read the first line of the gzipped snpEffectPredictor.bin file to get the SnpEff version
                     snpeff_version = self.getSnpeffVersionFromFile(os.path.join(root, fname))
                     if snpeff_version:
                         dataset.metadata.snpeff_version = snpeff_version
                 else:
                     m = re.match(regulation_pattern, fname)
                     if m:
                         name = m.groups()[0]
                         regulations.append(name)
                     elif fname in annotations_dict:
                         value = annotations_dict[fname]
                         name = value.lstrip('-')
                         annotations.append(name)
         dataset.metadata.regulation = regulations
         dataset.metadata.annotation = annotations
         try:
             fh = file(dataset.file_name, 'w')
             fh.write("%s\n" % genome_version if genome_version else 'Genome unknown')
             fh.write("%s\n" % snpeff_version if snpeff_version else 'SnpEff version unknown')
             if annotations:
                 fh.write("annotations: %s\n" % ','.join(annotations))
             if regulations:
                 fh.write("regulations: %s\n" % ','.join(regulations))
             fh.close()
         except:
             pass
开发者ID:Guangyou,项目名称:galaxy,代码行数:46,代码来源:text.py

示例3: set_meta

# 需要导入模块: from galaxy.datatypes.data import Text [as 别名]
# 或者: from galaxy.datatypes.data.Text import set_meta [as 别名]
 def set_meta(self, dataset, **kwd):
     Text.set_meta(self, dataset, **kwd)
     data_dir = dataset.extra_files_path
     ## search data_dir/genome_version for files
     regulation_pattern = "regulation_(.+).bin"
     #  annotation files that are included in snpEff by a flag
     annotations_dict = {"nextProt.bin": "-nextprot", "motif.bin": "-motif"}
     regulations = []
     annotations = []
     if data_dir and os.path.isdir(data_dir):
         for root, dirs, files in os.walk(data_dir):
             for fname in files:
                 if fname.startswith("snpEffectPredictor"):
                     # if snpEffectPredictor.bin download succeeded
                     genome_version = os.path.basename(root)
                     dataset.metadata.genome_version = genome_version
                 else:
                     m = re.match(regulation_pattern, fname)
                     if m:
                         name = m.groups()[0]
                         regulations.append(name)
                     elif fname in annotations_dict:
                         value = annotations_dict[fname]
                         name = value.lstrip("-")
                         annotations.append(name)
         dataset.metadata.regulation = regulations
         dataset.metadata.annotation = annotations
         try:
             fh = file(dataset.file_name, "w")
             fh.write("%s\n" % genome_version)
             if annotations:
                 fh.write("annotations: %s\n" % ",".join(annotations))
             if regulations:
                 fh.write("regulations: %s\n" % ",".join(regulations))
             fh.close()
         except:
             pass
开发者ID:Christian-B,项目名称:galaxy,代码行数:39,代码来源:text.py


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