Mercurial > repos > sanbi-uwc > plink_datatypes
changeset 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 | |
files | fam/fam.py |
diffstat | 1 files changed, 61 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/fam/fam.py Wed Aug 29 08:26:08 2018 -0400 +++ b/fam/fam.py Thu Aug 30 07:41:55 2018 -0400 @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +from galaxy import eggs + + +import pkg_resources +pkg_resources.require( "bx-python" ) + + +import logging, os, sys, time, sets, tempfile, shutil +import data +from galaxy import util +from galaxy.datatypes.sniff import * +from cgi import escape +import urllib +from bx.intervals.io import * +from galaxy.datatypes import metadata +from galaxy.datatypes.metadata import MetadataElement +from galaxy.datatypes.tabular import Tabular + + +class Fam( Tabular ): + """Tab delimited data in bim format""" + file_ext = "fam" + + MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True ) + + + def __init__ (self, **kwd): + """Initialize bim datatype""" + Tabular. __init__ (self, **kwd) + self.do_something_else() + + + def init_meta( self, dataset, copy_from=None ): + Tabular.init_meta( self, dataset, copy_from=copy_from ) + if elems_len == 8: + try: + map( int, [hdr[6], hdr[7]] ) + proceed = True + except: + pass + + + def sniff( self, filename ): + headers = get_headers( filename, '\t' ) + try: + if len(headers) < 2: + return False + for hdr in headers: + if len( hdr ) > 1 and hdr[0] and not hdr[0].startswith( '#' ): + if len(hdr) != 8: + return False + try: + map( int, [hdr[6], hdr[7]] ) + except: + return False + # Do other necessary checking here... + except: + return False + # If we haven't yet returned False, then... + return True \ No newline at end of file