sequence
stringlengths
492
15.9k
code
stringlengths
75
8.58k
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:movefastq; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 13; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:logging; 10, identifier:info; 11, argument_list; 11, 12; 12, string:'Moving...
def movefastq(self): logging.info('Moving FASTQ files') for sample in self.metadata.runmetadata.samples: outputdir = os.path.join(self.path, sample.name) fastqfiles = sorted(glob(os.path.join(self.path, '{}_*.fastq*'.format(sample.name)))) \ if sorted(glob(os.path...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 1, 11; 2, function_name:add_raw_entity; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:entity; 7, type; 7, 8; 8, identifier:dict; 9, type; 9, 10; 10, identifier:dict; 11, block; 11, 12; 11, 21; 11, 35; 11, 43; 11, 5...
def add_raw_entity(self, entity: dict) -> dict: needed_in_entity = set([ 'label', 'type', ]) options_in_entity = set([ 'label', 'type', 'definition', 'comment', 'superclass', 'synonyms', '...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 1, 19; 2, function_name:delete_annotation; 3, parameters; 3, 4; 3, 5; 3, 9; 3, 13; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:term_ilx_id; 7, type; 7, 8; 8, identifier:str; 9, typed_parameter; 9, 10; 9, 11; 10, identifier:annotation_type...
def delete_annotation( self, term_ilx_id: str, annotation_type_ilx_id: str, annotation_value: str) -> dict: term_data = self.get_entity(term_ilx_id) if not term_data['id']: exit( 'term_ilx_id: ' + term_ilx_id + ' does not exist' ) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:configfilepopulator; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 18; 5, 30; 5, 88; 5, 124; 5, 140; 5, 148; 5, 320; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:self; 10, ide...
def configfilepopulator(self): self.forwardlength = self.metadata.header.forwardlength self.reverselength = self.metadata.header.reverselength cycles = [[1, self.forwardlength, self.runid], [self.forwardlength + 1, self.forwardlength + 8, self.runid], [self.fo...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_check_time_format; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:labels; 6, identifier:values; 7, block; 7, 8; 8, for_statement; 8, 9; 8, 12; 8, 17; 9, pattern_list; 9, 10; 9, 11; 10, identifier:label; 11, identifier:value...
def _check_time_format(self, labels, values): for label, value in zip(labels, values): if value == "*": continue if label == "day_of_week": if isinstance(value, string_types): if value not in ORDER_WEEK: raise Pa...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:readlength; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 13; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:logging; 10, identifier:info; 11, argument_list; 11, 12; 12, string:'Estim...
def readlength(self): logging.info('Estimating read lengths of FASTQ files') for sample in self.samples: sample.run.Date = 'NA' sample.run.InvestigatorName = 'NA' sample.run.TotalClustersinRun = 'NA' sample.run.NumberofClustersPF = 'NA' sample....
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:confirm; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 15; 3, 18; 4, default_parameter; 4, 5; 4, 6; 5, identifier:prompt; 6, string:'Really?'; 7, default_parameter; 7, 8; 7, 9; 8, identifier:color; 9, string:'warning'; 10, default_parameter; 10, 11; 10...
def confirm(prompt='Really?', color='warning', yes_values=('y', 'yes'), abort_on_unconfirmed=False, abort_options=None): if isinstance(yes_values, str): yes_values = (yes_values,) prompt = '{prompt} [{yes_value}/N] '.format(prompt=prompt, yes_value=yes_values[0]) if color: prompt...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:from_string; 3, parameters; 3, 4; 3, 5; 4, identifier:cls; 5, identifier:action_str; 6, block; 6, 7; 6, 11; 6, 181; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:args; 10, dictionary; 11, try_statement; 11, 12; 11, 22...
def from_string(cls, action_str): args = {} try: mod_obj = ast.parse(action_str) except (SyntaxError, ValueError) as e: raise e else: call_obj = mod_obj.body[0].value if isinstance(call_obj, ast.Attribute): module = call_obj...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:epcrparsethreads; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 11; 5, 53; 6, import_from_statement; 6, 7; 6, 9; 7, dotted_name; 7, 8; 8, identifier:Bio; 9, dotted_name; 9, 10; 10, identifier:SeqIO; 11, for_statement; 11, 12; 11, ...
def epcrparsethreads(self): from Bio import SeqIO for sample in self.metadata: if sample.general.bestassemblyfile != 'NA': threads = Thread(target=self.epcrparse, args=()) threads.setDaemon(True) threads.start() for sample in self.metad...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:trimquality; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 13; 5, 392; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:logging; 10, identifier:info; 11, argument_list; 11, 12; 12, stri...
def trimquality(self): logging.info("Trimming fastq files") with progressbar(self.metadata) as bar: for sample in bar: if type(sample.general.fastqfiles) is list: fastqfiles = sorted(sample.general.fastqfiles) outputdir = sample.general...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:contamination_finder; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:input_path; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:report_path; 10, None; 11, block; 11, 12; 11, 19; ...
def contamination_finder(self, input_path=None, report_path=None): logging.info('Calculating contamination in reads') if input_path is not None: input_dir = input_path else: input_dir = self.path if report_path is not None: reportpath = report_path ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:subclass_genesis; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:genesisclass; 6, block; 6, 7; 6, 454; 6, 465; 7, class_definition; 7, 8; 7, 9; 7, 11; 8, identifier:MayaGenesisWin; 9, argument_list; 9, 10; 10, identifier:genesiscl...
def subclass_genesis(self, genesisclass): class MayaGenesisWin(genesisclass): def open_shot(self, taskfile): return self.open_file(taskfile) def save_shot(self, jbfile, tf): self.update_scene_node(tf) self.save_file(jbfile) def ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 35; 1, 37; 2, function_name:override_options; 3, parameters; 3, 4; 3, 8; 3, 18; 3, 30; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:config; 6, type; 6, 7; 7, identifier:DictLike; 8, typed_parameter; 8, 9; 8, 10; 9, identifier:selected_options; 10, type; 10, 11; 1...
def override_options(config: DictLike, selected_options: Tuple[Any, ...], set_of_possible_options: Tuple[enum.Enum, ...], config_containing_override: DictLike = None) -> DictLike: if config_containing_override is None: config_containing_override = config override_opts = config_containing_override.pop("o...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 1, 36; 2, function_name:determine_selection_of_iterable_values_from_config; 3, parameters; 3, 4; 3, 8; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:config; 6, type; 6, 7; 7, identifier:DictLike; 8, typed_parameter; 8, 9; 8, 10; 9, identifier:possible_iterable...
def determine_selection_of_iterable_values_from_config(config: DictLike, possible_iterables: Mapping[str, Type[enum.Enum]]) -> Dict[str, List[Any]]: iterables = {} requested_iterables = config["iterables"] for k, v in requested_iterables.items(): if k not in possible_iterables: raise Key...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 1, 20; 2, function_name:create_key_index_object; 3, parameters; 3, 4; 3, 8; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:key_index_name; 6, type; 6, 7; 7, identifier:str; 8, typed_parameter; 8, 9; 8, 10; 9, identifier:iterables; 10, type; 10, 11; 11, generic_...
def create_key_index_object(key_index_name: str, iterables: Dict[str, Any]) -> Any: for name, iterable in iterables.items(): if iter(iterable) == iter(iterable): raise TypeError( f"Iterable {name} is in iterator which can be exhausted. Please pass the iterable" f"...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 34; 1, 50; 2, function_name:create_objects_from_iterables; 3, parameters; 3, 4; 3, 5; 3, 9; 3, 19; 3, 29; 4, identifier:obj; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:args; 7, type; 7, 8; 8, identifier:dict; 9, typed_parameter; 9, 10; 9, 11; 10, identifier:ite...
def create_objects_from_iterables(obj, args: dict, iterables: Dict[str, Any], formatting_options: Dict[str, Any], key_index_name: str = "KeyIndex") -> Tuple[Any, Dict[str, Any], dict]: objects = {} names = list(iterables) logger.debug(f"iterables: {iterables}") KeyIndex = create_key_index_object( ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 42; 1, 58; 2, function_name:iterate_with_selected_objects_in_order; 3, parameters; 3, 4; 3, 14; 3, 28; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:analysis_objects; 6, type; 6, 7; 7, generic_type; 7, 8; 7, 9; 8, identifier:Mapping; 9, type_parameter; 9, 10; 9, 1...
def iterate_with_selected_objects_in_order(analysis_objects: Mapping[Any, Any], analysis_iterables: Dict[str, Sequence[Any]], selection: Union[str, Sequence[str]]) -> Iterator[List[Tuple[Any, Any]]]: if isinstance(selection, str):...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:phenotypes_to_scored; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:phenotypes; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:overwrite; 10, False; 11, block; 11, 12; 11, 25; 1...
def phenotypes_to_scored(self,phenotypes=None,overwrite=False): if not self.is_uniform(): raise ValueError("inconsistent phenotypes") if phenotypes is None: phenotypes = self.phenotypes elif isinstance(phenotypes,str): phenotypes = [phenotypes] def _post(binary,p...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:subset; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:logic; 6, default_parameter; 6, 7; 6, 8; 7, identifier:update; 8, False; 9, block; 9, 10; 9, 16; 9, 22; 9, 30; 9, 34; 9, 40; 9, 52; 9, 66; 9, 165; 9, 174; 9, 227; 9, 235...
def subset(self,logic,update=False): pnames = self.phenotypes snames = self.scored_names data = self.copy() values = [] phenotypes = logic.phenotypes if len(phenotypes)==0: phenotypes = pnames removing = set(self.phenotypes)-set(phenotypes) for k in phenot...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:collapse_phenotypes; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:input_phenotype_labels; 6, identifier:output_phenotype_label; 7, default_parameter; 7, 8; 7, 9; 8, identifier:verbose; 9, True; 10, block; 10, 11; 10...
def collapse_phenotypes(self,input_phenotype_labels,output_phenotype_label,verbose=True): if isinstance(input_phenotype_labels,str): input_phenotype_labels = [input_phenotype_labels] bad_phenotypes = set(input_phenotype_labels)-set(self.phenotypes) if len(bad_phenotypes) > 0: raise ValueError("E...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:scored_to_phenotype; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:phenotypes; 6, block; 6, 7; 6, 85; 6, 93; 6, 114; 6, 145; 7, function_definition; 7, 8; 7, 9; 7, 12; 8, function_name:_apply_score; 9, parameters; 9, 10; 9, 11; 1...
def scored_to_phenotype(self,phenotypes): def _apply_score(scored_calls,phenotypes): present = sorted(list(set(phenotypes)&set(scored_calls.keys()))) total = sum([scored_calls[x] for x in present]) if total > 1: raise ValueError("You cant extract phenotypes f...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:spike_times; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:signal; 5, identifier:threshold; 6, identifier:fs; 7, default_parameter; 7, 8; 7, 9; 8, identifier:absval; 9, True; 10, block; 10, 11; 10, 15; 10, 27; 10, 39; 10, 56; 10, 297; 1...
def spike_times(signal, threshold, fs, absval=True): times = [] if absval: signal = np.abs(signal) over, = np.where(signal>threshold) segments, = np.where(np.diff(over) > 1) if len(over) > 1: if len(segments) == 0: segments = [0, len(over)-1] else: if ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:bin_spikes; 3, parameters; 3, 4; 3, 5; 4, identifier:spike_times; 5, identifier:binsz; 6, block; 6, 7; 6, 23; 6, 51; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:bins; 10, call; 10, 11; 10, 14; 11, attribute; 11, 12;...
def bin_spikes(spike_times, binsz): bins = np.empty((len(spike_times),), dtype=int) for i, stime in enumerate(spike_times): bins[i] = np.floor(np.around(stime/binsz, 5)) return bins
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:corewriter; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 14; 5, 243; 5, 288; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 9; 8, identifier:printtime; 9, argument_list; 9, 10; 9, 11; 10, string:'Creating core allele files'; 11...
def corewriter(self): printtime('Creating core allele files', self.start) for gene in sorted(self.genesequence): self.geneset.add(gene) genefile = os.path.join(self.coregenelocation, '{}.fasta'.format(gene)) if not os.path.isfile(genefile): with open(g...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:profiler; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 14; 5, 43; 5, 62; 5, 66; 5, 148; 5, 184; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 9; 8, identifier:printtime; 9, argument_list; 9, 10; 9, 11; 10, string:'Calculating ...
def profiler(self): printtime('Calculating core profiles', self.start) for strain in self.corealleles: self.coreset.add(tuple(sorted(self.corealleles[strain].items()))) header = 'ST,{}\n'.format(','.join(sorted(self.geneset))) data = '' for count, core in sorted(enume...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:row2dict; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:row; 5, default_parameter; 5, 6; 5, 7; 6, identifier:depth; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:exclude; 10, None; 11, default_parameter...
def row2dict(row, depth=None, exclude=None, exclude_pk=None, exclude_underscore=None, only=None, fk_suffix=None): if depth == 0: return None d, mapper = {}, get_mapper(row) if depth is None: depth = getattr(row, ATTR_DEPTH, DEFAULT_DEPTH) - 1 else: depth -= 1 if ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 2, function_name:dict2row; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 4, identifier:d; 5, identifier:model; 6, default_parameter; 6, 7; 6, 8; 7, identifier:rel; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:exclude; 11, No...
def dict2row(d, model, rel=None, exclude=None, exclude_pk=None, exclude_underscore=None, only=None, fk_suffix=None): if not isinstance(d, dict): raise TypeError('Source must be instance of dict, got %s instead' % type(d).__name__) row = model() mapper = get_mappe...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 74; 1, 76; 2, function_name:remote; 3, parameters; 3, 4; 3, 13; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 42; 3, 45; 3, 55; 3, 65; 3, 68; 3, 71; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:cmd; 6, type; 6, 7; 7, call; 7, 8; 7, 9; 8, identifier:arg; 9, ...
def remote(cmd: arg(container=list), host, user=None, port=None, sudo=False, run_as=None, shell='/bin/sh', cd=None, environ: arg(container=dict) = None, paths=(), stdout: arg(type=StreamOptions) = None, ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 69; 1, 71; 2, function_name:sync; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 22; 3, 25; 3, 28; 3, 31; 3, 34; 3, 37; 3, 40; 3, 43; 3, 53; 3, 63; 3, 66; 4, identifier:source; 5, identifier:destination; 6, identifier:host; 7, default_parameter; 7,...
def sync(source, destination, host, user=None, sudo=False, run_as=None, options=('-rltvz', '--no-perms', '--no-group'), excludes=(), exclude_from=None, delete=False, dry_run=False, mode='u=rwX,g=rwX,o=', quiet=Tr...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 1, 24; 2, function_name:_determine_outliers_for_moving_average; 3, parameters; 3, 4; 3, 10; 3, 14; 3, 18; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:moving_average; 6, type; 6, 7; 7, attribute; 7, 8; 7, 9; 8, identifier:np; 9, identifier:ndarray; 10, typed_...
def _determine_outliers_for_moving_average(moving_average: np.ndarray, moving_average_threshold: float, number_of_values_to_search_ahead: int, limit_of_number_of_values_below_threshold: int) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:make_dynamic_class; 3, parameters; 3, 4; 3, 5; 4, identifier:typename; 5, identifier:field_names; 6, block; 6, 7; 6, 28; 6, 36; 6, 44; 6, 65; 6, 71; 6, 77; 6, 83; 6, 100; 6, 106; 6, 120; 6, 156; 7, if_statement; 7, 8; 7, 13; 8, call; 8, 9; 8, 1...
def make_dynamic_class(typename, field_names): if isinstance(field_names, basestring): field_names = field_names.replace(",", " ").split() field_names = map(str, field_names) safe_fields_names = map(_encode_property_name, field_names) attr = dict((safe_name, _property(name)) for name, safe_name ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:verifyInputs; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:mode; 6, block; 6, 7; 6, 34; 6, 431; 7, if_statement; 7, 8; 7, 16; 8, comparison_operator:<; 8, 9; 8, 15; 9, call; 9, 10; 9, 11; 10, identifier:len; 11, argument_list; 1...
def verifyInputs(self, mode): if len(self._aichans) < 1: failmsg = "Must have at least one input channel selected" QtGui.QMessageBox.warning(self, "Invalid Setting", failmsg) return False if mode == 'chart': if self.ui.aifsSpnbx.value()*self.fscale > 10000...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:complete; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:command_line; 5, identifier:current_token; 6, identifier:position; 7, typed_parameter; 7, 8; 7, 9; 8, identifier:shell; 9, type; 9, 10; 10, call; 10, 11; 10, 12; 11, identifier:arg...
def complete(command_line, current_token, position, shell: arg(choices=('bash', 'fish'))): position = int(position) tokens = shlex.split(command_line[:position]) all_argv, run_argv, command_argv = run.partition_argv(tokens[1:]) run_args = run.parse_args(run_argv) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:export; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:context; 5, identifier:keywords; 6, identifier:module; 7, identifier:update; 8, block; 8, 9; 8, 19; 8, 27; 8, 31; 8, 197; 9, expression_statement; 9, 10; 10, call; 10, 11; 10, 14; 11,...
def export(context, keywords, module, update): logging.info(_('Export Mode')) database = context.obj['sense'] none = True if update: exports = OrderedDict() from .executables.pe import PE for filename in keywords: module = split_ext(filename, basename=True)[0] ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_source; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:label; 5, identifier:source_type; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 27; 8, 53; 9, if_statement; 9, 10; 9, 15; 10, comparison_operator:not; 10, ...
def get_source(label, source_type, **kwargs): if source_type not in yapconf.ALL_SUPPORTED_SOURCES: raise YapconfSourceError( 'Invalid source type %s. Supported types are %s.' % (source_type, yapconf.ALL_SUPPORTED_SOURCES) ) if source_type not in yapconf.SUPPORTED_SOURCES:...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 37; 1, 39; 2, function_name:_project_observable; 3, parameters; 3, 4; 3, 5; 3, 9; 3, 13; 3, 24; 3, 35; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:input_key; 7, type; 7, 8; 8, identifier:str; 9, typed_parameter; 9, 10; 9, 11; 10, identifier:i...
def _project_observable(self, input_key: str, input_observable: Any, get_hist_args: Dict[str, Any] = None, projection_name_args: Dict[str, Any] = None, **kwargs) -> Hist: if get_hist_args is None: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:getrruleset; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:addRDate; 7, False; 8, block; 8, 9; 8, 13; 8, 469; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:rrules...
def getrruleset(self, addRDate=False): rruleset = None for name in DATESANDRULES: addfunc = None for line in self.contents.get(name, ()): if rruleset is None: rruleset = rrule.rruleset() if addfunc is None: a...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:list_processed_parameter_group_histogram; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:group; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:start; 10, None; 11, ...
def list_processed_parameter_group_histogram(self, group=None, start=None, stop=None, merge_time=20): params = {} if group is not None: params['group'] = group if start is not None: params['start'] = to_isostring(start) if stop is not None: params['sto...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:list_completeness_index; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:stop; 10, None; 11, block; 11, 12; 11, 16; 11, 30; 1...
def list_completeness_index(self, start=None, stop=None): params = {} if start is not None: params['start'] = to_isostring(start) if stop is not None: params['stop'] = to_isostring(stop) return pagination.Iterator( client=self._client, path...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:list_packets; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:name; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:start; 10, None; 11, default_parameter; 11,...
def list_packets(self, name=None, start=None, stop=None, page_size=500, descending=False): params = { 'order': 'desc' if descending else 'asc', } if name is not None: params['name'] = name if page_size is not None: params['limit'] = page_size i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 2, function_name:list_events; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:source; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:severity; 10, None; 11, defa...
def list_events(self, source=None, severity=None, text_filter=None, start=None, stop=None, page_size=500, descending=False): params = { 'order': 'desc' if descending else 'asc', } if source is not None: params['source'] = source if page_size is...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:list_parameter_ranges; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:parameter; 6, default_parameter; 6, 7; 6, 8; 7, identifier:start; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:...
def list_parameter_ranges(self, parameter, start=None, stop=None, min_gap=None, max_gap=None, parameter_cache='realtime'): path = '/archive/{}/parameters{}/ranges'.format( self._instance, parameter) params = {} if start is n...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:copy_file; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:source; 5, identifier:destination; 6, default_parameter; 6, 7; 6, 8; 7, identifier:unique; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:sort; 11, Fal...
def copy_file(source, destination, unique=False, sort=False, case_sensitive=True, create_path=False): _File.copy(source, destination, unique, sort, case_sensitive, create_path)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:tree; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:node; 5, default_parameter; 5, 6; 5, 7; 6, identifier:formatter; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:prefix; 10, None; 11, default_parameter; 11, 12; 11, ...
def tree(node, formatter=None, prefix=None, postfix=None, _depth=1): current = 0 length = len(node.keys()) tee_joint = '\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80' elbow_joint = '\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80' for key, value in node.iteritems(): current += 1 k = formatter(key) if formatter else key ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:run; 3, parameters; 4, block; 4, 5; 4, 11; 4, 20; 4, 26; 4, 35; 4, 44; 4, 81; 4, 87; 4, 99; 4, 136; 4, 148; 4, 163; 4, 175; 4, 177; 4, 195; 4, 206; 4, 220; 4, 224; 4, 240; 4, 290; 4, 314; 4, 346; 4, 350; 4, 384; 4, 388; 4, 404; 4, 429; 5, expre...
def run(): args = parse_args() codetools.setup_logging(args.debug) git_tag = args.tag git_email = codetools.lookup_email(args) git_user = codetools.lookup_user(args) if not args.manifest_only: eups_tag = args.eups_tag if not eups_tag: eups_tag = eups.git_tag2eups_tag(...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:filter_seq; 3, parameters; 3, 4; 4, identifier:seq; 5, block; 5, 6; 5, 8; 5, 15; 5, 26; 5, 38; 5, 44; 5, 55; 5, 66; 5, 77; 5, 88; 5, 117; 5, 131; 5, 144; 6, expression_statement; 6, 7; 7, string:'''Examines unreserved sequences to see if they a...
def filter_seq(seq): '''Examines unreserved sequences to see if they are prone to mutation. This currently ignores solely-power-of-2 guides with b > 3''' if seq.res: return None n = nt.Factors(seq.factors) guide, s, t = aq.canonical_form(n) seq.guide = guide cls = aq.get_cla...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:add_data; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:filenames; 6, block; 6, 7; 6, 56; 6, 119; 6, 170; 6, 211; 6, 352; 7, function_definition; 7, 8; 7, 9; 7, 11; 8, function_name:_parse_table; 9, parameters; 9, 10; 10, identif...
def add_data(self, filenames): def _parse_table(table): def _parse_line(line): return line.split('\t') lines = (_parse_line(one) for one in table.splitlines() if re.match(r'^\d', one)) return (remove_false(one) for one in lines) de...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:check_tags; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:repos; 5, identifier:tags; 6, default_parameter; 6, 7; 6, 8; 7, identifier:ignore_existing; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:fail_fast; 11, False; 12,...
def check_tags(repos, tags, ignore_existing=False, fail_fast=False): debug("looking for {n} tag(s):".format(n=len(tags))) [debug(" {t}".format(t=t)) for t in tags] debug("in {n} repo(s):".format(n=len(repos))) [debug(" {r}".format(r=r.full_name)) for r in repos] present_tags = {} absent_tags =...
0, module; 0, 1; 0, 42; 0, 44; 0, 46; 0, 48; 0, 50; 0, 52; 0, 54; 0, 56; 0, 58; 0, 61; 0, 82; 1, function_definition; 1, 2; 1, 3; 1, 8; 1, 37; 1, 39; 2, function_name:getmlsthelper; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:referencefilepath; 5, identifier:start; 6, identifier:organism; 7, identifier:update;...
def getmlsthelper(referencefilepath, start, organism, update): from accessoryFunctions.accessoryFunctions import GenObject organismset = set() organism = organism if organism != 'Shigella' else 'Escherichia' organismdictionary = {'Escherichia': 'Escherichia coli 'Shigella': 'Es...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:set; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 16; 7, 32; 7, 56; 7, 115; 7, 131; 7, 139; 7, 152; 7, 165; 7, 178; 7, 191; 7, 204; 7, 217; 7, 230; 7, 245; 7, 258; 7,...
def set(self, **kwargs): self.player_lock.acquire() if 'acqtime' in kwargs: self.player.set_aidur(kwargs['acqtime']) if 'aifs' in kwargs: self.player.set_aifs(kwargs['aifs']) self.aifs = kwargs['aifs'] if 'aifs' in kwargs or 'acqtime' in kwargs: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:readlist; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 14; 5, 50; 5, 67; 5, 75; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 9; 8, identifier:printtime; 9, argument_list; 9, 10; 9, 11; 10, string:'Sorting reads'; 11, attribut...
def readlist(self): printtime('Sorting reads', self.start) for i in range(self.cpus): threads = Thread(target=self.listread, args=()) threads.setDaemon(True) threads.start() for sample in self.runmetadata.samples: self.listqueue.put(sample) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:has_change_permission; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:page; 6, identifier:lang; 7, default_parameter; 7, 8; 7, 9; 8, identifier:method; 9, None; 10, block; 10, 11; 10, 18; 10, 27; 10, 72; 10, 80; 10, 1...
def has_change_permission(self, page, lang, method=None): if method != 'POST': return True if self.change_page(): return True if lang: perm = self.user.has_perm( 'pages.can_manage_%s' % lang.replace('-', '_') ) if perm: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:args; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 12; 5, 18; 5, 29; 5, 35; 5, 41; 5, 47; 5, 53; 5, 59; 5, 70; 5, 76; 5, 107; 5, 326; 5, 332; 5, 363; 5, 418; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier...
def args(self): params = self.parameters args = OrderedDict() args['help'] = HelpArg(command=self) normalize_name = self.normalize_name get_arg_config = self.get_arg_config get_short_option = self.get_short_option_for_arg get_long_option = self.get_long_option_for...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:epcr_threads; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:formattedprimers; 6, default_parameter; 6, 7; 6, 8; 7, identifier:ampliconsize; 8, integer:10000; 9, block; 9, 10; 9, 52; 9, 59; 9, 294; 10, for_statement; 10, 11;...
def epcr_threads(self, formattedprimers, ampliconsize=10000): for sample in self.metadata: if sample.general.bestassemblyfile != 'NA': threads = Thread(target=self.epcr, args=()) threads.setDaemon(True) threads.start() logging.info('Running ePC...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:aggregate; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 6, for_statement; 6, 7; 6, 8; 6, 11; 7, identifier:report; 8, attribute; 8, 9; 8, 10; 9, identifier:self; 10, identifier:reportset; 11, block; 11, 12; 11, 32; 11, 41; 11, 45; 1...
def aggregate(self): for report in self.reportset: printtime('Processing {}'.format(report.split('.')[0]), self.start) header = '' if report != 'mlst.csv' else 'Strain,Genus,SequenceType,Matches,1,2,3,4,5,6,7\n' data = '' with open(os.path.join(self.reportpath, re...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_parse_sequences; 3, parameters; 3, 4; 3, 5; 4, identifier:ilines; 5, identifier:expect_qlen; 6, block; 6, 7; 7, while_statement; 7, 8; 7, 9; 8, True; 9, block; 9, 10; 9, 17; 9, 33; 9, 57; 9, 74; 9, 101; 9, 116; 9, 127; 9, 138; 9, 174; 9, 210; ...
def _parse_sequences(ilines, expect_qlen): while True: first = next(ilines) if first.startswith('_') and first.endswith('].'): break try: index, this_len, query_len = _parse_seq_preheader(first) except ValueError: logging.warn('Unparseable line (SK...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:realign_seqs; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:block; 5, default_parameter; 5, 6; 5, 7; 6, identifier:gap_char; 7, string:'.'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:align_indels; 10, False; 11, block; 11, 12; 11, 27; 1...
def realign_seqs(block, gap_char='.', align_indels=False): all_chars = [list(sq['seq']) for sq in block['sequences']] nrows = len(all_chars) i = 0 while i < len(all_chars[0]): rows_need_gaps = [r for r in all_chars if not r[i].islower()] if len(rows_need_gaps) != nrows: for r...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:collapse_to_consensus; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:seqrecords; 5, default_parameter; 5, 6; 5, 7; 6, identifier:strict; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:do_iron; 10, True; 11, block; 11, 12; 11, 16; ...
def collapse_to_consensus(seqrecords, strict=False, do_iron=True): level = 0 name = seqrecords[0].id if hasattr(seqrecords, '_records'): if hasattr(seqrecords, 'level'): level = seqrecords.level if hasattr(seqrecords, 'name'): name = seqrecords.name seqrecords...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:iron; 3, parameters; 3, 4; 4, identifier:sequence; 5, block; 5, 6; 5, 15; 5, 19; 5, 389; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:r_indel; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:re; 1...
def iron(sequence): r_indel = re.compile(r'(-[a-y]|[a-y]-)') orig_sequence = sequence while r_indel.search(sequence): in_insert = False in_gap = False seen_gaps = 0 inserts = [] outchars = [] for char in sequence: if in_insert: if c...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:collect_reponames; 3, parameters; 4, block; 4, 5; 4, 9; 4, 146; 4, 216; 5, expression_statement; 5, 6; 6, assignment; 6, 7; 6, 8; 7, identifier:reponames; 8, list:[]; 9, try_statement; 9, 10; 9, 136; 9, 140; 10, block; 10, 11; 10, 40; 10, 44; 1...
def collect_reponames(): reponames = [] try: with open(os.devnull) as devnull: remote_data = subprocess.check_output(["git","remote","-v","show"],stderr=devnull) branches = {} for line in remote_data.decode('utf-8').split("\n"): if line.strip() == "": continue remote_match = re_mote.match(line) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:build_markdown_table; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:headers; 5, identifier:rows; 6, default_parameter; 6, 7; 6, 8; 7, identifier:row_keys; 8, None; 9, block; 9, 10; 9, 18; 9, 34; 9, 49; 9, 65; 10, expression_statement; 10, 11; ...
def build_markdown_table(headers, rows, row_keys=None): row_maxes = _find_row_maxes(headers, rows) row_keys = row_keys or [key for key, value in headers.items()] table = [ _build_row(headers, row_maxes, row_keys), _build_separator(row_maxes, row_keys) ] for row in rows: table...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:create_publication_assistant; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:args; 7, block; 7, 8; 7, 10; 7, 16; 7, 23; 7, 33; 7, 59; 7, 85; 7, 95; 7, 147; 7, 153; 8, expression_statement; 8, 9; ...
def create_publication_assistant(self, **args): ''' Create an assistant for a dataset that allows to make PID requests for the dataset and all of its files. :param drs_id: Mandatory. The dataset id of the dataset to be published. :param version_number: Mandatory. The ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:replace_source; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:source; 6, identifier:name; 7, identifier:modules; 8, identifier:prefix; 9, block; 9, 10; 9, 14; 9, 102; 9, 115; 9, 126; 9, 135; 9, 139; 9, 196; 9, 2...
def replace_source(self, source, name, modules, prefix): needs_windll = False def _func_replacer(match, modules, windll): matched = match.group(0) if matched in self.BLACKLIST: return matched module = self.database.query_func_module(matched) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:sort_item; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:iterable; 5, identifier:number; 6, default_parameter; 6, 7; 6, 8; 7, identifier:reverse; 8, False; 9, block; 9, 10; 10, return_statement; 10, 11; 11, call; 11, 12; 11, 13; 12, identifier...
def sort_item(iterable, number, reverse=False): return sorted(iterable, key=itemgetter(number), reverse=reverse)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_equivalent_positions; 3, parameters; 3, 4; 4, identifier:block; 5, block; 5, 6; 5, 16; 5, 26; 5, 40; 5, 46; 5, 52; 5, 83; 5, 98; 5, 102; 5, 106; 5, 128; 5, 148; 5, 265; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier...
def get_equivalent_positions(block): consensus = block['sequences'][0]['seq'] rest = block['sequences'][1:] if '-' in consensus or '.' in consensus: raise ValueError("First sequence (consensus?) contains gaps") seen = set() dupes = set() for rec in rest: if rec['id'] in seen: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:remove_path_segments; 3, parameters; 3, 4; 3, 5; 4, identifier:segments; 5, identifier:removes; 6, block; 6, 7; 6, 20; 6, 33; 6, 142; 7, if_statement; 7, 8; 7, 12; 8, comparison_operator:==; 8, 9; 8, 10; 9, identifier:segments; 10, list:['']; 1...
def remove_path_segments(segments, removes): if segments == ['']: segments.append('') if removes == ['']: removes.append('') if segments == removes: ret = [] elif len(removes) > len(segments): ret = segments else: removes2 = list(removes) if len(remove...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:error; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:cls; 5, identifier:template; 6, default_parameter; 6, 7; 6, 8; 7, identifier:default_params; 8, dictionary; 9, default_parameter; 9, 10; 9, 11; 10, identifier:cause; 11,...
def error( cls, template, default_params={}, cause=None, stack_depth=0, **more_params ): if not is_text(template): sys.stderr.write(str("Log.error was expecting a unicode template")) Log.error("Log.error was expecting a unicode template...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:summary_reporter; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 13; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:logging; 10, identifier:info; 11, argument_list; 11, 12; 12, string:...
def summary_reporter(self): logging.info('Creating MOB-recon summary report') with open(os.path.join(self.reportpath, 'mob_recon_summary.csv'), 'w') as summary: data = 'Strain,Location,Contig,Incompatibility,IncompatibilityAccession,RelaxaseType,' \ 'MashNearestNeighbor,Ma...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:amrsummary; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 13; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:logging; 10, identifier:info; 11, argument_list; 11, 12; 12, string:'Creat...
def amrsummary(self): logging.info('Creating AMR summary table from ResFinder and MOB-recon outputs') with open(os.path.join(self.reportpath, 'amr_summary.csv'), 'w') as amr: data = 'Strain,Gene,Allele,Resistance,PercentIdentity,Contig,Location,PlasmidIncompatibilitySets\n' for s...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:geneseekrsummary; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 13; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:logging; 10, identifier:info; 11, argument_list; 11, 12; 12, string:...
def geneseekrsummary(self): logging.info('Creating predicted plasmid-borne gene summary table') with open(os.path.join(self.reportpath, 'plasmid_borne_summary.csv'), 'w') as pbs: data = 'Strain,Gene,PercentIdentity,Contig,Location,PlasmidIncompatibilitySets\n' for sample in self....
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:filterunique; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 6, for_statement; 6, 7; 6, 8; 6, 11; 7, identifier:sample; 8, attribute; 8, 9; 8, 10; 9, identifier:self; 10, identifier:metadata; 11, block; 11, 12; 11, 24; 11, 30; 11, 36;...
def filterunique(self): for sample in self.metadata: sample[self.analysistype].blastresults = list() resultdict = dict() rowdict = dict() try: for contig in sample[self.analysistype].queryranges: for location in sample[self.anal...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:makedbthreads; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 38; 5, 77; 5, 164; 6, for_statement; 6, 7; 6, 8; 6, 11; 7, identifier:sample; 8, attribute; 8, 9; 8, 10; 9, identifier:self; 10, identifier:metadata; 11, block; 11, 12; ...
def makedbthreads(self): for sample in self.metadata: if sample[self.analysistype].combinedtargets != 'NA': self.targetfolders.add(sample[self.analysistype].targetpath) for i in range(len(self.targetfolders)): threads = Thread(target=self.makeblastdb, args=()) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:cowbat; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 13; 5, 49; 5, 85; 5, 116; 5, 152; 5, 188; 5, 229; 5, 265; 5, 307; 5, 349; 5, 391; 5, 433; 5, 469; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10...
def cowbat(self): logging.info('Beginning COWBAT database downloads') if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'genesippr')): self.sipprverse_targets(databasepath=self.databasepath) if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, '...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:setCalibration; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:dbBoostArray; 6, identifier:frequencies; 7, identifier:frange; 8, block; 8, 9; 9, if_statement; 9, 10; 9, 17; 9, 189; 10, boolean_operator:and; 10, 11; 10,...
def setCalibration(self, dbBoostArray, frequencies, frange): if dbBoostArray is not None and frequencies is not None: logger = logging.getLogger('main') if dbBoostArray.shape != frequencies.shape: logger.error("ERROR: calibration array and frequency array must have same d...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:expandFunction; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:func; 6, default_parameter; 6, 7; 6, 8; 7, identifier:args; 8, list:[]; 9, block; 9, 10; 9, 20; 9, 28; 9, 32; 9, 45; 9, 66; 9, 70; 9, 117; 9, 121; 9, 187; 9, 216...
def expandFunction(self, func, args=[]): params = self._autoParams.allData() steps = self.autoParamRanges() ntraces = 1 for p in steps: ntraces = ntraces*len(p) varylist = [[None for x in range(len(params))] for y in range(ntraces)] x = 1 for iset, ste...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:signal; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:force_fs; 7, False; 8, block; 8, 9; 8, 16; 8, 33; 8, 37; 8, 57; 8, 61; 8, 122; 8, 135; 8, 145; 8, 161; 8, 182; 8, 194; 8, 252; 8, 259; 8, 263...
def signal(self, force_fs=False): assert None not in self.voltage_limits, 'Max voltage level not set' if force_fs: samplerate = force_fs else: samplerate = self.samplerate() track_signals = [] max_db = max([comp.intensity() for t in self._segments for comp...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:verify; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:windowSize; 7, None; 8, block; 8, 9; 8, 20; 8, 30; 8, 35; 8, 46; 8, 78; 8, 91; 8, 96; 8, 111; 8, 120; 9, if_statement; 9, 10; 9, 17; 10, comp...
def verify(self, windowSize=None): if self.samplerate() is None: return "Multiple recording files with conflicting samplerates" msg = self._autoParams.verify() if msg: return msg if self.traceCount() == 0: return "Test is empty" if windowSize i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:getLogicalLines; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:fp; 5, default_parameter; 5, 6; 5, 7; 6, identifier:allowQP; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:findBegin; 10, False; 11, block; 11, 12; 12, if_statement; 1...
def getLogicalLines(fp, allowQP=True, findBegin=False): if not allowQP: val = fp.read(-1) lineNumber = 1 for match in logical_lines_re.finditer(val): line, n = wrap_re.subn('', match.group()) if line != '': yield line, lineNumber lineNumber...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_bind_model; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 51; 5, 69; 5, 79; 5, 85; 5, 89; 5, 178; 6, if_statement; 6, 7; 6, 16; 7, comparison_operator:!=; 7, 8; 7, 15; 8, attribute; 8, 9; 8, 14; 9, subscript; 9, 10; 9, 13; 10, at...
def _bind_model(self): if self.groups[0].level != 0: self.log.info("Got invalid first group: {0}".format(self.groups[0])) raise ValueError("Invalid group tree: first group must have level of 0 (got {0})".format(self.groups[0].level)) class Stack(list): def push(self, ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:bowtie; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 42; 5, 460; 6, for_statement; 6, 7; 6, 8; 6, 14; 7, identifier:i; 8, call; 8, 9; 8, 10; 9, identifier:range; 10, argument_list; 10, 11; 11, attribute; 11, 12; 11, 13; 12, ident...
def bowtie(self): for i in range(self.cpus): threads = Thread(target=self.align, args=()) threads.setDaemon(True) threads.start() with progressbar(self.metadata) as bar: for sample in bar: sample.mapping = GenObject() sagen ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:validate_pages_json_data; 3, parameters; 3, 4; 3, 5; 4, identifier:d; 5, identifier:preferred_lang; 6, block; 6, 7; 6, 14; 6, 18; 6, 36; 6, 52; 6, 61; 6, 83; 6, 89; 6, 370; 7, import_from_statement; 7, 8; 7, 12; 8, relative_import; 8, 9; 8, 10;...
def validate_pages_json_data(d, preferred_lang): from .models import Page errors = [] seen_complete_slugs = dict( (lang[0], set()) for lang in settings.PAGE_LANGUAGES) valid_templates = set(t[0] for t in settings.get_page_templates()) valid_templates.add(settings.PAGE_DEFAULT_TEMPLATE) i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:import_po_files; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:path; 6, string:'poexport'; 7, default_parameter; 7, 8; 7, 9; 8, identifier:stdout; 9, None; 10, block; 10, 11; 10, 14; 10, 22; 10, 28; 10, 32; 10, 36;...
def import_po_files(path='poexport', stdout=None): import polib from basic_cms.models import Page, Content source_language = settings.PAGE_DEFAULT_LANGUAGE source_list = [] pages_to_invalidate = [] for page in Page.objects.published(): source_list.extend(page.content_by_language(source_l...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_scene_suggestions; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:current; 6, block; 6, 7; 6, 11; 6, 29; 6, 45; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:l; 10, list:[]; 11, if_statement; 11, 12;...
def get_scene_suggestions(self, current): l = [] if isinstance(current, djadapter.models.Asset): l.append(current) l.extend(list(current.assets.all())) return l
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:assert_variable_type; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:variable; 5, identifier:expected_type; 6, default_parameter; 6, 7; 6, 8; 7, identifier:raise_exception; 8, True; 9, block; 9, 10; 9, 23; 9, 45; 9, 63; 9, 125; 10, if_statement...
def assert_variable_type(variable, expected_type, raise_exception=True): if not isinstance(expected_type, list): expected_type = [expected_type] for t in expected_type: if not isinstance(t, type): raise ValueError('expected_type argument "%s" is not a type' %str(t)) if not isinst...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:run; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 6, while_statement; 6, 7; 6, 15; 7, not_operator; 7, 8; 8, call; 8, 9; 8, 14; 9, attribute; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, identifier:stopped; ...
def run(self): while not self.stopped.isSet(): try: timeout = (self._state != 'idle') and 0.2 or None rdlist, _, _ = select.select([self._socket.fileno()], [], [], timeout) if not rdlist: if self._state != 'idle': ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_inc; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:native; 7, False; 8, block; 8, 9; 8, 67; 8, 167; 8, 256; 8, 267; 9, if_statement; 9, 10; 9, 15; 10, comparison_operator:==; 10, 11; 10, 14; ...
def get_inc(self, native=False): if self.sdk_version == 'v7.0A': include = os.path.join(self.sdk_dir, 'include') if os.path.isdir(include): logging.info(_('using include: %s'), include) return [include] logging.debug(_('include not found: %s'),...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:get_lib; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:arch; 7, string:'x86'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:native; 10, False; 11, block; 11, 12; 11, 80; 11, 169; 11, 25...
def get_lib(self, arch='x86', native=False): if self.sdk_version == 'v7.0A': if arch == 'x86': arch = '' lib = os.path.join(self.sdk_dir, 'lib', arch) if os.path.isdir(lib): logging.info(_('using lib: %s'), lib) return [lib] ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:interrogate; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:platformIdentifier; 6, identifier:configuration; 7, identifier:libraries; 8, default_parameter; 8, 9; 8, 10; 9, identifier:libOverrides; 10, dictionary...
def interrogate(self, platformIdentifier, configuration, libraries, libOverrides = {}): libModules = list([lib for lib in libraries if lib not in libOverrides]) details = ThirdPartyLibraryDetails() if len(libModules) > 0: modules = self._getThirdPartyLibs(platformIdentifier, configuration) modules = [m for ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_getThirdPartyLibs; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:platformIdentifier; 6, identifier:configuration; 7, block; 7, 8; 7, 20; 7, 27; 7, 35; 7, 47; 7, 63; 7, 69; 7, 92; 7, 105; 7, 154; 7, 168; 7, 182; 7, 198; 7, ...
def _getThirdPartyLibs(self, platformIdentifier, configuration): cachedList = CachedDataManager.getCachedDataKey(self.engineVersionHash, 'ThirdPartyLibraries') if cachedList != None: return cachedList tempDir = tempfile.mkdtemp() jsonFile = os.path.join(tempDir, 'ubt_output.json') sentinelFile = os.path.jo...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 57; 2, function_name:add_vt; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 3, 33; 3, 36; 3, 39; 3, 42; 3, 45; 3, 48; 3, 51; 3, 54; 4, identifier:self; 5, identifier:vt_id; 6, default_parameter; 6, 7; 6, 8; 7, identifier:na...
def add_vt(self, vt_id, name=None, vt_params=None, vt_refs=None, custom=None, vt_creation_time=None, vt_modification_time=None, vt_dependencies=None, summary=None, impact=None, affected=None, insight=None, solution=None, solution_t=None, detection=None, qod_t=...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_preprocess_scan_params; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:xml_params; 6, block; 6, 7; 6, 11; 6, 27; 6, 74; 6, 201; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:params; 10, dictionary; 11, ...
def _preprocess_scan_params(self, xml_params): params = {} for param in xml_params: params[param.tag] = param.text or '' for key in self.scanner_params: if key not in params: params[key] = self.get_scanner_param_default(key) if self.get_sca...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:start_scan; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:scan_id; 6, identifier:targets; 7, default_parameter; 7, 8; 7, 9; 8, identifier:parallel; 9, integer:1; 10, block; 10, 11; 10, 17; 10, 21; 10, 29; 10, 33; 10,...
def start_scan(self, scan_id, targets, parallel=1): os.setsid() multiscan_proc = [] logger.info("%s: Scan started.", scan_id) target_list = targets if target_list is None or not target_list: raise OSPDError('Erroneous targets list', 'start_scan') for index, ta...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:ports_as_list; 3, parameters; 3, 4; 4, identifier:port_str; 5, block; 5, 6; 5, 21; 5, 38; 5, 44; 5, 50; 5, 60; 5, 69; 5, 78; 5, 103; 5, 128; 5, 135; 5, 139; 5, 143; 5, 248; 5, 293; 5, 338; 6, if_statement; 6, 7; 6, 9; 7, not_operator; 7, 8; 8, ...
def ports_as_list(port_str): if not port_str: LOGGER.info("Invalid port value") return [None, None] if ports_str_check_failed(port_str): LOGGER.info("{0}: Port list malformed.") return [None, None] tcp_list = list() udp_list = list() ports = port_str.replace(' ', '') ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:create_args_parser; 3, parameters; 3, 4; 4, identifier:description; 5, block; 5, 6; 5, 17; 5, 45; 5, 174; 5, 209; 5, 236; 5, 258; 5, 277; 5, 288; 5, 307; 5, 326; 5, 344; 5, 361; 5, 374; 5, 388; 5, 401; 6, expression_statement; 6, 7; 7, assignme...
def create_args_parser(description): parser = argparse.ArgumentParser(description=description) def network_port(string): value = int(string) if not 0 < value <= 65535: raise argparse.ArgumentTypeError( 'port must be in ]0,65535] interval') return value def...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:_handle_func; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:value; 6, identifier:rule; 7, identifier:path; 8, default_parameter; 8, 9; 8, 10; 9, identifier:done; 10, None; 11, block; 11, 12; 11, 18; 11, 23; 11,...
def _handle_func(self, value, rule, path, done=None): func = rule.func if not func: return found_method = False for extension in self.loaded_extensions: method = getattr(extension, func, None) if method: found_method = True ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:_validate_range; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, identifier:self; 5, identifier:max_; 6, identifier:min_; 7, identifier:max_ex; 8, identifier:min_ex; 9, identifier:value; 10, identifier:path; 11, identifier:...
def _validate_range(self, max_, min_, max_ex, min_ex, value, path, prefix): if not isinstance(value, int) and not isinstance(value, float): raise CoreError("Value must be a integer type") log.debug( u"Validate range : %s : %s : %s : %s : %s : %s", max_, mi...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:tsses; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:db; 5, default_parameter; 5, 6; 5, 7; 6, identifier:merge_overlapping; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:attrs; 10, None; 11, default_pa...
def tsses(db, merge_overlapping=False, attrs=None, attrs_sep=":", merge_kwargs=None, as_bed6=False, bedtools_227_or_later=True): _override = os.environ.get('GFFUTILS_USES_BEDTOOLS_227_OR_LATER', None) if _override is not None: if _override == 'true': bedtools_227_or_later = True ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:interfeatures; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:features; 6, default_parameter; 6, 7; 6, 8; 7, identifier:new_featuretype; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier...
def interfeatures(self, features, new_featuretype=None, merge_attributes=True, dialect=None, attribute_func=None, update_attributes=None): for i, f in enumerate(features): if i == 0: interfeature_start = f.stop last_feature ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:update; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:data; 6, default_parameter; 6, 7; 6, 8; 7, identifier:make_backup; 8, True; 9, dictionary_splat_pattern; 9, 10; 10, identifier:kwargs; 11, block; 11, 12; 11, 17; ...
def update(self, data, make_backup=True, **kwargs): from gffutils import create from gffutils import iterators if make_backup: if isinstance(self.dbfn, six.string_types): shutil.copy2(self.dbfn, self.dbfn + '.bak') _iterator_kwargs = {} for k, v in kwa...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:create_introns; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:exon_featuretype; 7, string:'exon'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:grandparent_featuret...
def create_introns(self, exon_featuretype='exon', grandparent_featuretype='gene', parent_featuretype=None, new_featuretype='intron', merge_attributes=True): if (grandparent_featuretype and parent_featuretype) or ( grandparent_featuretype is None and pare...