sequence stringlengths 546 16.2k | code stringlengths 108 19.3k |
|---|---|
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, 8; 5, 15; 5, 16; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:logging; 12, ... | def movefastq(self):
"""Find .fastq files for each sample and move them to an appropriately named folder"""
logging.info('Moving FASTQ files')
# Iterate through each sample
for sample in self.metadata.runmetadata.samples:
# Retrieve the output directory
outputdir ... |
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, 14; 11, 23; 11, 37; 11, 4... | def add_raw_entity(self, entity: dict) -> dict:
""" Adds entity if it does not already exist under your user ID.
Need to provide a list of dictionaries that have at least the key/values
for label and type. If given a key, the values provided must be in the
format shown in or... |
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:
""" If annotation doesnt exist, add it
"""
term_data = self.get_entity(term_ilx_id)
if not term_data['id']:
exit(
'term... |
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, 8; 5, 9; 5, 21; 5, 33; 5, 34; 5, 35; 5, 93; 5, 94; 5, 130; 5, 131; 5, 147; 5, 148; 5, 156; 5, 157; 5, 344; 5, 345; 6, expression_statement; 6, 7; 7, comment; 8, co... | def configfilepopulator(self):
"""Populates an unpopulated config.xml file with run-specific values and creates
the file in the appropriate location"""
# Set the number of cycles for each read and index using the number of reads specified in the sample sheet
self.forwardlength = self.met... |
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; 7, 10; 8, expression_statement; 8, 9; 9, comment; 10, for_statement; 10, 11; 10, 14; 10, 19; 11, pattern_list; ... | def _check_time_format(self, labels, values):
""" To check the format of the times
:param list labels: years or months or days or number week
:param list values: number or the asterisk in the list
:rtype: None or Exception
:raises PeriodRangeError: outside the scope of the perio... |
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, 8; 5, 15; 5, 16; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:logging; 12,... | def readlength(self):
"""Calculates the read length of the fastq files. Short reads will not be able to be assembled properly with the
default parameters used for spades."""
logging.info('Estimating read lengths of FASTQ files')
# Iterate through the samples
for sample in self.sa... |
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):
"""Prompt for confirmation.
Confirmation can be aborted by typing in a no value instead of one
of the yes values or with Ctrl-C.
Args:
prompt (str): Prompt to pr... |
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, 9; 6, 13; 6, 191; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:... | def from_string(cls, action_str):
"""
Creates a new Action instance from the given string.
The given string **must** match one of those patterns:
* module.function
* module.function()
* module.function(arg1=value1, arg2=value2)
Any other form will t... |
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, 8; 5, 13; 5, 14; 5, 56; 5, 177; 6, expression_statement; 6, 7; 7, comment; 8, import_from_statement; 8, 9; 8, 11; 9, dotted_name; 9, 10; 10, identifier:Bio; 11, dotte... | def epcrparsethreads(self):
"""
Parse the ePCR results, and run BLAST on the parsed results
"""
from Bio import SeqIO
# Create the threads for the BLAST analysis
for sample in self.metadata:
if sample.general.bestassemblyfile != 'NA':
threads =... |
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, 8; 5, 15; 5, 16; 5, 408; 5, 409; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identi... | def trimquality(self):
"""Uses bbduk from the bbmap tool suite to quality and adapter trim"""
logging.info("Trimming fastq files")
# Iterate through strains with fastq files
with progressbar(self.metadata) as bar:
for sample in bar:
# As the metadata can be po... |
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, 14; ... | def contamination_finder(self, input_path=None, report_path=None):
"""
Helper function to get confindr integrated into the assembly pipeline
"""
logging.info('Calculating contamination in reads')
if input_path is not None:
input_dir = input_path
else:
... |
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, 9; 6, 478; 6, 489; 7, expression_statement; 7, 8; 8, comment; 9, class_definition; 9, 10; 9, 11; 9, 13; 10, identifier:MayaGenesisWi... | def subclass_genesis(self, genesisclass):
"""Subclass the given genesis class and implement all abstract methods
:param genesisclass: the GenesisWin class to subclass
:type genesisclass: :class:`GenesisWin`
:returns: the subclass
:rtype: subclass of :class:`GenesisWin`
:... |
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:
""" Determine override options for a particular configuration.
The options are determined by searching following the order specifie... |
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]]:
""" Determine iterable values to use to create objects for a given configuration.
All values of an iterable can be included be setting the value to ``True`` (Not ... |
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:
""" Create a ``KeyIndex`` class based on the passed attributes.
This is wrapped into a helper function to allow for the ``__itter__`` to be specified for the object.
Further, this allows it to be called outside the package ... |
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]:
""" Create objects for each set of values based on the given arguments.
The iterable values are available under a key index ``... |
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]]]:
""" Iterate over an analysis d... |
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, 14; 1... | def phenotypes_to_scored(self,phenotypes=None,overwrite=False):
"""
Add mutually exclusive phenotypes to the scored calls
Args:
phenotypes (list): a list of phenotypes to add to scored calls. if none or not set, add them all
overwrite (bool): if True allow the overwrite... |
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, 12; 9, 18; 9, 24; 9, 32; 9, 36; 9, 42; 9, 54; 9, 68; 9, 167; 9, 176; 9, 229;... | def subset(self,logic,update=False):
"""
subset create a specific phenotype based on a logic,
logic is a 'SubsetLogic' class,
take union of all the phenotypes listed. If none are listed use all phenotypes.
take the intersection of all the scored calls.
Args:
... |
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):
"""
Rename one or more input phenotypes to a single output phenotype
Args:
input_phenotype_labels (list): A str name or list of names to combine
output_phenotype_label (list): A str... |
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, 9; 6, 87; 6, 95; 6, 116; 6, 117; 6, 148; 7, expression_statement; 7, 8; 8, comment; 9, function_definition; 9, 10; 9, 11; 9, 14; 10... | def scored_to_phenotype(self,phenotypes):
"""
Convert binary pehnotypes to mutually exclusive phenotypes.
If none of the phenotypes are set, then phenotype_label becomes nan
If any of the phenotypes are multiply set then it throws a fatal error.
Args:
phenotypes (li... |
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, 13; 10, 17; 10, 29; 10, 41; 10, 58; 10... | def spike_times(signal, threshold, fs, absval=True):
"""Detect spikes from a given signal
:param signal: Spike trace recording (vector)
:type signal: numpy array
:param threshold: Threshold value to determine spikes
:type threshold: float
:param absval: Whether to apply absolute value to signal... |
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, 9; 6, 25; 6, 54; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier... | def bin_spikes(spike_times, binsz):
"""Sort spike times into bins
:param spike_times: times of spike instances
:type spike_times: list
:param binsz: length of time bin to use
:type binsz: float
:returns: list of bin indicies, one for each element in spike_times
"""
bins = np.empty((len(... |
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, 8; 5, 16; 5, 257; 5, 258; 5, 304; 5, 305; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 11; 10, identifier:printtime; 11, arg... | def corewriter(self):
"""
Creates .fasta files containing all alleles for each gene
"""
printtime('Creating core allele files', self.start)
for gene in sorted(self.genesequence):
self.geneset.add(gene)
# Set the name of the allele file
genefile... |
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, 8; 5, 16; 5, 17; 5, 18; 5, 48; 5, 49; 5, 68; 5, 72; 5, 158; 5, 159; 5, 195; 5, 196; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; ... | def profiler(self):
"""
Calculates the core profile for each strain
"""
printtime('Calculating core profiles', self.start)
# Only create the profile if it doesn't exist already
# if not os.path.isfile('{}/profile.txt'.format(self.profilelocation)):
for strain in s... |
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):
"""
Recursively walk row attributes to serialize ones into a dict.
:param row: instance of the declarative base class
:param depth: number that represent the depth of related r... |
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):
"""
Recursively walk dict attributes to serialize ones into a row.
:param d: dict that represent a serialized row
:param model: class nested from the declarative base class
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 75; 1, 77; 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, 46; 3, 56; 3, 66; 3, 69; 3, 72; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:cmd; 6, type; 6, 7; 7, call; 7, 8; 7, 9; 8, identifier:a... | 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=(),
# Args passed through to local command:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 70; 1, 72; 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, 44; 3, 54; 3, 64; 3, 67; 4, identifier:source; 5, identifier:destination; 6, identifier:host; 7, default_parame... | 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, 9; 6, 30; 6, 38; 6, 46; 6, 67; 6, 73; 6, 79; 6, 85; 6, 102; 6, 108; 6, 122; 6, 158; 7, expression_statement; 7, 8; 8, comment; ... | def make_dynamic_class(typename, field_names):
"""a factory function to create type dynamically
The factory function is used by :func:`objson.load` and :func:`objson.loads`.
Creating the object deserialize from json string. The inspiration come from
:func:`collections.namedtuple`. the difference is tha... |
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, 9; 6, 36; 6, 444; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 18; 10, comparison_operator:<; 10, 11; 10, 17; 11, call;... | def verifyInputs(self, mode):
"""Goes through and checks all stimuli and input settings are valid
and consistent. Prompts user with a message if there is a condition
that would prevent acquisition.
:param mode: The mode of acquisition trying to be run. Options are
'chart', o... |
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'))):
"""Find completions for current command.
This assumes that we'll handle all completion logic here and that
the shell's automatic file name completion is disabled.
Args:
... |
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, 11; 8, 21; 8, 29; 8, 33; 8, 199; 9, expression_statement; 9, 10; 10, comment; 11, expre... | def export(context, keywords, module, update):
"""Operate on libraries and exported functions.
Query the module name containing the function by default.
Windows database must be prepared before using this.
"""
logging.info(_('Export Mode'))
database = context.obj['sense']
none = True
i... |
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, 11; 8, 29; 8, 55; 8, 56; 8, 57; 9, expression_statement; 9, 10; 10, comment... | def get_source(label, source_type, **kwargs):
"""Get a config source based on type and keyword args.
This is meant to be used internally by the spec via ``add_source``.
Args:
label (str): The label for this source.
source_type: The type of source. See ``yapconf.SUPPORTED_SOURCES``
Key... |
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:
""" Perform a projection for ... |
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, 11; 8, 15; 8, 499; 9, expression_statement; 9, 10; 10, comment; 11, expression_statement; 11, 12;... | def getrruleset(self, addRDate=False):
"""
Get an rruleset created from self.
If addRDate is True, add an RDATE for dtstart if it's not included in
an RRULE, and count is decremented if it exists.
Note that for rules which don't match DTSTART, DTSTART may not appear
in ... |
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):
"""
Reads index records related to processed parameter groups between the
specified start and stop time.
Each iteration returns a chunk of chronologically-sorted records.
:para... |
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, 14; 11, 18; 1... | def list_completeness_index(self, start=None, stop=None):
"""
Reads completeness index records between the specified start and stop
time.
Each iteration returns a chunk of chronologically-sorted records.
:rtype: ~collections.Iterable[.IndexGroup]
"""
params = {}... |
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):
"""
Reads packet information between the specified start and stop
time.
Packets are sorted by generation time and sequence number.
:param ~datetime.datetime start: Minimum generation time... |
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):
"""
Reads events between the specified start and stop time.
Events are sorted by generation time, source, then sequence number.
:param str so... |
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'):
"""
Returns parameter ranges between the specified start and stop time.
Each range indicates an interval during ... |
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):
"""
Python utility to create file
Args:
source: absolute/relative path of source file
destination: absolute/relative path of destination file.
Use same as source for re... |
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):
"""Print a tree.
Sometimes it's useful to print datastructures as a tree. This function prints
out a pretty tree with root `node`. A tree is represented as a :class:`dict`,
whose keys are node names and values are :class:`dict` objects for su... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:run; 3, parameters; 4, block; 4, 5; 4, 7; 4, 13; 4, 22; 4, 28; 4, 29; 4, 38; 4, 39; 4, 48; 4, 49; 4, 50; 4, 51; 4, 52; 4, 53; 4, 54; 4, 92; 4, 93; 4, 94; 4, 100; 4, 112; 4, 151; 4, 163; 4, 178; 4, 190; 4, 192; 4, 210; 4, 221; 4, 235; 4, 239; 4,... | def run():
"""Create the tag"""
args = parse_args()
codetools.setup_logging(args.debug)
git_tag = args.tag
# if email not specified, try getting it from the gitconfig
git_email = codetools.lookup_email(args)
# ditto for the name of the git user
git_user = codetools.lookup_user(args)
... |
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, 45; 5, 56; 5, 67; 5, 78; 5, 90; 5, 91; 5, 120; 5, 134; 5, 135; 5, 148; 6, expression_statement; 6, 7; 7, string:'''Examines unreserved sequ... | 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
# The target_tau... |
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, 9; 6, 58; 6, 122; 6, 173; 6, 214; 6, 355; 7, expression_statement; 7, 8; 8, comment; 9, function_definition; 9, 10; 9, 11; 9, 13; 10, function_... | def add_data(self, filenames):
"""Add data."""
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 ... |
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):
""" check if tags already exist in repos"""
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 ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 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; 8, block; 8, 9; 8, 11; 8, 17; 8, 18; 8, 24; 8, 25; 8, 34; 8, 35; 8, 60; 8, 61; 8, 83; 9, e... | def getmlsthelper(referencefilepath, start, organism, update):
"""Prepares to run the getmlst.py script provided in SRST2"""
from accessoryFunctions.accessoryFunctions import GenObject
# Initialise a set to for the organism(s) for which new alleles and profiles are desired
organismset = set()
# Allo... |
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, 10; 7, 18; 7, 34; 7, 58; 7, 117; 7, 133; 7, 141; 7, 154; 7, 167; 7, 180; 7, 193; 7, 206; 7, 219; 7, 232; 7, 247; 7, ... | def set(self, **kwargs):
"""Sets an internal setting for acquistion, using keywords.
Available parameters to set:
:param acqtime: duration of recording (input) window (seconds)
:type acqtime: float
:param aifs: sample rate of the recording (input) operation (Hz)
... |
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, 8; 5, 16; 5, 17; 5, 56; 5, 73; 5, 81; 5, 82; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 11; 10, identifier:printtime; 11, ar... | def readlist(self):
"""Sort the reads, and create lists to be used in creating sorted .fastq files"""
printtime('Sorting reads', self.start)
# Create and start threads
for i in range(self.cpus):
# Send the threads to the appropriate destination function
threads = ... |
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, 13; 10, 14; 10, 15; 10, 22; 10, 2... | def has_change_permission(self, page, lang, method=None):
"""Return ``True`` if the current user has permission to
change the page."""
# the user has always the right to look at a page content
# if he doesn't try to modify it.
if method != 'POST':
return True
... |
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, 8; 5, 14; 5, 20; 5, 21; 5, 22; 5, 33; 5, 39; 5, 45; 5, 51; 5, 57; 5, 63; 5, 74; 5, 80; 5, 111; 5, 331; 5, 337; 5, 368; 5, 423; 6, expression_statement; 6, 7; 7, comment; 8, expre... | def args(self):
"""Create args from function parameters."""
params = self.parameters
args = OrderedDict()
# This will be overridden if the command explicitly defines an
# arg named help.
args['help'] = HelpArg(command=self)
normalize_name = self.normalize_name
... |
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, 12; 9, 13; 9, 55; 9, 62; 9, 309; 9, 310; 10, ... | def epcr_threads(self, formattedprimers, ampliconsize=10000):
"""
Run ePCR in a multi-threaded fashion
"""
# Create the threads for the ePCR analysis
for sample in self.metadata:
if sample.general.bestassemblyfile != 'NA':
threads = Thread(target=self.... |
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; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, for_statement; 8, 9; 8, 10; 8, 13; 9, identifier:report; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, identifier:... | def aggregate(self):
"""
Aggregate all reports of the same type into a master report
"""
for report in self.reportset:
printtime('Processing {}'.format(report.split('.')[0]), self.start)
# Initialise the header for each report - MLST is different, as the header is... |
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; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, while_statement; 9, 10; 9, 11; 10, True; 11, block; 11, 12; 11, 19; 11, 36; 11, 37... | def _parse_sequences(ilines, expect_qlen):
"""Parse the sequences in the current block.
Sequence looks like:
$3=227(209):
>gi|15606894|ref|NP_214275.1| {|2(244)|<Aquificae(B)>}DNA polymerase III gamma subunit [Aquifex aeolicus VF5] >gi|2984127|gb|AAC07663.1| DNA polymerase III gamma subunit [Aquifex ... |
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, 14; 1... | def realign_seqs(block, gap_char='.', align_indels=False):
"""Add gaps to a block so all residues in a column are equivalent.
Given a block, containing a list of "sequences" (dicts) each containing a
"seq" (actual string sequence, where upper=match, lower=insert, dash=gap),
insert gaps (- or .) into th... |
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, 14; ... | def collapse_to_consensus(seqrecords, strict=False, do_iron=True):
"""Opposite of realign_seqs.
Input sequences should all be the same length.
The first record must be the consensus.
"""
level = 0
name = seqrecords[0].id
# If this is a CMA alignment, extract additional info:
if hasattr... |
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, 8; 5, 17; 5, 21; 5, 407; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:r_indel; 11, call; 11, 12; 11, ... | def iron(sequence):
"""'Iron out' indel regions in the aligned sequence.
Any inserts next to deletions are converted to matches (uppercase).
Given a CMA string like:
AAAAbc--de-f--gAAA
Result:
AAAABCDEFgAAA
"""
r_indel = re.compile(r'(-[a-y]|[a-y]-)')
orig_sequence = sequen... |
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, 7; 4, 11; 4, 12; 4, 149; 4, 150; 4, 221; 5, expression_statement; 5, 6; 6, comment; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:reponames; 10, list:[]; 11, commen... | def collect_reponames():
"""
Try to figure out a list of repos to consider by default from the contents of the working directory.
"""
reponames = []
#try to figure out the repo from git repo in current directory
try:
with open(os.devnull) as devnull:
remote_data = subprocess.check_output(["git","remote","-v... |
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, 12; 9, 20; 9, 36; 9, 51; 9, 67; 10, expression_statement; 1... | def build_markdown_table(headers, rows, row_keys=None):
"""Build a lined up markdown table.
Args:
headers (dict): A key -> value pairing fo the headers.
rows (list): List of dictionaries that contain all the keys listed in
the headers.
row_keys (list): A sorted list of keys to d... |
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, 11; 7, 17; 7, 24; 7, 34; 7, 35; 7, 61; 7, 62; 7, 88; 7, 89; 7, 100; 7, 101; 7, 154; 7,... | 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. Th... |
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, 12; 9, 16; 9, 104; 9, 117; 9, 128; 9, 137; 9, 141; 9, 19... | def replace_source(self, source, name, modules, prefix):
"""Scan C source code for string literals as well as
function calls and do replacement using the specified
replacing function.
Note that the regular expression currently used for strings
is naive or quick and dirty.
... |
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; 9, 12; 10, expression_statement; 10, 11; 11, comment; 12, return_state... | def sort_item(iterable, number, reverse=False):
"""Sort the itertable according to the given number item."""
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, 8; 5, 18; 5, 28; 5, 29; 5, 43; 5, 44; 5, 50; 5, 56; 5, 87; 5, 102; 5, 106; 5, 110; 5, 111; 5, 142; 5, 162; 5, 163; 5, 164; 5, 165; 5, 287; 6, expression_stat... | def get_equivalent_positions(block):
"""Create a mapping of equivalent residue positions to consensus.
Build a dict-of-dicts::
{consensus-posn: {id: equiv-posn, id: equiv-posn, ...}, ...}
The first sequence in the alignment is assumed to be the (gapless) consensus
sequence.
"""
consen... |
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, 9; 6, 22; 6, 35; 6, 145; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 14; 10, comparison_operator:==; 10... | def remove_path_segments(segments, removes):
"""Removes the removes from the tail of segments.
Examples::
>>> # '/a/b/c' - 'b/c' == '/a/'
>>> assert remove_path_segments(['', 'a', 'b', 'c'], ['b', 'c']) == ['', 'a', '']
>>> # '/a/b/c' - '/b/c' == '/a
>>> assert remove_path_segme... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:error; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 11; 3, 14; 3, 15; 3, 18; 4, identifier:cls; 5, identifier:template; 6, comment; 7, default_parameter; 7, 8; 7, 9; 8, identifier:default_params; 9, dictionary; 10, comment; 11, default_par... | def error(
cls,
template, # human readable template
default_params={}, # parameters for template
cause=None, # pausible cause
stack_depth=0,
**more_params
):
"""
raise an exception with a trace for the cause too
:param template: *string* hu... |
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, 8; 5, 15; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:logging; 12, ... | def summary_reporter(self):
"""
Parse individual MOB Recon reports into a summary report
"""
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,Incompatibi... |
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, 8; 5, 15; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:logging; 12, identi... | def amrsummary(self):
"""
Create a report combining results from resfinder_assembled and mob_recon_summary reports
"""
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:
... |
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, 8; 5, 15; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:logging; 12, ... | def geneseekrsummary(self):
"""
Create a report combining GeneSeekr and MOB Recon outputs
"""
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,Per... |
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; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, for_statement; 8, 9; 8, 10; 8, 13; 8, 14; 9, identifier:sample; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, i... | def filterunique(self):
"""
Filters multiple BLAST hits in a common region of the genome. Leaves only the best hit
"""
for sample in self.metadata:
# Initialise variables
sample[self.analysistype].blastresults = list()
resultdict = dict()
r... |
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, 8; 5, 9; 5, 41; 5, 42; 5, 84; 5, 85; 5, 175; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, for_statement; 9, 10; 9, 11; 9, 14; 10, identifier:sample; 11, att... | def makedbthreads(self):
"""
Setup and create threads for class
"""
# Find all the target folders in the analysis and add them to the targetfolders set
for sample in self.metadata:
if sample[self.analysistype].combinedtargets != 'NA':
self.targetfolder... |
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, 8; 5, 15; 5, 51; 5, 87; 5, 118; 5, 154; 5, 190; 5, 231; 5, 267; 5, 309; 5, 351; 5, 393; 5, 435; 5, 471; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9... | def cowbat(self):
"""
Run all the methods
"""
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... |
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; 8, 11; 9, expression_statement; 9, 10; 10, comment; 11, if_statement; 11, 12... | def setCalibration(self, dbBoostArray, frequencies, frange):
"""Sets the calibration to use with this stimulus,
creates a filter that will be applied to output signal generated by this model.
Set arguments to `None` to clear calibration.
:param dbBoostArray: frequency response of the s... |
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, 12; 9, 13; 9, 23; 9, 31; 9, 35; 9, 48; 9, 69; 9, 73; 9, 120; 9, 121; ... | def expandFunction(self, func, args=[]):
"""applies the given function to each of this stimulus's memerships when autoparamters are applied
:param func: callable to execute for each version of the stimulus
:type instancemethod:
:param args: arguments to feed to func
:type args: ... |
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, 11; 8, 18; 8, 35; 8, 39; 8, 59; 8, 60; 8, 64; 8, 65; 8, 66; 8, 67; 8, 128; 8, 129; 8, 142; 8, 152; 8, ... | def signal(self, force_fs=False):
"""The current stimulus in signal representation, this is the sum
of its components
:param force_fs: Allow to use a different samplerate than the default, should be used to recreate historical signals only
:type force_fs: int
:returns: numpy.nda... |
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, 11; 8, 22; 8, 32; 8, 37; 8, 48; 8, 82; 8, 95; 8, 100; 8, 115; 8, 124; 9, expression_statement; 9, 10;... | def verify(self, windowSize=None):
"""Checks the stimulus, including expanded parameters for invalidating conditions
:param windowSize: acquistion (recording) window size (seconds)
:type windowSize: float
:returns: str -- error message, if any, 0 otherwise"""
if self.samplerate(... |
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; 11, 14; 12, express... | def getLogicalLines(fp, allowQP=True, findBegin=False):
"""
Iterate through a stream, yielding one logical line at a time.
Because many applications still use vCard 2.1, we have to deal with the
quoted-printable encoding for long lines, as well as the vCard 3.0 and
vCalendar line folding technique,... |
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, 8; 5, 53; 5, 54; 5, 55; 5, 56; 5, 57; 5, 58; 5, 59; 5, 60; 5, 61; 5, 62; 5, 63; 5, 64; 5, 65; 5, 66; 5, 67; 5, 87; 5, 88; 5, 89; 5, 90; 5, 91; 5, 101; 5, 107; 5, 111; 5, 2... | def _bind_model(self):
"""
This method binds the various model objects together in the correct hierarchy
and adds referneces to this database object in the groups.
"""
if self.groups[0].level != 0:
self.log.info("Got invalid first group: {0}".format(self.groups[0]))
... |
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, 8; 5, 47; 5, 474; 6, expression_statement; 6, 7; 7, comment; 8, for_statement; 8, 9; 8, 10; 8, 16; 8, 17; 9, identifier:i; 10, call; 10, 11; 10, 12; 11, identifier:range; 12, a... | def bowtie(self):
"""
Create threads and commands for performing reference mapping for qualimap analyses
"""
for i in range(self.cpus):
# Send the threads to the merge method. :args is empty as I'm using
threads = Thread(target=self.align, args=())
# S... |
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, 9; 6, 16; 6, 20; 6, 38; 6, 54; 6, 63; 6, 85; 6, 91; 6, 375; 7, expression_statement; 7, 8; 8, comment; 9, import_from_stateme... | def validate_pages_json_data(d, preferred_lang):
"""
Check if an import of d will succeed, and return errors.
errors is a list of strings. The import should proceed only if errors
is empty.
"""
from .models import Page
errors = []
seen_complete_slugs = dict(
(lang[0], set()) f... |
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, 13; 10, 16; 10, 24; 10, 30; 10, 34;... | def import_po_files(path='poexport', stdout=None):
"""
Import all the content updates from the po files into
the pages.
"""
import polib
from basic_cms.models import Page, Content
source_language = settings.PAGE_DEFAULT_LANGUAGE
source_list = []
pages_to_invalidate = []
for page ... |
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, 9; 6, 13; 6, 31; 6, 47; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 1... | def get_scene_suggestions(self, current):
"""Return a list with elements for reftracks for the current scene with this type.
For every element returned, the reftrack system will create a :class:`Reftrack` with the type
of this interface, if it is not already in the scene.
E.g. if you h... |
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, 12; 9, 13; 9, 26; 9, 27; 9, 49; 9, 50; 9, ... | def assert_variable_type(variable, expected_type, raise_exception=True):
"""Return True if a variable is of a certain type or types.
Otherwise raise a ValueError exception.
Positional arguments:
variable -- the variable to be checked
expected_type -- the expected type or types of the variable
r... |
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; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, while_statement; 8, 9; 8, 17; 9, not_operator; 9, 10; 10, call; 10, 11; 10, 16; 11, attribute; 11, 12; 11, 15; 12, attribute; 12, ... | def run(self):
"""Main loop of KIRA thread."""
while not self.stopped.isSet():
try:
# if the current state is idle, just block and wait forever
# if the current state is any other state, then a timeout of 200ms should
# be reasonable in all cas... |
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, 11; 8, 69; 8, 169; 8, 258; 8, 269; 9, expression_statement; 9, 10; 10, comment; 11, if_statement; 11, 1... | def get_inc(self, native=False):
"""
Get include directories of Windows SDK.
"""
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)
... |
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, 14; 11, 82; 11, 171... | def get_lib(self, arch='x86', native=False):
"""
Get lib directories of Windows SDK.
"""
if self.sdk_version == 'v7.0A':
if arch == 'x86':
arch = ''
lib = os.path.join(self.sdk_dir, 'lib', arch)
if os.path.isdir(lib):
lo... |
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 = {}):
"""
Interrogates UnrealBuildTool about the build flags for the specified third-party libraries
"""
# Determine which libraries need their modules parsed by UBT, and which are override-only
libModules = list([lib for lib... |
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, 10; 7, 11; 7, 23; 7, 30; 7, 31; 7, 39; 7, 51; 7, 52; 7, 53; 7, 54; 7, 55; 7, 56; 7, 57; 7... | def _getThirdPartyLibs(self, platformIdentifier, configuration):
"""
Runs UnrealBuildTool in JSON export mode and extracts the list of third-party libraries
"""
# If we have previously cached the library list for the current engine version, use the cached data
cachedList = CachedDataManager.getCachedDataKe... |
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, 9; 6, 13; 6, 29; 6, 30; 6, 77; 6, 78; 6, 205; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, as... | def _preprocess_scan_params(self, xml_params):
""" Processes the scan parameters. """
params = {}
for param in xml_params:
params[param.tag] = param.text or ''
# Set default values.
for key in self.scanner_params:
if key not in params:
para... |
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, 13; 10, 19; 10, 23; 10, 31; 10,... | def start_scan(self, scan_id, targets, parallel=1):
""" Handle N parallel scans if 'parallel' is greater than 1. """
os.setsid()
multiscan_proc = []
logger.info("%s: Scan started.", scan_id)
target_list = targets
if target_list is None or not target_list:
rai... |
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, 8; 5, 23; 5, 40; 5, 46; 5, 52; 5, 62; 5, 71; 5, 80; 5, 105; 5, 130; 5, 137; 5, 141; 5, 145; 5, 146; 5, 253; 5, 298; 5, 343; 6, expression_statement; 6, 7; 7, comment... | def ports_as_list(port_str):
"""
Parses a ports string into two list of individual tcp and udp ports.
@input string containing a port list
e.g. T:1,2,3,5-8 U:22,80,600-1024
@return two list of sorted integers, for tcp and udp ports respectively.
"""
if not port_str:
LOGGER.info("In... |
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, 8; 5, 19; 5, 49; 5, 181; 5, 218; 5, 247; 5, 269; 5, 288; 5, 299; 5, 318; 5, 337; 5, 355; 5, 372; 5, 385; 5, 399; 5, 412; 6, expression_statement; 6, 7; 7, co... | def create_args_parser(description):
""" Create a command-line arguments parser for OSPD. """
parser = argparse.ArgumentParser(description=description)
def network_port(string):
""" Check if provided string is a valid network port. """
value = int(string)
if not 0 < value <= 65535... |
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, 14; 11, 20; 11,... | def _handle_func(self, value, rule, path, done=None):
"""
Helper function that should check if func is specified for this rule and
then handle it for all cases in a generic way.
"""
func = rule.func
# func keyword is not defined so nothing to do
if not func:
... |
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):
"""
Validate that value is within range values.
"""
if not isinstance(value, int) and not isinstance(value, float):
raise CoreError("Value must be a integer type")
log.debug(
u"Va... |
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):
"""
Create 1-bp transcription start sites for all transcripts in the database
and return as a sorted pybedtools.BedTool object pointing to a temporary
file.
To ... |
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):
"""
Construct new features representing the space between features.
For example, if `features` is a list of exon... |
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, 14; ... | def update(self, data, make_backup=True, **kwargs):
"""
Update database with features in `data`.
data : str, iterable, FeatureDB instance
If FeatureDB, all data will be used. If string, assume it's
a filename of a GFF or GTF file. Otherwise, assume it's an
i... |
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):
"""
Create introns from existing annotations.
Parameters
----------
exon_fe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.