idx int64 0 252k | question stringlengths 48 5.28k | target stringlengths 5 1.23k |
|---|---|---|
4,800 | def _read ( self , directory , filename , session , path , name , extension , spatial , spatialReferenceID , replaceParamFile ) : self . fileExtension = extension with open ( path , 'r' ) as orthoFile : for line in orthoFile : sline = line . strip ( ) . split ( ) if sline [ 0 ] . lower ( ) == 'num_sites:' : self . numS... | Orographic Gage File Read from File Method |
4,801 | def _write ( self , session , openFile , replaceParamFile ) : openFile . write ( 'Num_Sites: %s\n' % self . numSites ) openFile . write ( 'Elev_Base %s\n' % self . elevBase ) openFile . write ( 'Elev_2 %s\n' % self . elev2 ) openFile . write ( 'Year Month Day Hour Temp_2\n' ) measurements = se... | Orographic Gage File Write to File Method |
4,802 | def getFluvialLinks ( self ) : fluvialTypeKeywords = ( 'TRAPEZOID' , 'TRAP' , 'BREAKPOINT' , 'ERODE' , 'SUBSURFACE' ) fluvialLinks = [ ] for link in self . streamLinks : for fluvialTypeKeyword in fluvialTypeKeywords : if fluvialTypeKeyword in link . type : fluvialLinks . append ( link ) break return fluvialLinks | Retrieve only the links that represent fluvial portions of the stream . Returns a list of StreamLink instances . |
4,803 | def getOrderedLinks ( self , session ) : streamLinks = session . query ( StreamLink ) . filter ( StreamLink . channelInputFile == self ) . order_by ( StreamLink . linkNumber ) . all ( ) return streamLinks | Retrieve the links in the order of the link number . |
4,804 | def getStreamNetworkAsWkt ( self , session , withNodes = True ) : wkt_list = [ ] for link in self . streamLinks : wkt_link = link . getAsWkt ( session ) if wkt_link : wkt_list . append ( wkt_link ) if withNodes : for node in link . nodes : wkt_node = node . getAsWkt ( session ) if wkt_node : wkt_list . append ( wkt_nod... | Retrieve the stream network geometry in Well Known Text format . |
4,805 | def getStreamNetworkAsGeoJson ( self , session , withNodes = True ) : features_list = [ ] for link in self . streamLinks : link_geoJson = link . getAsGeoJson ( session ) if link_geoJson : link_geometry = json . loads ( link . getAsGeoJson ( session ) ) link_properties = { "link_number" : link . linkNumber , "type" : li... | Retrieve the stream network geometry in GeoJSON format . |
4,806 | def _read ( self , directory , filename , session , path , name , extension , spatial , spatialReferenceID , replaceParamFile ) : self . fileExtension = extension KEYWORDS = { 'ALPHA' : cic . cardChunk , 'BETA' : cic . cardChunk , 'THETA' : cic . cardChunk , 'LINKS' : cic . cardChunk , 'MAXNODES' : cic . cardChunk , 'C... | Channel Input File Read from File Method |
4,807 | def _write ( self , session , openFile , replaceParamFile ) : openFile . write ( 'GSSHA_CHAN\n' ) alpha = vwp ( self . alpha , replaceParamFile ) try : openFile . write ( 'ALPHA%s%.6f\n' % ( ' ' * 7 , alpha ) ) except : openFile . write ( 'ALPHA%s%s\n' % ( ' ' * 7 , alpha ) ) beta = vwp ( self . beta , replaceParamFile... | Channel Input File Write to File Method |
4,808 | def _createLink ( self , linkResult , replaceParamFile ) : link = None if linkResult [ 'type' ] == 'XSEC' : link = self . _createCrossSection ( linkResult , replaceParamFile ) elif linkResult [ 'type' ] == 'STRUCTURE' : link = self . _createStructure ( linkResult , replaceParamFile ) elif linkResult [ 'type' ] in ( 'RE... | Create GSSHAPY Link Object Method |
4,809 | def _createConnectivity ( self , linkList , connectList ) : for idx , link in enumerate ( linkList ) : connectivity = connectList [ idx ] for upLink in connectivity [ 'upLinks' ] : upstreamLink = UpstreamLink ( upstreamLinkID = int ( upLink ) ) upstreamLink . streamLink = link link . downstreamLinkID = int ( connectivi... | Create GSSHAPY Connect Object Method |
4,810 | def _createCrossSection ( self , linkResult , replaceParamFile ) : header = linkResult [ 'header' ] link = StreamLink ( linkNumber = int ( header [ 'link' ] ) , type = header [ 'xSecType' ] , numElements = header [ 'nodes' ] , dx = vrp ( header [ 'dx' ] , replaceParamFile ) , erode = header [ 'erode' ] , subsurface = h... | Create GSSHAPY Cross Section Objects Method |
4,811 | def _createStructure ( self , linkResult , replaceParamFile ) : WEIRS = ( 'WEIR' , 'SAG_WEIR' ) CULVERTS = ( 'ROUND_CULVERT' , 'RECT_CULVERT' ) CURVES = ( 'RATING_CURVE' , 'SCHEDULED_RELEASE' , 'RULE_CURVE' ) header = linkResult [ 'header' ] link = StreamLink ( linkNumber = header [ 'link' ] , type = linkResult [ 'type... | Create GSSHAPY Structure Objects Method |
4,812 | def _createReservoir ( self , linkResult , replaceParamFile ) : header = linkResult [ 'header' ] if linkResult [ 'type' ] == 'LAKE' : initWSE = vrp ( header [ 'initwse' ] , replaceParamFile ) minWSE = vrp ( header [ 'minwse' ] , replaceParamFile ) maxWSE = vrp ( header [ 'maxwse' ] , replaceParamFile ) numPts = header ... | Create GSSHAPY Reservoir Objects Method |
4,813 | def _createGeometry ( self , session , spatialReferenceID ) : session . flush ( ) for link in self . getFluvialLinks ( ) : nodes = link . nodes nodeCoordinates = [ ] for node in nodes : coordinates = '{0} {1} {2}' . format ( node . x , node . y , node . elevation ) nodeCoordinates . append ( coordinates ) wktPoint = 'P... | Create PostGIS geometric objects |
4,814 | def _writeConnectivity ( self , links , fileObject ) : for link in links : linkNum = link . linkNumber downLink = link . downstreamLinkID numUpLinks = link . numUpstreamLinks upLinks = '' for upLink in link . upstreamLinks : upLinks = '{}{:>5}' . format ( upLinks , str ( upLink . upstreamLinkID ) ) line = 'CONNECT{:>5}... | Write Connectivity Lines to File Method |
4,815 | def _writeLinks ( self , links , fileObject , replaceParamFile ) : for link in links : linkType = link . type fileObject . write ( 'LINK %s\n' % link . linkNumber ) if 'TRAP' in linkType or 'TRAPEZOID' in linkType or 'BREAKPOINT' in linkType : self . _writeCrossSectionLink ( link , fileObject , replaceParamFi... | Write Link Lines to File Method |
4,816 | def _writeCrossSectionLink ( self , link , fileObject , replaceParamFile ) : linkType = link . type dx = vwp ( link . dx , replaceParamFile ) try : fileObject . write ( 'DX %.6f\n' % dx ) except : fileObject . write ( 'DX %s\n' % dx ) fileObject . write ( '%s\n' % linkType ) fileObject . write (... | Write Cross Section Link to File Method |
4,817 | def _writeOptionalXsecCards ( self , fileObject , xSec , replaceParamFile ) : if xSec . erode : fileObject . write ( 'ERODE\n' ) if xSec . maxErosion != None : fileObject . write ( 'MAX_EROSION %.6f\n' % xSec . maxErosion ) if xSec . subsurface : fileObject . write ( 'SUBSURFACE\n' ) if xSec . mRiver != None : mRive... | Write Optional Cross Section Cards to File Method |
4,818 | def replace_file ( from_file , to_file ) : try : os . remove ( to_file ) except OSError : pass copy ( from_file , to_file ) | Replaces to_file with from_file |
4,819 | def _prepare_lsm_gag ( self ) : lsm_required_vars = ( self . lsm_precip_data_var , self . lsm_precip_type ) return self . lsm_input_valid and ( None not in lsm_required_vars ) | Determines whether to prepare gage data from LSM |
4,820 | def _update_card_file_location ( self , card_name , new_directory ) : with tmp_chdir ( self . gssha_directory ) : file_card = self . project_manager . getCard ( card_name ) if file_card : if file_card . value : original_location = file_card . value . strip ( "'" ) . strip ( '"' ) new_location = os . path . join ( new_d... | Moves card to new gssha working directory |
4,821 | def download_spt_forecast ( self , extract_directory ) : needed_vars = ( self . spt_watershed_name , self . spt_subbasin_name , self . spt_forecast_date_string , self . ckan_engine_url , self . ckan_api_key , self . ckan_owner_organization ) if None not in needed_vars : er_manager = ECMWFRAPIDDatasetManager ( self . ck... | Downloads Streamflow Prediction Tool forecast data |
4,822 | def prepare_hmet ( self ) : if self . _prepare_lsm_hmet : netcdf_file_path = None hmet_ascii_output_folder = None if self . output_netcdf : netcdf_file_path = '{0}_hmet.nc' . format ( self . project_manager . name ) if self . hotstart_minimal_mode : netcdf_file_path = '{0}_hmet_hotstart.nc' . format ( self . project_ma... | Prepare HMET data for simulation |
4,823 | def prepare_gag ( self ) : if self . _prepare_lsm_gag : self . event_manager . prepare_gag_lsm ( self . lsm_precip_data_var , self . lsm_precip_type , self . precip_interpolation_type ) self . simulation_modified_input_cards . append ( "PRECIP_FILE" ) else : log . info ( "Gage file preparation skipped due to missing pa... | Prepare gage data for simulation |
4,824 | def rapid_to_gssha ( self ) : if self . path_to_rapid_qout is None and self . connection_list_file : rapid_qout_directory = os . path . join ( self . gssha_directory , 'rapid_streamflow' ) try : os . mkdir ( rapid_qout_directory ) except OSError : pass self . path_to_rapid_qout = self . download_spt_forecast ( rapid_qo... | Prepare RAPID data for simulation |
4,825 | def hotstart ( self ) : if self . write_hotstart : hotstart_time_str = self . event_manager . simulation_end . strftime ( "%Y%m%d_%H%M" ) try : os . mkdir ( 'hotstart' ) except OSError : pass ov_hotstart_path = os . path . join ( '..' , 'hotstart' , '{0}_ov_hotstart_{1}.ovh' . format ( self . project_manager . name , h... | Prepare simulation hotstart info |
4,826 | def run_forecast ( self ) : self . prepare_hmet ( ) self . prepare_gag ( ) self . rapid_to_gssha ( ) self . hotstart ( ) return self . run ( ) | Updates card & runs for RAPID to GSSHA & LSM to GSSHA |
4,827 | def get_cache_key ( request , page , lang , site_id , title ) : from cms . cache import _get_cache_key from cms . templatetags . cms_tags import _get_page_by_untyped_arg from cms . models import Page if not isinstance ( page , Page ) : page = _get_page_by_untyped_arg ( page , request , site_id ) if not site_id : try : ... | Create the cache key for the current page and tag type |
4,828 | def get_page_tags ( page ) : from . models import PageTags try : return page . pagetags . tags . all ( ) except PageTags . DoesNotExist : return [ ] | Retrieves all the tags for a Page instance . |
4,829 | def page_has_tag ( page , tag ) : from . models import PageTags if hasattr ( tag , 'slug' ) : slug = tag . slug else : slug = tag try : return page . pagetags . tags . filter ( slug = slug ) . exists ( ) except PageTags . DoesNotExist : return False | Check if a Page object is associated with the given tag . |
4,830 | def title_has_tag ( page , lang , tag ) : from . models import TitleTags if hasattr ( tag , 'slug' ) : slug = tag . slug else : slug = tag try : return page . get_title_obj ( language = lang , fallback = False ) . titletags . tags . filter ( slug = slug ) . exists ( ) except TitleTags . DoesNotExist : return False | Check if a Title object is associated with the given tag . This function does not use fallbacks to retrieve title object . |
4,831 | def get_page_tags_from_request ( request , page_lookup , lang , site , title = False ) : from cms . templatetags . cms_tags import _get_page_by_untyped_arg from cms . utils import get_language_from_request , get_site_id from django . core . cache import cache try : from cms . utils import get_cms_setting except ImportE... | Get the list of tags attached to a Page or a Title from a request from usual page_lookup parameters . |
4,832 | def get_title_tags_from_request ( request , page_lookup , lang , site ) : return get_page_tags_from_request ( request , page_lookup , lang , site , True ) | Get the list of tags attached to a Title from a request from usual page_lookup parameters . |
4,833 | def generateFromWatershedShapefile ( self , shapefile_path , cell_size , out_raster_path = None , load_raster_to_db = True ) : if not self . projectFile : raise ValueError ( "Must be connected to project file ..." ) match_grid = None try : match_grid = self . projectFile . getGrid ( use_mask = False ) except ValueError... | Generates a mask from a watershed_shapefile |
4,834 | def tmp_chdir ( new_path ) : prev_cwd = os . getcwd ( ) os . chdir ( new_path ) try : yield finally : os . chdir ( prev_cwd ) | Change directory temporarily and return when done . |
4,835 | def _download ( self ) : min_x , max_x , min_y , max_y = self . gssha_grid . bounds ( as_geographic = True ) if self . era_download_data == 'era5' : log . info ( "Downloading ERA5 data ..." ) download_era5_for_gssha ( self . lsm_input_folder_path , self . download_start_datetime , self . download_end_datetime , leftlon... | download ERA5 data for GSSHA domain |
4,836 | def dispatch_request ( self , * args , ** kwargs ) : if request . method in ( 'POST' , 'PUT' ) : return_url , context = self . post ( * args , ** kwargs ) if return_url is not None : return redirect ( return_url ) elif request . method in ( 'GET' , 'HEAD' ) : context = self . get ( * args , ** kwargs ) return self . re... | Dispatch the request . Its the actual view flask will use . |
4,837 | def _run_cmd_get_output ( cmd ) : process = subprocess . Popen ( cmd . split ( ) , stdout = subprocess . PIPE ) out , err = process . communicate ( ) return out or err | Runs a shell command returns console output . |
4,838 | def _remote_github_url_to_string ( remote_url ) : match = re . search ( 'git@github\.com:(.*)\.git' , remote_url ) if not match : raise EnvironmentError ( 'Remote is not a valid github URL' ) identifier = match . group ( 1 ) return re . sub ( '\W' , ':' , identifier ) | Parse out the repository identifier from a github URL . |
4,839 | def _get_args ( args ) : parser = argparse . ArgumentParser ( description = 'A tool to extract features into a simple format.' , formatter_class = argparse . ArgumentDefaultsHelpFormatter , ) parser . add_argument ( '--no-cache' , action = 'store_true' ) parser . add_argument ( '--deploy' , action = 'store_true' ) pars... | Argparse logic lives here . |
4,840 | def run ( * extractor_list , ** kwargs ) : args = _get_args ( kwargs . get ( 'args' ) ) n_extractors = len ( extractor_list ) log . info ( 'Going to run list of {} FeatureExtractors' . format ( n_extractors ) ) collection = fex . Collection ( cache_path = args . cache_path ) for extractor in extractor_list : collection... | Parse arguments provided on the commandline and execute extractors . |
4,841 | def _delete_existing ( self , project_file , session ) : existing_elev = session . query ( RasterMapFile ) . filter ( RasterMapFile . projectFile == project_file ) . filter ( RasterMapFile . fileExtension == self . fileExtension ) . all ( ) if existing_elev : session . delete ( existing_elev ) session . commit ( ) | This will delete existing instances with the same extension |
4,842 | def _load_raster_text ( self , raster_path ) : with open ( raster_path , 'r' ) as f : self . rasterText = f . read ( ) lines = self . rasterText . split ( '\n' ) for line in lines [ 0 : 6 ] : spline = line . split ( ) if 'north' in spline [ 0 ] . lower ( ) : self . north = float ( spline [ 1 ] ) elif 'south' in spline ... | Loads grass ASCII to object |
4,843 | def _read ( self , directory , filename , session , path , name , extension , spatial , spatialReferenceID , replaceParamFile ) : self . fileExtension = extension self . filename = filename self . _load_raster_text ( path ) if spatial : wkbRaster = RasterLoader . grassAsciiRasterToWKB ( session = session , grassRasterP... | Raster Map File Read from File Method |
4,844 | def _write ( self , session , openFile , replaceParamFile ) : if self . raster is not None : converter = RasterConverter ( session ) grassAsciiGrid = converter . getAsGrassAsciiRaster ( rasterFieldName = 'raster' , tableName = self . __tablename__ , rasterIdFieldName = 'id' , rasterId = self . id ) openFile . write ( g... | Raster Map File Write to File Method |
4,845 | def write ( self , session , directory , name , replaceParamFile = None , ** kwargs ) : if self . raster is not None or self . rasterText is not None : super ( RasterMapFile , self ) . write ( session , directory , name , replaceParamFile , ** kwargs ) | Wrapper for GsshaPyFileObjectBase write method |
4,846 | def slugify ( value ) : s1 = first_cap_re . sub ( r'\1_\2' , value ) s2 = all_cap_re . sub ( r'\1_\2' , s1 ) return s2 . lower ( ) . replace ( ' _' , '_' ) . replace ( ' ' , '_' ) | Simple Slugify . |
4,847 | def entrypoint ( cls ) : if not isinstance ( cls , type ) or not issubclass ( cls , Command ) : raise TypeError ( f"inappropriate entrypoint instance of type {cls.__class__}" ) cls . _argcmdr_entrypoint_ = True return cls | Mark the decorated command as the intended entrypoint of the command module . |
4,848 | def store_env_override ( option_strings , dest , envvar , nargs = None , default = None , type = None , choices = None , description = None , help = None , metavar = None ) : if envvar == '' : raise ValueError ( "unsupported environment variable name" , envvar ) envvalue = os . getenv ( envvar ) if callable ( default )... | Construct an argparse action which stores the value of a command line option to override a corresponding value in the process environment . |
4,849 | def individual_dict ( self , ind_ids ) : ind_dict = { ind . ind_id : ind for ind in self . individuals ( ind_ids = ind_ids ) } return ind_dict | Return a dict with ind_id as key and Individual as values . |
4,850 | def clean ( ) : run ( 'rm -rf build/' ) run ( 'rm -rf dist/' ) run ( 'rm -rf puzzle.egg-info' ) run ( 'find . -name __pycache__ -delete' ) run ( 'find . -name *.pyc -delete' ) run ( 'find . -name *.pyo -delete' ) run ( 'find . -name *~ -delete' ) log . info ( 'cleaned up' ) | clean - remove build artifacts . |
4,851 | def zmq_sub ( bind , tables , forwarder = False , green = False ) : logger = logging . getLogger ( "meepo.sub.zmq_sub" ) if not isinstance ( tables , ( list , set ) ) : raise ValueError ( "tables should be list or set" ) if not green : import zmq else : import zmq . green as zmq ctx = zmq . Context ( ) socket = ctx . s... | 0mq fanout sub . |
4,852 | def add_case ( self , case_obj , vtype = 'snv' , mode = 'vcf' , ped_svg = None ) : new_case = Case ( case_id = case_obj . case_id , name = case_obj . name , variant_source = case_obj . variant_source , variant_type = vtype , variant_mode = mode , pedigree = ped_svg , compressed = case_obj . compressed , tabix_index = c... | Load a case with individuals . |
4,853 | def individuals ( self , ind_ids = None ) : query = self . query ( Individual ) if ind_ids : query = query . filter ( Individual . ind_id . in_ ( ind_ids ) ) return query | Fetch all individuals from the database . |
4,854 | def case_comments ( self ) : comments = ( comment for comment in self . comments if comment . variant_id is None ) return comments | Return only comments made on the case . |
4,855 | def put ( self , url , body = None , ** kwargs ) : return self . request ( 'put' , url , body = body , ** kwargs ) | Send a PUT request . |
4,856 | def event ( self , * topics , ** kwargs ) : workers = kwargs . pop ( "workers" , 1 ) multi = kwargs . pop ( "multi" , False ) queue_limit = kwargs . pop ( "queue_limit" , 10000 ) def wrapper ( func ) : for topic in topics : queues = [ Queue ( ) for _ in range ( workers ) ] hash_ring = ketama . Continuum ( ) for q in qu... | Topic callback registry . |
4,857 | def run ( self ) : for worker_pool in self . workers . values ( ) : worker_pool . start ( ) if isinstance ( self . listen , list ) : for i in self . listen : self . socket . connect ( i ) else : self . socket . connect ( self . listen ) try : while True : msg = self . socket . recv_string ( ) lst = msg . split ( ) if l... | Run the replicator . |
4,858 | def _pk ( self , obj ) : pk_values = tuple ( getattr ( obj , c . name ) for c in obj . __mapper__ . primary_key ) if len ( pk_values ) == 1 : return pk_values [ 0 ] return pk_values | Get pk values from object |
4,859 | def session_update ( self , session , * _ ) : self . _session_init ( session ) session . pending_write |= set ( session . new ) session . pending_update |= set ( session . dirty ) session . pending_delete |= set ( session . deleted ) self . logger . debug ( "%s - session_update" % session . meepo_unique_id ) | Record the sqlalchemy object states in the middle of session prepare the events for the final pub in session_commit . |
4,860 | def session_commit ( self , session ) : if not hasattr ( session , 'meepo_unique_id' ) : self . logger . debug ( "skipped - session_commit" ) return self . _session_pub ( session ) self . _session_del ( session ) | Pub the events after the session committed . |
4,861 | def add_basic_auth ( dolt , username , password ) : return dolt . with_headers ( Authorization = 'Basic %s' % base64 . b64encode ( '%s:%s' % ( username , password ) ) . strip ( ) ) | Send basic auth username and password . |
4,862 | def _add_genotypes ( self , variant_obj , gemini_variant , case_id , individual_objs ) : for ind in individual_objs : index = ind . ind_index variant_obj . add_individual ( Genotype ( sample_id = ind . ind_id , genotype = gemini_variant [ 'gts' ] [ index ] , case_id = case_id , phenotype = ind . phenotype , ref_depth =... | Add the genotypes for a variant for all individuals |
4,863 | def process_frames_argument ( frames ) : result = None if np . iterable ( frames ) : try : frames_arr = np . array ( frames ) except : raise TypeError ( "'frames' should be convertable to numpy.array" ) for idx in range ( len ( frames_arr ) ) : frame_idx = frames_arr [ idx ] assert is_real_number ( frame_idx ) assert i... | Check and process frames argument into a proper iterable for an animation object |
4,864 | def init ( ctx , reset , root , phenomizer ) : configs = { } if root is None : root = ctx . obj . get ( 'root' ) or os . path . expanduser ( "~/.puzzle" ) configs [ 'root' ] = root if os . path . isfile ( root ) : logger . error ( "'root' can't be a file" ) ctx . abort ( ) logger . info ( "Root directory is: {}" . form... | Initialize a database that store metadata |
4,865 | def encode ( value , encoding = 'utf-8' , encoding_errors = 'strict' ) : if isinstance ( value , bytes ) : return value if not isinstance ( value , basestring ) : value = str ( value ) if isinstance ( value , unicode ) : value = value . encode ( encoding , encoding_errors ) return value | Return a bytestring representation of the value . |
4,866 | def share_secret ( threshold , nshares , secret , identifier , hash_id = Hash . SHA256 ) : if identifier is None : raise TSSError ( 'an identifier must be provided' ) if not Hash . is_valid ( hash_id ) : raise TSSError ( 'invalid hash algorithm %s' % hash_id ) secret = encode ( secret ) identifier = encode ( identifier... | Create nshares of the secret . threshold specifies the number of shares needed for reconstructing the secret value . A 0 - 16 bytes identifier must be provided . Optionally the secret is hashed with the algorithm specified by hash_id a class attribute of Hash . This function must return a list of formatted shares or ra... |
4,867 | def get_gene_symbols ( chrom , start , stop ) : gene_symbols = query_gene_symbol ( chrom , start , stop ) logger . debug ( "Found gene symbols: {0}" . format ( ', ' . join ( gene_symbols ) ) ) return gene_symbols | Get the gene symbols that a interval overlaps |
4,868 | def get_gene_info ( ensembl_ids = None , hgnc_symbols = None ) : uniq_ensembl_ids = set ( ensembl_id for ensembl_id in ( ensembl_ids or [ ] ) ) uniq_hgnc_symbols = set ( hgnc_symbol for hgnc_symbol in ( hgnc_symbols or [ ] ) ) genes = [ ] gene_data = [ ] if uniq_ensembl_ids : for ensembl_id in uniq_ensembl_ids : for re... | Return the genes info based on the transcripts found |
4,869 | def get_most_severe_consequence ( transcripts ) : most_severe_consequence = None most_severe_score = None for transcript in transcripts : for consequence in transcript [ 'consequence' ] . split ( '&' ) : logger . debug ( "Checking severity score for consequence: {0}" . format ( consequence ) ) severity_score = SEVERITY... | Get the most severe consequence |
4,870 | def get_cytoband_coord ( chrom , pos ) : chrom = chrom . strip ( 'chr' ) pos = int ( pos ) result = None logger . debug ( "Finding Cytoband for chrom:{0} pos:{1}" . format ( chrom , pos ) ) if chrom in CYTOBANDS : for interval in CYTOBANDS [ chrom ] [ pos ] : result = "{0}{1}" . format ( chrom , interval . data ) retur... | Get the cytoband coordinate for a position |
4,871 | def parse_mapping ( self , map_path , source = None , dotfiles = None ) : include_re = r include_re = re . compile ( include_re , re . I ) mapping_re = r mapping_re = re . compile ( mapping_re ) filename = None map_path = path . realpath ( path . expanduser ( map_path ) ) if path . isfile ( map_path ) : filename = map_... | Do a simple parse of the dotfile mapping using semicolons to separate source file name from the target file paths . |
4,872 | def sh ( self , * command , ** kwargs ) : self . log . debug ( 'shell: %s' , ' ' . join ( command ) ) return subprocess . check_call ( ' ' . join ( command ) , stdout = sys . stdout , stderr = sys . stderr , stdin = sys . stdin , shell = True , ** kwargs ) | Run a shell command with the given arguments . |
4,873 | def scp ( self , local_file , remote_path = '' ) : if self . args . user : upload_spec = '{0}@{1}:{2}' . format ( self . args . user , self . args . server , remote_path ) else : upload_spec = '{0}:{1}' . format ( self . args . server , remote_path ) return self . sh ( 'scp' , local_file , upload_spec ) | Copy a local file to the given remote path . |
4,874 | def run ( self ) : script = path . realpath ( __file__ ) self . log . debug ( 'Running from %s with arguments: %s' , script , self . args ) if self . args . source : self . source = self . args . source else : self . source = path . dirname ( path . dirname ( script ) ) self . log . debug ( 'Sourcing dotfiles from %s' ... | Start the dotfile deployment process . |
4,875 | def load_dotfiles ( self ) : if self . args . map and path . exists ( self . args . map ) : dotfiles_path = self . args . map else : dotfiles_path = self . source self . log . debug ( 'Loading dotfile mapping from %s' , dotfiles_path ) return self . parse_mapping ( dotfiles_path , source = self . source ) | Read in the dotfile mapping as a dictionary . |
4,876 | def clone_repo ( self ) : tempdir_path = tempfile . mkdtemp ( ) if self . args . git : self . log . debug ( 'Cloning git source repository from %s to %s' , self . source , tempdir_path ) self . sh ( 'git clone' , self . source , tempdir_path ) else : raise NotImplementedError ( 'Unknown repo type' ) self . source = tem... | Clone a repository containing the dotfiles source . |
4,877 | def cleanup_repo ( self ) : if self . source and path . isdir ( self . source ) : self . log . debug ( 'Cleaning up source repo from %s' , self . source ) shutil . rmtree ( self . source ) | Cleanup the temporary directory containing the dotfiles repo . |
4,878 | def deploy_dotfiles ( self , dotfiles ) : if self . args . server : return self . deploy_remote ( dotfiles ) else : return self . deploy_local ( dotfiles ) | Deploy dotfiles using the appropriate method . |
4,879 | def deploy_remote ( self , dotfiles ) : tempfile_path = None tempdir_path = None try : tempdir_path = tempfile . mkdtemp ( ) self . log . debug ( 'Deploying to temp dir %s' , tempdir_path ) self . deploy_local ( dotfiles , target_root = tempdir_path ) if self . args . rsync : local_spec = tempdir_path . rstrip ( '/' ) ... | Deploy dotfiles to a remote server . |
4,880 | def deploy_local ( self , dotfiles , target_root = None ) : if target_root is None : target_root = self . args . path for source_path , target_path in dotfiles . items ( ) : source_path = path . join ( self . source , source_path ) target_path = path . join ( target_root , target_path ) if path . isfile ( target_path )... | Deploy dotfiles to a local path . |
4,881 | def dedupe_list ( l ) : result = [ ] for el in l : if el not in result : result . append ( el ) return result | Remove duplicates from a list preserving the order . |
4,882 | def plot_amino_diagrams ( self ) : for res in self . topology_data . dict_of_plotted_res : try : color = [ self . colors_amino_acids [ self . amino_acids [ res [ 0 ] ] ] , 'white' ] except KeyError : color = [ "pink" , 'white' ] plt . figure ( figsize = ( 2.5 , 2.5 ) ) ring1 , _ = plt . pie ( [ 1 ] , radius = 1 , start... | Plotting of amino diagrams - circles with residue name and id colored according to the residue type . If the protein has more than one chain chain identity is also included in the plot . The plot is saved as svg file with residue id and chain id as filename for more certain identification . |
4,883 | def get_cases ( variant_source , case_lines = None , case_type = 'ped' , variant_type = 'snv' , variant_mode = 'vcf' ) : individuals = get_individuals ( variant_source = variant_source , case_lines = case_lines , case_type = case_type , variant_mode = variant_mode ) case_objs = [ ] case_ids = set ( ) compressed = False... | Create a cases and populate it with individuals |
4,884 | def handle_message ( self , message ) : if self . _yamaha : if 'power' in message : _LOGGER . debug ( "Power: %s" , message . get ( 'power' ) ) self . _yamaha . power = ( STATE_ON if message . get ( 'power' ) == "on" else STATE_OFF ) if 'input' in message : _LOGGER . debug ( "Input: %s" , message . get ( 'input' ) ) se... | Process UDP messages |
4,885 | def update_status ( self , new_status = None ) : _LOGGER . debug ( "update_status: Zone %s" , self . zone_id ) if self . status and new_status is None : _LOGGER . debug ( "Zone: healthy." ) else : old_status = self . status or { } if new_status : _LOGGER . debug ( "Set status: provided" ) status = old_status . copy ( )... | Updates the zone status . |
4,886 | def set_power ( self , power ) : req_url = ENDPOINTS [ "setPower" ] . format ( self . ip_address , self . zone_id ) params = { "power" : "on" if power else "standby" } return request ( req_url , params = params ) | Send Power command . |
4,887 | def set_mute ( self , mute ) : req_url = ENDPOINTS [ "setMute" ] . format ( self . ip_address , self . zone_id ) params = { "enable" : "true" if mute else "false" } return request ( req_url , params = params ) | Send mute command . |
4,888 | def set_volume ( self , volume ) : req_url = ENDPOINTS [ "setVolume" ] . format ( self . ip_address , self . zone_id ) params = { "volume" : int ( volume ) } return request ( req_url , params = params ) | Send Volume command . |
4,889 | def set_input ( self , input_id ) : req_url = ENDPOINTS [ "setInput" ] . format ( self . ip_address , self . zone_id ) params = { "input" : input_id } return request ( req_url , params = params ) | Send Input command . |
4,890 | def _add_compounds ( self , variant_obj , info_dict ) : compound_list = [ ] compound_entry = info_dict . get ( 'Compounds' ) if compound_entry : for family_annotation in compound_entry . split ( ',' ) : compounds = family_annotation . split ( ':' ) [ - 1 ] . split ( '|' ) for compound in compounds : splitted_compound =... | Check if there are any compounds and add them to the variant The compounds that are added should be sorted on rank score |
4,891 | def load_xml ( fp , object_pairs_hook = dict ) : r tree = ET . parse ( fp ) return object_pairs_hook ( _fromXML ( tree . getroot ( ) ) ) | r Parse the contents of the file - like object fp as an XML properties file and return a dict of the key - value pairs . |
4,892 | def loads_xml ( s , object_pairs_hook = dict ) : r elem = ET . fromstring ( s ) return object_pairs_hook ( _fromXML ( elem ) ) | r Parse the contents of the string s as an XML properties document and return a dict of the key - value pairs . |
4,893 | def dump_xml ( props , fp , comment = None , encoding = 'UTF-8' , sort_keys = False ) : fp = codecs . lookup ( encoding ) . streamwriter ( fp , errors = 'xmlcharrefreplace' ) print ( '<?xml version="1.0" encoding={0} standalone="no"?>' . format ( quoteattr ( encoding ) ) , file = fp ) for s in _stream_xml ( props , com... | Write a series props of key - value pairs to a binary filehandle fp in the format of an XML properties file . The file will include both an XML declaration and a doctype declaration . |
4,894 | def dumps_xml ( props , comment = None , sort_keys = False ) : return '' . join ( s + '\n' for s in _stream_xml ( props , comment , sort_keys ) ) | Convert a series props of key - value pairs to a text string containing an XML properties document . The document will include a doctype declaration but not an XML declaration . |
4,895 | def connect ( self , db_uri , debug = False ) : kwargs = { 'echo' : debug , 'convert_unicode' : True } if 'mysql' in db_uri : kwargs [ 'pool_recycle' ] = 3600 elif '://' not in db_uri : logger . debug ( "detected sqlite path URI: {}" . format ( db_uri ) ) db_path = os . path . abspath ( os . path . expanduser ( db_uri ... | Configure connection to a SQL database . |
4,896 | def select_plugin ( self , case_obj ) : if case_obj . variant_mode == 'vcf' : logger . debug ( "Using vcf plugin" ) plugin = VcfPlugin ( case_obj . variant_type ) elif case_obj . variant_mode == 'gemini' : logger . debug ( "Using gemini plugin" ) plugin = GeminiPlugin ( case_obj . variant_type ) plugin . add_case ( cas... | Select and initialize the correct plugin for the case . |
4,897 | def index ( ) : gene_lists = app . db . gene_lists ( ) if app . config [ 'STORE_ENABLED' ] else [ ] queries = app . db . gemini_queries ( ) if app . config [ 'STORE_ENABLED' ] else [ ] case_groups = { } for case in app . db . cases ( ) : key = ( case . variant_source , case . variant_type , case . variant_mode ) if key... | Show the landing page . |
4,898 | def case ( case_id ) : case_obj = app . db . case ( case_id ) return render_template ( 'case.html' , case = case_obj , case_id = case_id ) | Show the overview for a case . |
4,899 | def delete_phenotype ( phenotype_id ) : ind_id = request . form [ 'ind_id' ] ind_obj = app . db . individual ( ind_id ) try : app . db . remove_phenotype ( ind_obj , phenotype_id ) except RuntimeError as error : return abort ( 500 , error . message ) return redirect ( request . referrer ) | Delete phenotype from an individual . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.