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


Python Tabular.set_meta方法代码示例

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


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

示例1: set_meta

# 需要导入模块: from galaxy.datatypes.tabular import Tabular [as 别名]
# 或者: from galaxy.datatypes.tabular.Tabular import set_meta [as 别名]
 def set_meta( self, dataset, overwrite = True, **kwd ):
     """Sets the metadata information for datasets previously determined to be in bed format."""
     i = 0
     if dataset.has_data():
         for i, line in enumerate( file(dataset.file_name) ):
             metadata_set = False
             line = line.rstrip('\r\n')
             if line and not line.startswith('#'):
                 elems = line.split('\t')
                 if len(elems) > 2:
                     for startswith in data.col1_startswith:
                         if line.lower().startswith( startswith ):
                             if len( elems ) > 3:
                                 if overwrite or not dataset.metadata.element_is_set( 'nameCol' ):
                                     dataset.metadata.nameCol = 4
                             if len(elems) < 6:
                                 if overwrite or not dataset.metadata.element_is_set( 'strandCol' ):
                                     dataset.metadata.strandCol = 0
                             else:
                                 if overwrite or not dataset.metadata.element_is_set( 'strandCol' ):
                                     dataset.metadata.strandCol = 6
                             metadata_set = True
                             break
             if metadata_set: break
         Tabular.set_meta( self, dataset, overwrite = overwrite, skip = i )
开发者ID:dbcls,项目名称:dbcls-galaxy,代码行数:27,代码来源:interval.py

示例2: set_meta

# 需要导入模块: from galaxy.datatypes.tabular import Tabular [as 别名]
# 或者: from galaxy.datatypes.tabular.Tabular import set_meta [as 别名]
 def set_meta(self, dataset, **kwd):
     Tabular.set_meta(self, dataset, **kwd)
     dataset.metadata.markerCol = 1
     header = open(dataset.file_name, 'r').readlines()[0].strip().split('\t')
     dataset.metadata.columns = len(header)
     t = ['numeric' for x in header]
     t[0] = 'string'
     dataset.metadata.column_types = t
     return True
开发者ID:ImmPortDB,项目名称:immport-galaxy,代码行数:11,代码来源:genetics.py

示例3: set_meta

# 需要导入模块: from galaxy.datatypes.tabular import Tabular [as 别名]
# 或者: from galaxy.datatypes.tabular.Tabular import set_meta [as 别名]
    def set_meta(self, dataset, overwrite=True, skip=None, max_data_lines=None, **kwd):
        Tabular.set_meta(self, dataset, overwrite, skip, max_data_lines)
        tis_args = set()
        try:
            fh = open(dataset.file_name)

            for line in fh:
                fields = line.strip().split("\t")
                try:
                    tis_args.add(fields[0])
                except IndexError:
                    pass
            dataset.metadata.args = []
            dataset.metadata.args += tis_args

        finally:
            fh.close()
开发者ID:Biobix,项目名称:proteoformer,代码行数:19,代码来源:proteoformer.py

示例4: set_meta

# 需要导入模块: from galaxy.datatypes.tabular import Tabular [as 别名]
# 或者: from galaxy.datatypes.tabular.Tabular import set_meta [as 别名]
 def set_meta( self, dataset, **kwd ):
     Tabular.set_meta( self, dataset, **kwd )
开发者ID:MateusBellomo,项目名称:tools-galaxyp,代码行数:4,代码来源:pepxml_datatypes.py

示例5: set_meta

# 需要导入模块: from galaxy.datatypes.tabular import Tabular [as 别名]
# 或者: from galaxy.datatypes.tabular.Tabular import set_meta [as 别名]
 def set_meta( self, dataset, overwrite = True, first_line_is_header = False, **kwd ):
     Tabular.set_meta( self, dataset, overwrite = overwrite, skip = 0 )
     
     """Tries to guess from the line the location number of the column for the chromosome, region start-end and strand"""
     if dataset.has_data():
         empty_line_count = 0
         num_check_lines = 100 # only check up to this many non empty lines
         for i, line in enumerate( file( dataset.file_name ) ):
             line = line.rstrip( '\r\n' )
             if line:
                 if ( first_line_is_header or line[0] == '#' ):
                     self.init_meta( dataset )
                     line = line.strip( '#' )
                     elems = line.split( '\t' )
                     valid = dict( alias_helper ) # shrinks
                     for index, col_name in enumerate( elems ):
                         if col_name in valid:
                             meta_name = valid[col_name]
                             if overwrite or not dataset.metadata.element_is_set( meta_name ):
                                 setattr( dataset.metadata, meta_name, index+1 )
                             values = alias_spec[ meta_name ]
                             start = values.index( col_name )
                             for lower in values[ start: ]:
                                 del valid[ lower ]  # removes lower priority keys 
                     break  # Our metadata is set, so break out of the outer loop
                 else: 
                     # Header lines in Interval files are optional. For example, BED is Interval but has no header.
                     # We'll make a best guess at the location of the metadata columns.
                     metadata_is_set = False
                     elems = line.split( '\t' )
                     if len( elems ) > 2:
                         for str in data.col1_startswith:
                             if line.lower().startswith( str ):
                                 if overwrite or not dataset.metadata.element_is_set( 'chromCol' ):
                                     dataset.metadata.chromCol = 1
                                 try:
                                     int( elems[1] )
                                     if overwrite or not dataset.metadata.element_is_set( 'startCol' ):
                                         dataset.metadata.startCol = 2
                                 except:
                                     pass # Metadata default will be used
                                 try:
                                     int( elems[2] )
                                     if overwrite or not dataset.metadata.element_is_set( 'endCol' ):
                                         dataset.metadata.endCol = 3
                                 except:
                                     pass # Metadata default will be used
                                 #we no longer want to guess that this column is the 'name', name must now be set manually for interval files
                                 #we will still guess at the strand, as we can make a more educated guess
                                 #if len( elems ) > 3:
                                 #    try:
                                 #        int( elems[3] )
                                 #    except:
                                 #        if overwrite or not dataset.metadata.element_is_set( 'nameCol' ):
                                 #            dataset.metadata.nameCol = 4 
                                 if len( elems ) < 6 or elems[5] not in data.valid_strand:
                                     if overwrite or not dataset.metadata.element_is_set(  'strandCol' ):
                                         dataset.metadata.strandCol = 0
                                 else:
                                     if overwrite or not dataset.metadata.element_is_set( 'strandCol' ):
                                         dataset.metadata.strandCol = 6
                                 metadata_is_set = True
                                 break
                     if metadata_is_set or ( i - empty_line_count ) > num_check_lines:
                         break # Our metadata is set or we examined 100 non-empty lines, so break out of the outer loop
             else:
                 empty_line_count += 1
开发者ID:msGenDev,项目名称:Yeps-EURAC,代码行数:69,代码来源:interval.py

示例6: set_meta

# 需要导入模块: from galaxy.datatypes.tabular import Tabular [as 别名]
# 或者: from galaxy.datatypes.tabular.Tabular import set_meta [as 别名]
 def set_meta( self, dataset, overwrite = True, **kwd ):
     Tabular.set_meta( self, dataset, overwrite=overwrite, max_data_lines=None, max_guess_type_data_lines=1000, **kwd )
     if dataset.metadata.comment_metadata is None:
         dataset_comment_metadata = DatasetCommentMetadata( dataset )
         dataset.metadata.comment_metadata = dataset_comment_metadata.comment_metadata.copy()
         self.set_dataset_metadata_from_comments( dataset )
开发者ID:gigascience,项目名称:galaxy-genome-diversity,代码行数:8,代码来源:wsf.py


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