comparison fam/fam.py @ 1:0e9c114c748f draft default tip

planemo upload for repository https://github.com/CPGRZA/cpgr_ancestry/tree/master/datatypes/plink_datatypes commit d0354c6155e1a44aab9c2fecf7a1a7f9e4bb22de
author sanbi-uwc
date Thu, 30 Aug 2018 07:41:55 -0400
parents 57bd7c6a72cd
children
comparison
equal deleted inserted replaced
0:57bd7c6a72cd 1:0e9c114c748f
1 # -*- coding: utf-8 -*-
2 from galaxy import eggs
3
4
5 import pkg_resources
6 pkg_resources.require( "bx-python" )
7
8
9 import logging, os, sys, time, sets, tempfile, shutil
10 import data
11 from galaxy import util
12 from galaxy.datatypes.sniff import *
13 from cgi import escape
14 import urllib
15 from bx.intervals.io import *
16 from galaxy.datatypes import metadata
17 from galaxy.datatypes.metadata import MetadataElement
18 from galaxy.datatypes.tabular import Tabular
19
20
21 class Fam( Tabular ):
22 """Tab delimited data in bim format"""
23 file_ext = "fam"
24
25 MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True )
26
27
28 def __init__ (self, **kwd):
29 """Initialize bim datatype"""
30 Tabular. __init__ (self, **kwd)
31 self.do_something_else()
32
33
34 def init_meta( self, dataset, copy_from=None ):
35 Tabular.init_meta( self, dataset, copy_from=copy_from )
36 if elems_len == 8:
37 try:
38 map( int, [hdr[6], hdr[7]] )
39 proceed = True
40 except:
41 pass
42
43
44 def sniff( self, filename ):
45 headers = get_headers( filename, '\t' )
46 try:
47 if len(headers) < 2:
48 return False
49 for hdr in headers:
50 if len( hdr ) > 1 and hdr[0] and not hdr[0].startswith( '#' ):
51 if len(hdr) != 8:
52 return False
53 try:
54 map( int, [hdr[6], hdr[7]] )
55 except:
56 return False
57 # Do other necessary checking here...
58 except:
59 return False
60 # If we haven't yet returned False, then...
61 return True