query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
queries SavedHomes using saved_home_id to get longitude
def saved_home_latitude(saved_home_id): sql = "SELECT latitude FROM saved_homes WHERE saved_home_id = :saved_home_id" cursor = db.session.execute(sql,{"saved_home_id": saved_home_id}) latitude = cursor.fetchone() return latitude
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saved_home_longitude(saved_home_id):\n\n sql = \"SELECT longitude FROM saved_homes WHERE saved_home_id = :saved_home_id\"\n\n cursor = db.session.execute(sql,{\"saved_home_id\": saved_home_id})\n\n longitude = cursor.fetchone()\n\n return longitude", "def get_address(saved_home_id):\n\n sql = ...
[ "0.79902", "0.6118132", "0.57440174", "0.5707932", "0.5707018", "0.5700337", "0.5519437", "0.55093503", "0.5499253", "0.5488462", "0.5446763", "0.5413726", "0.54134554", "0.5385816", "0.5265151", "0.5264347", "0.5260805", "0.5260011", "0.5238127", "0.5235772", "0.5224815", ...
0.76028997
1
Shows businesses near saved home longtitude and latitude
def list_businesses(property_id): #need to query for longitude and latitude saved_home_id = property_id #SQL query to get longitude using saved_home_id longitude = saved_home_longitude(saved_home_id) #SQL query to get latitude using saved_home_id latitude = saved_home_latitude(saved_home_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_near_location():\n return render_template(\"location.html\", latitude=None, longitude=None,\n list_stops=None)", "def station_viewer():\r\n name = request.args[\"address\"]\r\n stations = get_zipcode_stations(name)\r\n\r\n if len(stations) > 0:\r\n stations['...
[ "0.6190853", "0.60117227", "0.5954512", "0.5796066", "0.5763397", "0.56744766", "0.566464", "0.5655306", "0.56232136", "0.5610862", "0.56104386", "0.5592543", "0.5587977", "0.5574137", "0.557158", "0.5570936", "0.55348104", "0.5516368", "0.5511563", "0.54928356", "0.5488545",...
0.6223184
0
creates a new saved business
def save_new_business(user_id, bus_name, yelp_id, latitude, longitude, yelp_url, saved_home_id): business = SavedBusinesses( user_id = user_id, yelp_id = yelp_id, bus_name = bus_name, latitude = latitude, longitude = longitude, yelp_url = yelp_url, sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_business(identifier, legal_type=None, legal_name=None):\n business = Business()\n business.identifier = identifier\n business.legal_type = legal_type\n business.legal_name = legal_name\n business.save()\n return business", "def register_business(current_user):\n data = request.get...
[ "0.7183854", "0.67874414", "0.66240084", "0.653262", "0.63423127", "0.6336254", "0.6319564", "0.63147587", "0.62548125", "0.62217283", "0.6177882", "0.6177882", "0.6064845", "0.60640514", "0.60619956", "0.60320467", "0.60320467", "0.60320467", "0.60247517", "0.6001875", "0.60...
0.757261
0
r"""VGG 16layer model (configuration "D") with batch normalization
def vgg16_bn(model_dir, tag, num_classes, use_cls, batchnorm=True): cfg = [[64, 64, 'M'], [128, 128, 'M'], [256, 256, 256, 'M'], [512, 512, 512, 512, 512, 512], [1024, 'D', 1024, 'D']] net = VGG(model_dir, tag, cfg, num_classes, use_cls, batchnorm=batchnorm) return net
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vgg16_bn(pretrained,**kwargs):\n model = VGG(make_layers(cfg['D'], batch_norm=True), **kwargs)\n if pretrained:\n model_dict = paddle.load('./pre_model/vgg16_bn.paddle')\n model.set_state_dict(model_dict)\n return model", "def build_cnn_vgg16(num_classes):\n\n inputs = tf.keras.laye...
[ "0.6655622", "0.6650276", "0.664758", "0.66025937", "0.65362394", "0.64770895", "0.6441213", "0.6392127", "0.6389471", "0.6289369", "0.62637967", "0.62584615", "0.62367207", "0.62322664", "0.6110412", "0.6110049", "0.6054402", "0.60233474", "0.60222334", "0.6008342", "0.60014...
0.69133383
0
Looks ahead one token. If the next token matches one of the given ones, returns true and advances the head pointer.
def _match(self, *token_types): for token in token_types: if self._check(token): self._advance() return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, token):\n try:\n if token == 'S' and is_symbol(self.the_input[self.index]) \\\n or self.the_input[self.index] == token:\n self.index += 1\n return True\n except IndexError:\n print 'Error on checking \\'' + token +...
[ "0.64136237", "0.585626", "0.58293134", "0.5813293", "0.5748833", "0.57118", "0.56403", "0.561034", "0.56024075", "0.55615383", "0.54867095", "0.54227394", "0.5391972", "0.5381704", "0.5378281", "0.5342942", "0.5334457", "0.5324501", "0.5290606", "0.5278128", "0.5262168", "...
0.62295413
1
Checks the next token for the given token type.
def _check(self, token_type): if self._is_at_end(): return False return self._peek().token_type == token_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eat(self, token_type):\n if self.current_token.type == token_type:\n self.current_token = self.lexer.get_next_token()\n # print(self.current_token)\n else:\n self.error()", "def _assert_token_type(self, token, expected_type):\n if token and token.type == expe...
[ "0.7041934", "0.686519", "0.66744655", "0.6639003", "0.655341", "0.64888304", "0.64674366", "0.64206403", "0.6393062", "0.6368189", "0.6220035", "0.61547", "0.60059273", "0.5962529", "0.5935847", "0.5935539", "0.5929813", "0.5926765", "0.59179354", "0.58905804", "0.587732", ...
0.7866306
0
Returns the previous token in the list.
def _previous(self): return self.token_list[self._current - 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prev_token(self, tok, include_extra=False):\n # type: (Token, bool) -> Token\n i = tok.index - 1\n if not include_extra:\n while is_non_coding_token(self._tokens[i].type):\n i -= 1\n return self._tokens[i]", "def get_previous(self):\n return self._next_previous_helper('previous...
[ "0.78973746", "0.7702691", "0.7477467", "0.7417186", "0.7413403", "0.7353703", "0.7339029", "0.7330643", "0.72991306", "0.72103095", "0.7198118", "0.71271235", "0.7043022", "0.70284075", "0.7019578", "0.6980399", "0.69696885", "0.6966419", "0.69032735", "0.681985", "0.6812457...
0.89975834
0
Attempts to consume the next token if it is the given type.
def _consume(self, token_type, msg): if self._check(token_type): return self._advance() raise self._error(self._peek(), msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eat(self, token_type):\n if self.current_token.type == token_type:\n self.current_token = self.lexer.get_next_token()\n # print(self.current_token)\n else:\n self.error()", "def _consume_type(self):\n try:\n self._consume(self.VARIABLE_TYPES)\n...
[ "0.7341707", "0.67438674", "0.66897255", "0.65760523", "0.64632964", "0.62723833", "0.6213298", "0.6211683", "0.6120097", "0.6010382", "0.58728313", "0.58645236", "0.58205235", "0.57960516", "0.57960516", "0.57960516", "0.56326324", "0.55995536", "0.55565697", "0.551926", "0....
0.78619826
0
Returns a ParseError and logs an error with the interpreter.
def _error(self, token, msg): self._interpreter.parse_error(token, msg) return ParseError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_error(self, err):\r\n self.logger.debug(err)\r\n stack = err.get(\"stack\", [])\r\n if not err[\"message\"].startswith(\"parse error:\"):\r\n err[\"message\"] = \"error: \" + err[\"message\"]\r\n errmsg = \"Octave evaluation error:\\n%s\" % err[\"message\"]\r\n\r\n...
[ "0.6517298", "0.6387569", "0.6333749", "0.6310108", "0.59419096", "0.59037", "0.5853194", "0.5799247", "0.5798414", "0.5780637", "0.5685462", "0.56765276", "0.5633103", "0.5619426", "0.55892473", "0.55616635", "0.5501678", "0.54769194", "0.545392", "0.545392", "0.5449951", ...
0.71268624
0
Map values with sigmoid function to range [0,1]. Y(t) = 1/(1 + exp(gain(values shift))
def sigmoid(values, gain, shift): import numpy as np tiny = 0.000000001 # Make sure argument is a numpy array if type(values) != np.ndarray: values = np.array(values) return 1.0 / (1.0 + np.exp(-gain * (values - shift)) + tiny)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(value):\n return 1.0 / (1.0 + math.exp(-value))", "def sigmoid(t):\n t[t >= 20] = 20\n t[t <= -20] = -20\n return np.exp(t)/(np.exp(t)+1)", "def sigmoid(x,shift=0,mult=1):\n return 1 / (1 + math.exp(-(x+shift)*mult))", "def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))", ...
[ "0.73663825", "0.71762073", "0.71002215", "0.68752146", "0.6858091", "0.6832065", "0.6828366", "0.6828366", "0.6828366", "0.6828366", "0.6828366", "0.6828366", "0.68040353", "0.6799179", "0.6792524", "0.67914814", "0.6790694", "0.6784127", "0.6758304", "0.67532116", "0.674543...
0.8068838
0
Find endpoints in a region of connected vertices. These points are intended to serve as endpoints of fundus curves running along highlikelihood paths within a region (fold). This algorithm iteratively propagates from an initial highlikelihood seed toward the boundary of a region within thresholded subregions of decreas...
def find_segment_endpoints(indices, neighbor_lists, likelihoods, step=1): import numpy as np from mindboggle.labels.labels import extract_borders # Make sure arguments are numpy arrays if isinstance(likelihoods, list): likelihoods = np.array(likelihoods) # Parameters: min_size = 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_edges(starting_point, max_dist, hi, lo, bgArray):\n try:\n b = fetch_val(bgArray, starting_point)\n except IndexError:\n return None\n offsets = [(0,1), (1,0), (0,-1), (-1,0)]\n edgePoints = []\n for offset in offsets:\n first_result = find_edge(starting_point, offset, ...
[ "0.63463396", "0.59707016", "0.58227015", "0.5684077", "0.5558691", "0.54850435", "0.5458841", "0.5346233", "0.5345577", "0.5324624", "0.5304109", "0.52686787", "0.5258255", "0.5256899", "0.52393764", "0.52276045", "0.5224099", "0.5215032", "0.5209798", "0.51924145", "0.51746...
0.640198
0
Shrink segments in a segmented surface mesh by a fraction of its maximum depth, for all segments or for segments in regions with multiple segments.
def shrink_segments(regions, segments, depths, shrink_factor=0.25, only_multiple_segments=False): import numpy as np print('Shrink segments') remove_fraction = 1 - shrink_factor shrunken_segments = -1 * np.ones(len(depths)) # Make sure arguments are numpy arrays if not isi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subdivide_mesh(\n vertices: np.ndarray, faces: np.ndarray, subdivide_threshold: float\n) -> np.ndarray:\n\n max_edge = get_vertices_bounding_box(vertices)[-1] * subdivide_threshold\n\n return trimesh.remesh.subdivide_to_size(vertices, faces, max_edge)[0]", "def callback(mesh):\n shrunk = mesh.shr...
[ "0.55230653", "0.5414716", "0.52755874", "0.5205108", "0.5172866", "0.51585984", "0.5103534", "0.506077", "0.50528574", "0.5033383", "0.49927393", "0.49777892", "0.49749196", "0.49594805", "0.49082968", "0.49042964", "0.4895167", "0.48624578", "0.48506373", "0.47627047", "0.4...
0.6899877
0
Retrieve PODPAC semantic version as string Returns str Semantic version if outside git repository Returns `git describe always` if inside the git repository
def version(): version_full = semver() CWD = os.path.dirname(__file__) got_git = os.path.exists(os.path.join(os.path.dirname(__file__), "..", ".git")) if not got_git: return version_full try: # determine git binary git = "git" try: subprocess.check_output...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_version():\n try:\n code, output = _run_cmd('git', 'describe', '--tags')\n if code:\n return 'unknown'\n output = output.decode('utf8').strip().split('-')\n if len(output) != 3:\n return 'unknown'\n version = '%s+%s' % (output[0], output[2])\n\n ...
[ "0.7336789", "0.7291358", "0.72601277", "0.7169582", "0.70130545", "0.6905142", "0.68349826", "0.6752513", "0.657856", "0.655547", "0.6540561", "0.64956397", "0.64951843", "0.647409", "0.6458362", "0.6425985", "0.6338563", "0.6262185", "0.6238744", "0.62258005", "0.6216029", ...
0.83106726
0
Returns True if chromosome_name sounds like one of our insertion cassettes, False otherwise.
def is_cassette_chromosome(chromosome_name): return ("insertion_cassette" in chromosome_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_other_chromosome(chromosome_name):\n if is_cassette_chromosome(chromosome_name): return False\n if chromosome_name.startswith('chr') or chromosome_name.startswith('scaffold'): return False\n else: ...
[ "0.7973496", "0.6904484", "0.63201296", "0.5878787", "0.5870619", "0.58183515", "0.581004", "0.5799723", "0.5798506", "0.57770634", "0.5756595", "0.5752675", "0.57503545", "0.57446855", "0.5728181", "0.5641129", "0.56181234", "0.5585736", "0.5577955", "0.5553379", "0.55077946...
0.85567
0
Returns True if chromosome_name is neither cassette nor chromosome/scaffold, False otherwise.
def is_other_chromosome(chromosome_name): if is_cassette_chromosome(chromosome_name): return False if chromosome_name.startswith('chr') or chromosome_name.startswith('scaffold'): return False else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cassette_chromosome(chromosome_name):\n return (\"insertion_cassette\" in chromosome_name)", "def check_chromosome_composition(chromosome: str, nurses_number: int) -> bool:\n\n # The number of genes in the chromosome is generated\n genes = 21 * nurses_number\n\n # Here is removed white spaces\...
[ "0.79243827", "0.64666486", "0.60545814", "0.6003928", "0.5928852", "0.57831943", "0.5766314", "0.5740043", "0.5698536", "0.56569386", "0.5632043", "0.5613601", "0.56032854", "0.5572482", "0.5534552", "0.5523383", "0.552156", "0.55130076", "0.5477924", "0.54777753", "0.545259...
0.8339933
0
Takes a (chrom, start_pos, end_pos, strand) tuple raises MutantError if it's wrong. Start_pos and end_pos should be int, 1based, inclusive (so in AATTGG, the position of AA is 12) unlike in HTSeq! Strand should be +/. No checks are done on chrom.
def check_valid_position_tuple(pos): try: chrom, start_pos, end_pos, strand = pos except (TypeError, ValueError): raise MutantError("Didn't get a correct position tuple! %s"%pos) if strand not in SEQ_STRANDS: raise MutantError("Invalid strand %s!"%strand) if star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overlaps(self, chrom, start, end, strand=None):\n if (self.chrom != chrom \n or min(self.end, end) - max(self.start, start) <= 0 \n or (strand is not None and self.strand != strand)): \n return False\n return True", "def get_ref_and_start_and_offset(forward_ref_...
[ "0.6354471", "0.6235148", "0.61575633", "0.593017", "0.5807833", "0.56864846", "0.559741", "0.55016994", "0.5491126", "0.5472953", "0.5449186", "0.54104984", "0.5406418", "0.54044247", "0.5370745", "0.53121483", "0.5310372", "0.52801085", "0.52617604", "0.5255385", "0.525042"...
0.7372381
0
Convert an HTSeq.GenomicPosition instance to a (chrom,start_pos,end_pos,strand) tuple. Start_pos and end_pos are 1based, inclusive (so in AATTGG, the position of AA is 12) unlike in HTSeq!
def HTSeq_pos_to_tuple(HTSeq_pos): try: chrom = HTSeq_pos.chrom except AttributeError: raise MutantError("Invalid position %s! Need an HTSeq iv object. (If empty, maybe read wasn't aligned?)"%(HTSeq_pos,)) strand = HTSeq_pos.strand # HTSeq is 0-based and I want 1-based, thus the +1; end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_pos(pos):\n return pos.chromosome, pos.strand, pos.min_position, pos.min_position+20", "def get_genomic_range( self ):\n return self.snv_chrom + ':' + str( self.snv_start ) + '-' + str( self.snv_end )", "def chrom_and_pos(self, index, index2=None):\n if index2 is None:\n ...
[ "0.6389698", "0.61054", "0.59882236", "0.5913174", "0.5900781", "0.58588254", "0.58381635", "0.5809354", "0.5801149", "0.57703596", "0.5639592", "0.5603268", "0.55714244", "0.55568963", "0.55499804", "0.5480885", "0.53992945", "0.53610545", "0.53607786", "0.5334829", "0.53156...
0.8105561
0
Initialize all values chromosome/strand are just copied from arguments; positions are more complicated. You must provide either full_position, OR one or both of position_before/position_after. The two position_ arguments must be castable to ints, or None. The full_position argument must be a string of the form '100200'...
def __init__(self, chromosome, strand, full_position=None, position_before=None, position_after=None, immutable=False): # need to make instance mutable to be able to set anything, due to how __setattr__ is decorated self.make_mutable_REMEMBER_CLEANUP_FIRST() # now start setting attributes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n if len(args) == 1:\n position = args[0]\n if len(position) != 2:\n raise PositionError\n self._position = args\n elif len(args) == 2:\n self._position = args\n else:\n raise PositionError", "de...
[ "0.5977929", "0.56178004", "0.55555886", "0.5532431", "0.55157036", "0.5480008", "0.5448816", "0.5439251", "0.532895", "0.5309388", "0.5269337", "0.52215236", "0.518906", "0.5178596", "0.51294214", "0.5125572", "0.5121275", "0.5102379", "0.50387585", "0.50387585", "0.50236976...
0.75947535
0
Parse a full_position string to proper (position_before, position_after) value.
def _parse_full_position(cls, full_position_string): try: before,after = [cls._parse_single_position(s) for s in full_position_string.split('-')] except (ValueError,AttributeError): raise ValueError("The full_position argument must be a string of the form '100-200', '?-200' or '1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_pos(pos, regexp=POS_REGEXP):\n m = regexp.match(pos)\n return tuple(map(int, m.groups()))", "def parse_position(chrom_pos: str):\n chrom, pos = chrom_pos.split('_')\n return chrom, int(pos)", "def handle_position(data: bytes) -> Tuple[bytes, str]:\n x, y, z = struct.unpack('fff', data[...
[ "0.64782345", "0.6377305", "0.62160516", "0.612528", "0.6113427", "0.5846422", "0.5825414", "0.5814289", "0.5801118", "0.5782579", "0.57719696", "0.5761895", "0.57479566", "0.5691542", "0.56005317", "0.5598498", "0.5556253", "0.552903", "0.54763263", "0.5399435", "0.5392648",...
0.8495686
0
Make key for sorting/comparison based on chromosome/position/strand, with improved chromosomenumber sorting. First two fields are chromosome data splits chromosome into name/number (both optional), so that 'chr2' sorts before 'chr12' (but 'chr' before 'chr1', and 'other_chr1' after 'chr4'), and also so that chromosomes...
def _make_key(self): all_position_values = (chromosome_sort_key(self.chromosome), self.min_position, self.max_position, self.strand, self.position_before, self.position_after) return all_position_values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortkey(item):\n chrom, pos, ref, alt = item[0]\n if chrom.startswith('chr'):\n chrom = chrom[3:]\n if chrom.isdigit():\n chrom = int(chrom)\n return (chrom, pos, len(ref), len(alt))", "def sort(self):\n sort_key = self.data.chromosome.apply(sorter_chrom)\n self.data =...
[ "0.6112682", "0.6048693", "0.56508696", "0.56142724", "0.5323903", "0.5252737", "0.52512056", "0.5194273", "0.51627487", "0.5153749", "0.509315", "0.5088636", "0.50862974", "0.50861454", "0.5084419", "0.50008214", "0.4992516", "0.49760285", "0.49712116", "0.49694505", "0.4946...
0.6810686
0
Reversibly make object immutable (reasonably) and hashable.
def make_immutable(self): # just set the flag to make object immutable and hashable self.immutable = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __hash__(self):\n if self.immutable:\n return hash(self._make_key())\n else:\n raise MutantError(\"This %s is currently mutable, and therefore unhashable! \"%repr(self)\n +\"Run self.make_immutable() to change this.\")", "def make_mutable_REME...
[ "0.6758572", "0.67053974", "0.6542986", "0.6396433", "0.6321631", "0.62582093", "0.61994404", "0.606839", "0.6010715", "0.5959738", "0.5907642", "0.58751816", "0.5747587", "0.57078564", "0.5691022", "0.56675", "0.5596881", "0.55961627", "0.5588229", "0.55824023", "0.55514175"...
0.8096591
0
Reversibly make object mutable and nonhashable. REMEMBER TO REMOVE SELF FROM SETS/DICTS BEFORE CALLING!
def make_mutable_REMEMBER_CLEANUP_FIRST(self): # UNSET the flag to make object immutable and hashable - need to do it in a roundabout way, # because the immutability prevents simply "self.immutable = False" from working! self.__dict__['immutable'] = False # but if I put __slots__ in, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_immutable(self):\n # just set the flag to make object immutable and hashable\n self.immutable = True", "def make_mutable(obj):\n _mutable_objs.append(obj)", "def __sub__(self, obj):\n return self ^ obj", "def shallow_copy(self):\n # TODO: Rename this to __copy__()?\n ...
[ "0.72401875", "0.6723461", "0.65100807", "0.62228954", "0.6092488", "0.608733", "0.6045231", "0.6040895", "0.6037135", "0.5984441", "0.59769535", "0.5902408", "0.5894151", "0.5887292", "0.587385", "0.5867318", "0.5857524", "0.58271", "0.58166295", "0.5779478", "0.576897", "...
0.7387795
0
Return distance between positions, or NaN if on different chromosomes or on different strands and ignore_strand is False.
def get_position_distance(pos1, pos2, ignore_strand=False): NaN = float('nan') if pos1 in SPECIAL_POSITIONS.all_undefined: return NaN elif pos2 in SPECIAL_POSITIONS.all_undefined: return NaN elif pos1.chromosome != pos2.chromosome: return NaN elif not ignore_stra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_dist(self, neighboring_pos):\n vec = np.array([i[1] - i[0] for i in zip(self.pos, neighboring_pos)])\n dist = np.linalg.norm(vec)\n return vec, dist", "def distance(self,b,enforceStrand=False):\n if b.chr != self.chr:\n return -1\n if enforceStrand:\n ...
[ "0.57980406", "0.5789443", "0.5782124", "0.5746988", "0.57429904", "0.5669104", "0.56631744", "0.56625354", "0.5643527", "0.5639918", "0.5638318", "0.56260926", "0.56241703", "0.5614394", "0.56075317", "0.5594846", "0.558574", "0.5585104", "0.5571978", "0.55256027", "0.550488...
0.82225955
0
Return a Insertion_position instance giving the cassette insertion position based on HTSeq read position. Flanking_region_aln_or_pos should be a HTSeq.Alignment instance or a (chrom,start_pos,end_pos,strand) tuple (the tuple should have 1based endinclusive positions, so AA is 12 in AATT; HTSeq positions are 0based ende...
def get_insertion_pos_from_flanking_region_pos(flanking_region_aln_or_pos, cassette_end, relative_read_direction, immutable_position=True): # check that basic values aren't weird check_valid_end_info(cassette_end, relative_read_direction) # parse flanking_regi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_RISCC_pos_from_read_pos(read_aln_or_pos, cassette_end, relative_read_direction='inward', immutable_position=True):\n check_valid_end_info(cassette_end, relative_read_direction)\n imaginary_relative_direction= ('outward' if relative_read_direction=='inward' else 'inward')\n imaginary_cassette_posit...
[ "0.7088554", "0.5690543", "0.52616596", "0.5222307", "0.5163519", "0.5146661", "0.51298785", "0.5016734", "0.5016734", "0.50140184", "0.49561983", "0.49236864", "0.48811024", "0.4854148", "0.48433566", "0.47868958", "0.4782669", "0.47505528", "0.47457227", "0.47210136", "0.46...
0.7968826
0
Return an Insertion_position instance giving the position of the far end of RISCC genomeside read. The output strand should be the same as that of the cassette, given relative_read_direction inward/outward from the cassette. See get_insertion_pos_from_flanking_region_pos for how the inputs work, and how this is done fo...
def get_RISCC_pos_from_read_pos(read_aln_or_pos, cassette_end, relative_read_direction='inward', immutable_position=True): check_valid_end_info(cassette_end, relative_read_direction) imaginary_relative_direction= ('outward' if relative_read_direction=='inward' else 'inward') imaginary_cassette_position = ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_insertion_pos_from_flanking_region_pos(flanking_region_aln_or_pos, cassette_end, relative_read_direction, \n immutable_position=True):\n # check that basic values aren't weird\n check_valid_end_info(cassette_end, relative_read_direction)\n # parse flan...
[ "0.690913", "0.56426275", "0.5469719", "0.5355928", "0.5296487", "0.52198416", "0.5152106", "0.50924796", "0.49645847", "0.49341005", "0.4889715", "0.48862326", "0.485524", "0.485524", "0.48241213", "0.47878337", "0.47712404", "0.47377774", "0.4734826", "0.46962333", "0.46710...
0.6778229
1
Transform Insertion_position instance into (strand, ins_start, ins_end) tuple if it's not one already.
def _get_insertion_info(insertion_pos, allowed_strand_vals=SEQ_STRANDS): try: strand, ins_start, ins_end = insertion_pos.strand, insertion_pos.min_position, insertion_pos.max_position except AttributeError: strand, ins_start, ins_end = insertion_pos if allowed_strand_vals is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return Insertion_position(self.chromosome, self.strand, position_before=self.position_before, \n position_after=self.position_after)", "def __repr__(self):\n return \"Insertion_position('%s', '%s', full_position='%s', immutable=%s)\"%(self.chromoso...
[ "0.6175135", "0.60323584", "0.5965107", "0.5956609", "0.5523276", "0.5421098", "0.52681917", "0.524433", "0.52264607", "0.5174197", "0.5142862", "0.512147", "0.50527865", "0.5031616", "0.5016128", "0.5003051", "0.49822026", "0.49640447", "0.49618804", "0.49489638", "0.4903994...
0.7646623
0
Look up insertion_pos in chromosome_GFF_record; return (gene_ID,orientation,subfeature,dist_to_edges). Insertion_pos is an Insertion_position instance, or a (strand, start_pos, end_pos) tuple; insertion_pos is assumed to be in the chromosome given by chromosome_GFF_record (the caller should check that). If insertion_po...
def find_gene_by_pos_gff3(insertion_pos, chromosome_GFF_record, detailed_features=False, nearest_genes_for_intergenic=False, quiet=False): from BCBio import GFF # importing here instead of toplevel because sometimes it's missing and I want to be able to use this file # MAYBE-TODO add ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_insertion_info(insertion_pos, allowed_strand_vals=SEQ_STRANDS):\n try:\n strand, ins_start, ins_end = insertion_pos.strand, insertion_pos.min_position, insertion_pos.max_position\n except AttributeError:\n strand, ins_start, ins_end = insertion_pos\n if allowed_strand_vals is not No...
[ "0.61753327", "0.5651202", "0.5566418", "0.5268026", "0.5207312", "0.51637614", "0.5153046", "0.5099371", "0.4980735", "0.49739644", "0.49500814", "0.49482694", "0.49347588", "0.49312872", "0.4915447", "0.48882285", "0.4873452", "0.48689857", "0.48640868", "0.4856279", "0.484...
0.7680272
0
Set all readcountrelated data to 0/empty.
def _set_readcount_related_data_to_zero(self): self.total_read_count = 0 self.perfect_read_count = 0 self.RISCC_genome_side_aligned_reads = {} self.RISCC_genome_side_unaligned_reads = {} self.sequences_counts_positions_errors = {} # TODO should all this really be ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n self.counts = [0] * len(self.values)\n if HAS_NUMPY:\n self.counts = numpy.array(self.counts)", "def reset(self):\n for i in range(0, len(self.__counts)):\n self.__counts[i] = 0\n self.__overflow = 0\n self.__total_count = 0\n sel...
[ "0.73472196", "0.71501696", "0.7069055", "0.70679396", "0.7005426", "0.69340074", "0.6897218", "0.68605644", "0.6838163", "0.68360454", "0.6801618", "0.6767612", "0.6755343", "0.67272305", "0.66804826", "0.66208565", "0.65441126", "0.6536732", "0.6534575", "0.6529003", "0.652...
0.8255836
0
Help function to get readinfocontaining object for both multidataset and single mutants. Here this just returns self; more complicated version is for multidataset mutants. Strict is ignored and only present to make the implementation consistent with the multidataset version.
def read_info(self, dataset_name=None, strict=False): if dataset_name is None: return self else: raise MutantError("This is NOT a multi-dataset mutant - cannot provide dataset_name arg!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_info(self, dataset_name=None, strict=False):\n if dataset_name is None: \n raise MutantError(\"This is a multi-dataset mutant - must provide dataset_name arg!\")\n if strict:\n self._check_dataset_presence(dataset_name)\n return self.by_dataset[dataset_name]...
[ "0.7060582", "0.49853617", "0.47985914", "0.47944397", "0.47569603", "0.47407067", "0.46908507", "0.4618769", "0.456103", "0.45301", "0.45223302", "0.45051187", "0.4483471", "0.445618", "0.44560418", "0.44347364", "0.44001314", "0.4360957", "0.43532157", "0.4349832", "0.43496...
0.726781
0
Raise Error if dataset_name isn't None; give explanation. Many Insertional_mutant methods take a dataset_name argument for consistency with the multidataset subclass, but for nonsubclass objects this shouldn't be provided. The only reason for having them at all is so that you get a more useful error message when you tr...
def _ensure_dataset_None(dataset_name): if dataset_name is not None: raise MutantError("Don't try to provide a dataset_name on a single mutant (rather than the multi-dataset subclass)!") # MAYBE-TODO this could be accomplished with a decorator instead, right?
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_dataset_name(self, dataset_name: Optional[str]) -> str:\n if dataset_name is None:\n if self.num_datasets > 1:\n raise ValueError(\"`dataset_name` is required if there are \"\n \"more than one datasets.\")\n dataset_name = ne...
[ "0.65393716", "0.629011", "0.607913", "0.6057744", "0.60284096", "0.5984428", "0.5735188", "0.571796", "0.5612005", "0.5570402", "0.5567123", "0.55548304", "0.5546228", "0.55137175", "0.5497992", "0.548842", "0.5445214", "0.5429049", "0.54150707", "0.5400183", "0.5380179", ...
0.8115274
0
Add a read to the data (or multiple identical reads, if read_count>1); return True if perfect alignment.
def add_read(self, HTSeq_alignment, position=SPECIAL_POSITIONS.unknown, read_count=1, dataset_name=None): # TODO instead of taking HTSeq_alignment, this could just take the seq and N_errors, like add_RISCC_read does? self._ensure_dataset_None(dataset_name) # increment total_read_count, and add r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_read(self, HTSeq_alignment, position=SPECIAL_POSITIONS.unknown, read_count=1, dataset_name=None):\n readcount_data_container = self._check_dataset_name_return_data(dataset_name)\n Insertional_mutant.add_read(readcount_data_container, HTSeq_alignment, position, read_count)", "def add(self, r...
[ "0.66703767", "0.63036084", "0.60595834", "0.5847189", "0.5803102", "0.5691213", "0.5633004", "0.5595244", "0.5579823", "0.54536265", "0.5377282", "0.5353344", "0.533654", "0.53172827", "0.53101915", "0.52433026", "0.52132875", "0.5118853", "0.510487", "0.5064495", "0.5047601...
0.75120145
0
Set self.position to be the highestcount DEFINED position; check that all positions are within max_allowed_dist of it.
def decide_and_check_position(self, max_allowed_dist=0, ratio_to_ignore=100, OUTPUT=None): if not self.sequences_counts_positions_errors: self.position = SPECIAL_POSITIONS.unknown return def _order(arg): s, (c, p, e) = arg return (p in SPECIAL_POSITIONS.al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_position(self):\n raise NotImplementedError", "def max_positions(self):\n return None", "def set_max_position(self, max_us):\n raise NotImplementedError()", "def __find_max_distance(self):\n return utils.find_max_distance(self.__game)", "def _update_limits(self):\n ...
[ "0.6595603", "0.6491933", "0.6433678", "0.61591154", "0.6157575", "0.6144035", "0.6072857", "0.5985302", "0.5985302", "0.5968435", "0.5918116", "0.58851624", "0.58851624", "0.58576226", "0.57616043", "0.57189703", "0.57189703", "0.57189703", "0.57186514", "0.5714011", "0.5707...
0.6715895
0
Return the most common sequence in the given data, and its count (or Nth most common sequence if N is provided).
def _get_main_sequence_from_data(seqs_to_counts_and_data, N=1, aligned_only=False): # use key to sort reverse by count but non-reverse by seq if aligned_only: filtered_data = [(seq, data) for (seq, data) in seqs_to_counts_and_data.items() if isinstance(data[1], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _counts(data):\n table = collections.Counter(iter(data)).most_common()\n if not table:\n return table\n maxfreq = table[0][1]\n for i in range(1, len(table)):\n if table[i][1] != maxfreq:\n table = table[:i]\n break\n return table", "def get_most_common(self...
[ "0.6817413", "0.6385164", "0.6149853", "0.59647363", "0.59352905", "0.5902185", "0.58569103", "0.5834017", "0.5760998", "0.5708807", "0.56993324", "0.5690845", "0.5657929", "0.56506425", "0.56504536", "0.56015867", "0.5568998", "0.5519514", "0.5517345", "0.551183", "0.5487164...
0.6733384
1
Copy nonreadcountrelated data from source_mutant to self (making new copies of all objects).
def _copy_non_readcount_data(self, source_mutant): # COPY the position, not just make another name for the same value - I wrote a copy() function for positions self.position = source_mutant.position.copy() # strings are immutable and thus safe to "copy" by adding another name to the same ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_readcount_related_data(self, source_mutant):\n # integers are immutable and thus safe to \"copy\" by adding another name to the same value\n self.total_read_count = source_mutant.total_read_count\n self.perfect_read_count = source_mutant.perfect_read_count\n # using di...
[ "0.6806262", "0.64745337", "0.6368794", "0.6264078", "0.6264078", "0.6264078", "0.6224812", "0.6219349", "0.6204146", "0.61696106", "0.60658664", "0.6017084", "0.59997535", "0.5997415", "0.5995374", "0.5987567", "0.5922086", "0.5911224", "0.58600986", "0.585722", "0.5854316",...
0.80433446
0
Copy readcountrelated data from source_mutant to self (making new copies of all objects).
def _copy_readcount_related_data(self, source_mutant): # integers are immutable and thus safe to "copy" by adding another name to the same value self.total_read_count = source_mutant.total_read_count self.perfect_read_count = source_mutant.perfect_read_count # using dict to make ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_non_readcount_data(self, source_mutant):\n # COPY the position, not just make another name for the same value - I wrote a copy() function for positions\n self.position = source_mutant.position.copy() \n # strings are immutable and thus safe to \"copy\" by adding another name to...
[ "0.74078166", "0.5897654", "0.5787232", "0.57613033", "0.56062573", "0.558503", "0.5516049", "0.5516049", "0.5508036", "0.5508036", "0.5508036", "0.5491282", "0.54707116", "0.53941333", "0.537508", "0.53534603", "0.53087145", "0.530071", "0.52822745", "0.5266203", "0.5209987"...
0.81424654
0
Add new genomeside read to RISCC genomeside aligned or unaligned reads, or increment existing one if present.
def add_RISCC_read(self, seq, new_position, N_errors=None, read_count=1): # TODO why are we even using Insertion_position objects here?? Those aren't insertion positions with a start-end, just single positions... But still need to be able to deal with unaligned/multi as well as proper positions. if not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, read):\n self.additionalReads.append(read)\n self._length += 1", "def add_read(self, read):\n r = Read(read)\n if read not in self.reads:\n self.reads[read] = r\n else:\n self.reads[read].visit_limit += 1\n self.num_reads += 1", "def...
[ "0.69418913", "0.6814255", "0.6499232", "0.64566016", "0.6419348", "0.6335957", "0.6130465", "0.5879859", "0.58513033", "0.5830645", "0.56137127", "0.5548496", "0.54873645", "0.5420207", "0.5263395", "0.5173211", "0.5139469", "0.51312757", "0.5119528", "0.51152825", "0.507598...
0.70845866
0
Compare the read to the current best one replace the best one if this is better. "Better" meaning furthest away from the cassetteside read, while still remaining on the same chromosome, strand, and within max_distance of it. If both reads are on a different chromosome or strand than the cassetteside position (both are ...
def improve_best_RISCC_read(self, seq, new_position, N_errors=None, read_count=1, max_distance=MAX_POSITION_DISTANCE): # if there are more than one current reads, you're not using improve_best_RISCC_read consistently! if len(self.RISCC_genome_side_aligned_reads) > 1: raise MutantError("Don't...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decide_if_replace_read(self, new_position, max_distance):\n # if there are no current reads, add new one\n if not len(self.RISCC_genome_side_aligned_reads): return True\n # if new read isn't \"confirming\", it can't be better\n if not self._if_confirming_read(new_posi...
[ "0.6512735", "0.5417415", "0.5378827", "0.529838", "0.52264994", "0.5187538", "0.51316535", "0.5130922", "0.51114696", "0.50881255", "0.507212", "0.50677633", "0.50491476", "0.5042516", "0.5040115", "0.5025903", "0.50158477", "0.5013767", "0.50123703", "0.5004463", "0.4994588...
0.6453743
1
Return the number of unique aligned genomeside positions that confirm the cassetteside position. ("Confirm" means same chromosome, consistent strand, and at most max_distance away)
def RISCC_N_confirming_seqs(self, max_distance=MAX_POSITION_DISTANCE): N = 0 for read_data in self.RISCC_genome_side_aligned_reads.values(): # skip non-aligned reads; check aligned reads for confirming. try: chrom = read_data[0].chromosome except At...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RISCC_N_non_confirming_seqs(self, max_distance=MAX_POSITION_DISTANCE):\n return len(self.RISCC_genome_side_aligned_reads) - self.RISCC_N_confirming_seqs(max_distance)", "def RISCC_N_confirming_reads(self, max_distance=MAX_POSITION_DISTANCE):\n N = 0\n for read_data in self.RISCC_genome_s...
[ "0.7093234", "0.7000722", "0.6597465", "0.64881676", "0.6190726", "0.61127645", "0.61078817", "0.5944024", "0.59060484", "0.5810861", "0.5786735", "0.57316", "0.5727625", "0.56644326", "0.5658276", "0.55661505", "0.5564351", "0.55567706", "0.5492828", "0.54168594", "0.5399307...
0.74679756
0
Return the number of unique aligned genomeside positions that DON'T confirm the cassetteside position. ("Confirm" means same chromosome, consistent strand, and at most max_distance away)
def RISCC_N_non_confirming_seqs(self, max_distance=MAX_POSITION_DISTANCE): return len(self.RISCC_genome_side_aligned_reads) - self.RISCC_N_confirming_seqs(max_distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RISCC_N_confirming_seqs(self, max_distance=MAX_POSITION_DISTANCE):\n N = 0\n for read_data in self.RISCC_genome_side_aligned_reads.values():\n # skip non-aligned reads; check aligned reads for confirming.\n try: chrom = read_data[0].chromosome\n ...
[ "0.71052176", "0.6717986", "0.6702725", "0.6263347", "0.60687333", "0.6005679", "0.59082055", "0.5855646", "0.58537626", "0.58399194", "0.56932026", "0.56851655", "0.56245494", "0.56210035", "0.54615045", "0.5412676", "0.5403656", "0.53759927", "0.53530586", "0.5343061", "0.5...
0.7175001
0
Return the number of aligned genomeside READS that confirm the cassetteside position. ("Confirm" means same chromosome, consistent strand, and at most max_distance away)
def RISCC_N_confirming_reads(self, max_distance=MAX_POSITION_DISTANCE): N = 0 for read_data in self.RISCC_genome_side_aligned_reads.values(): # skip non-aligned reads; check aligned reads for confirming. try: chrom = read_data[0].chromosome except A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RISCC_N_confirming_seqs(self, max_distance=MAX_POSITION_DISTANCE):\n N = 0\n for read_data in self.RISCC_genome_side_aligned_reads.values():\n # skip non-aligned reads; check aligned reads for confirming.\n try: chrom = read_data[0].chromosome\n ...
[ "0.82452977", "0.76317364", "0.7584211", "0.6724946", "0.62195504", "0.6124197", "0.6110739", "0.5961448", "0.59085256", "0.58062243", "0.57387584", "0.5732832", "0.57009476", "0.56621265", "0.5628521", "0.5623645", "0.56162757", "0.55914694", "0.5548447", "0.54905534", "0.53...
0.8187665
1
% of unique genomeside sequences that confirm the cassetteside position (same chrom/strand, within max_distance).
def RISCC_percent_confirming_seqs(self, max_distance=MAX_POSITION_DISTANCE, round_to_int=False): if not self.RISCC_N_aligned_seqs: return float('nan') else: percent = self.RISCC_N_confirming_seqs(max_distance) / self.RISCC_N_aligned_seqs * 100 if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RISCC_N_distinct_regions(self, max_distance=MAX_POSITION_DISTANCE):\n # TODO add options for minimum #seqs and #reads to count a region as valid!\n positions_by_chrom_strand = defaultdict(list)\n # add the cassette-side position (single)\n try:\n positions_by_chrom_strand...
[ "0.62409633", "0.60837936", "0.600813", "0.5950237", "0.59181535", "0.57900447", "0.57895535", "0.57555425", "0.5730142", "0.5715034", "0.5656748", "0.559014", "0.5582517", "0.5577179", "0.55734116", "0.5556264", "0.55458", "0.54965055", "0.54712254", "0.54615307", "0.5460545...
0.6144114
1
Return number of distinct insertion regions implied by RISCC data (genomic, cassette, and chromosomes). The output is a 3tuple giving the number of distinct genome and cassette regions, and the number of distinct noncassette chromosomes the regions are in. Positions on different chromosomes/strands are always counted a...
def RISCC_N_distinct_regions(self, max_distance=MAX_POSITION_DISTANCE): # TODO add options for minimum #seqs and #reads to count a region as valid! positions_by_chrom_strand = defaultdict(list) # add the cassette-side position (single) try: positions_by_chrom_strand[(self.pos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_complementary_regions(self):\n g = self._get_puncturefinder_graph()\n # return g.connected_components_number()\n return nx.number_connected_components(g)", "def test_count_genomic_region_sizes(self):\n \n regions = OrderedDict()\n regions[\"exons\"] = \"Exon\"\n ...
[ "0.61226624", "0.5953533", "0.59534246", "0.5841964", "0.583921", "0.5546408", "0.5498247", "0.54521364", "0.54442143", "0.54352367", "0.5194002", "0.51646143", "0.51610243", "0.51343906", "0.51083446", "0.5099048", "0.5060705", "0.5036289", "0.50274146", "0.50229055", "0.500...
0.82966596
0
Help function to get readinfocontaining object for both multidataset and single mutants. For multidataset, return self.by_dataset[dataset_name] if present if not present, raises an exception if strict, otherwise returns an empty readinfo object.
def read_info(self, dataset_name=None, strict=False): if dataset_name is None: raise MutantError("This is a multi-dataset mutant - must provide dataset_name arg!") if strict: self._check_dataset_presence(dataset_name) return self.by_dataset[dataset_name] els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_info(self, dataset_name=None, strict=False):\n if dataset_name is None: return self\n else: raise MutantError(\"This is NOT a multi-dataset mutant - cannot provide dataset_name arg!\")", "def _check_dataset_name_return_data(self, dataset_name, strict=False):\n ...
[ "0.7426683", "0.5558325", "0.52826", "0.5180236", "0.5094579", "0.49507886", "0.49337375", "0.490193", "0.48570403", "0.48174632", "0.48094055", "0.48014075", "0.47814924", "0.47698608", "0.47466514", "0.47369713", "0.47281137", "0.47247413", "0.47166374", "0.47152117", "0.47...
0.7791701
0
Add read to given dataset (see docstring for Insertional_mutant version) dataset_name is required.
def add_read(self, HTSeq_alignment, position=SPECIAL_POSITIONS.unknown, read_count=1, dataset_name=None): readcount_data_container = self._check_dataset_name_return_data(dataset_name) Insertional_mutant.add_read(readcount_data_container, HTSeq_alignment, position, read_count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_dataset(self, dataset: Dataset):\n pass", "def add_reference(self, dataset=None):\n if not dataset:\n raise aspecd.exceptions.MissingDatasetError\n dataset_reference = aspecd.dataset.DatasetReference()\n dataset_reference.from_dataset(dataset=dataset)\n se...
[ "0.6095995", "0.59818745", "0.5971621", "0.58394057", "0.57641375", "0.5694613", "0.56901795", "0.5672957", "0.56374884", "0.5603721", "0.5561695", "0.54902554", "0.5469454", "0.5448146", "0.5352664", "0.53225374", "0.5190837", "0.51891935", "0.51786965", "0.5148901", "0.5134...
0.6288449
0
Add counts to given dataset (see docstring for Insertional_mutant version) dataset_name is required.
def add_counts(self, total_count, perfect_count, sequence_variant_count, assume_new_sequences=False, dataset_name=None): readcount_data_container = self._check_dataset_name_return_data(dataset_name) Insertional_mutant.add_counts(readcount_data_container, total_count, perfect_count, sequence_variant_coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_dataset(self, dataset: Dataset):\n pass", "def add_sequence_and_counts(self, seq, seq_count, add_to_uniqseqcount=True, dataset_name=None):\n readcount_data_container = self._check_dataset_name_return_data(dataset_name)\n Insertional_mutant.add_sequence_and_counts(readcount_data_co...
[ "0.59968686", "0.56138575", "0.5464458", "0.5406013", "0.5392766", "0.5368051", "0.5356496", "0.5332156", "0.53183275", "0.52841157", "0.5158277", "0.5155341", "0.5072814", "0.5054961", "0.5034717", "0.5012029", "0.49825618", "0.49813405", "0.4977953", "0.49759346", "0.497493...
0.57066137
1
Add seqs/counts to given dataset (see docstring for Insertional_mutant version) dataset_name is required.
def add_sequence_and_counts(self, seq, seq_count, add_to_uniqseqcount=True, dataset_name=None): readcount_data_container = self._check_dataset_name_return_data(dataset_name) Insertional_mutant.add_sequence_and_counts(readcount_data_container, seq, seq_count, add_to_uniqseqcount, dataset_name=None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_dataset(self, dataset: Dataset):\n pass", "def add_dataset(self, task_name, dataset=None, *, aliases=None):\n self._datasets.append(dataset if dataset is not None else TaskData())\n last_index = len(self._datasets) - 1\n self._aliases[task_name] = last_index\n\n if a...
[ "0.58334297", "0.56141096", "0.5360643", "0.52961487", "0.5008856", "0.5008631", "0.49966735", "0.49872187", "0.49399087", "0.49057576", "0.48849142", "0.48333997", "0.48133266", "0.48062634", "0.47892147", "0.47850326", "0.47840506", "0.47757092", "0.4765327", "0.47402558", ...
0.65377134
0
Copy all readcountrelated data from other_mutant to self.by_dataset dictionary[other_mutant_dataset_name]. If self isn't a multidataset mutant, raise an exception. If check_constant_data is True, check that the position/gene data of self and other_mutant matches. If self already has a other_mutant_dataset_name dataset,...
def add_other_mutant_as_dataset(self, other_mutant, other_mutant_dataset_name, overwrite=False, check_constant_data=False): if other_mutant_dataset_name in self.by_dataset and not overwrite: raise MutantError("This mutant already has a %s dataset! Can't overwrite...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_single_dataset_mutant(self, single_dataset_name, force=False):\n if single_dataset_name not in self.by_dataset.keys() and not force:\n raise MutantError(\"This mutant doesn't have a %s dataset! \"%single_dataset_name\n +\"Use force=True argument if you want a...
[ "0.57595855", "0.57518274", "0.56194407", "0.55894625", "0.5359541", "0.5177784", "0.5133202", "0.48773158", "0.48567188", "0.47647667", "0.47475588", "0.47311136", "0.47105187", "0.46874717", "0.46292877", "0.45662835", "0.44594386", "0.44543228", "0.44340476", "0.44145992", ...
0.77522314
0
Return a singledataset mutant based on single_dataset_name; don't modify current mutant. If there is no single_dataset_name in current mutant's by_dataset dictionary, raise exception, unless force is True, then return new mutant with zero readcount.
def give_single_dataset_mutant(self, single_dataset_name, force=False): if single_dataset_name not in self.by_dataset.keys() and not force: raise MutantError("This mutant doesn't have a %s dataset! "%single_dataset_name +"Use force=True argument if you want a zero-readc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_info(self, dataset_name=None, strict=False):\n if dataset_name is None: return self\n else: raise MutantError(\"This is NOT a multi-dataset mutant - cannot provide dataset_name arg!\")", "def _ensure_dataset_None(dataset_name):\n if dataset_name is not None:...
[ "0.6210885", "0.61094046", "0.5971368", "0.59341747", "0.5776455", "0.54970247", "0.534117", "0.50612116", "0.49933696", "0.4967775", "0.4955689", "0.4900989", "0.47795683", "0.47575963", "0.47566655", "0.47380063", "0.470888", "0.46375087", "0.46355745", "0.46318737", "0.458...
0.8597811
0
Add notNone arg values to non_aligned_read_count, unaligned and multiple_aligned (or replace them). If the original values are None, or replace is True, replace instead of adding. If either the original or new value is 'unknown', the result is 'unknown' as well. If any of the args is None, don't modify the original val...
def add_nonaligned_reads(self, N_all_non_aligned, N_unaligned, N_multiple_aligned, replace=False): if N_all_non_aligned is not None: if 'unknown' in (N_all_non_aligned, self.non_aligned_read_count): self.non_aligned_read_count = 'unknown' elif replace or self.non_aligned_read_count is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_values(self, *values, replace=False):\n\n if replace: self.reset_values()\n for value in values: self.values += [tuple(value)]", "def add_inplace(a, b):", "def replace_na(data, replace=\"average\", remove=False, columns):\n \n return", "def _post_processing(\n kwargs, skip_tran...
[ "0.48802876", "0.48767427", "0.48273054", "0.47863755", "0.46374926", "0.45955205", "0.45936954", "0.45863825", "0.45304078", "0.4525031", "0.4487904", "0.4453184", "0.44289082", "0.43912235", "0.43337944", "0.43334466", "0.43315616", "0.4321398", "0.4320638", "0.43204042", "...
0.66629004
0
Return total number of reads in given chromosome.
def reads_in_chromosome(self, chromosome): return sum(m.read_info(self.dataset_name).total_read_count for m in self.dataset if m.position not in SPECIAL_POSITIONS.all_undefined and m.position.chromosome==chromosome)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self, chromosome):\n return self.chromosome_list.count(to_chromosome(chromosome))", "def test_count_total_reads(self):\n \n bam = pybedtools.BedTool(clipper.test_file(\"allup_test.bam\"))\n gene_dfn = pybedtools.BedTool(clipper.test_file(\"hg19_genes.bed\"))\n \n ...
[ "0.7780695", "0.66113275", "0.6425552", "0.6353458", "0.631541", "0.6280178", "0.6219694", "0.6006945", "0.59613764", "0.5910651", "0.58733356", "0.5851103", "0.58273345", "0.5808138", "0.57850856", "0.5781013", "0.5725598", "0.5714295", "0.5690985", "0.56745404", "0.5669577"...
0.8146626
0
Return total number of mutants in given chromosome.
def mutants_in_chromosome(self, chromosome): return sum(1 for m in self.dataset if m.read_info(self.dataset_name).total_read_count and m.position not in SPECIAL_POSITIONS.all_undefined and m.position.chromosome==chromosome)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self, chromosome):\n return self.chromosome_list.count(to_chromosome(chromosome))", "def N_genes_with_multiple_mutants(self):\n return len(self.genes_with_multiple_mutants)", "def reads_in_chromosome(self, chromosome):\n return sum(m.read_info(self.dataset_name).total_read_count ...
[ "0.7149963", "0.66784513", "0.622585", "0.6020063", "0.5979922", "0.5883878", "0.57367784", "0.5664344", "0.5582601", "0.55447096", "0.54473275", "0.54364485", "0.5431855", "0.53666407", "0.53529334", "0.5345837", "0.5343593", "0.53417605", "0.5323589", "0.52852833", "0.52449...
0.7370951
0
Return (gene_feature,count) list, biologically sorted, optionally with all "boundary" features counted as one. The source gene feature counts are based on the self.mutant_counts_by_feature dict. If merge_confusing_features==True, any locations containing '??' will be listed as '??'. If merge_boundary_features==True, an...
def merged_gene_feature_counts(self, merge_multi_splice_variants=True, merge_boundary_features=True, merge_confusing_features=False): merged_feature_count_dict = defaultdict(int) for feature, count in self.mutant_counts_by_feature.items(): # note that anyt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_feature_properties(self):\n\n self.valuecounts = {}\n self.unique_values = {}\n self.missing_ratios = {}\n self.counts = {}\n self.codemaps = {}\n for f in self.features:\n # Compute various things\n all_values = [self.data[l].get(f,\"?\")...
[ "0.55473757", "0.53517133", "0.5245574", "0.51562196", "0.51562196", "0.50710744", "0.5049784", "0.5049486", "0.50493675", "0.5034017", "0.5019584", "0.4977286", "0.4977015", "0.49388385", "0.49324378", "0.49211287", "0.490738", "0.49024293", "0.48971713", "0.48739794", "0.48...
0.7783929
0
Return list of mutants with the most total reads (in dataset if multidataset).
def most_common_mutants(self): highest_readcount = max([mutant.read_info(self.dataset_name).total_read_count for mutant in self.dataset]) highest_readcount_mutants = [mutant for mutant in self.dataset if mutant.read_info(self.dataset_name).total_read_count==highest_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _most_common_mutants_info(self, dataset=None):\n summ = self._get_summary(dataset)\n most_common_mutants = summ.most_common_mutants\n m = most_common_mutants[0]\n # calculate the fraction of total reads per mutant, assuming each mutant has the same readcount\n assert len(set(...
[ "0.6645123", "0.60265857", "0.58677876", "0.5824081", "0.57380396", "0.56142575", "0.5474463", "0.54287463", "0.53988177", "0.53356403", "0.5325521", "0.5312236", "0.5306984", "0.5294959", "0.52739036", "0.52482295", "0.523597", "0.5229304", "0.5223293", "0.5181166", "0.51745...
0.8272326
0
The set of all genes with at least one mutant in the dataset.
def all_genes_in_dataset(self): # the empty-set argument is needed in case there are no mutants in the dataset - set.union() with empty args is an error. return set.union(set(), *[set(genes) for N_mutants,genes in self.dataset.get_gene_dict_by_mutant_number(self.datase...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genes_with_multiple_mutants(self):\n # the empty-set argument is needed in case there are no mutants in the dataset - set.union() with empty args is an error.\n return set.union(set(), *[set(genes) for N_mutants,genes \n in self.dataset.get_gene_dict_by_mutant_num...
[ "0.8123009", "0.68949455", "0.6383538", "0.6354511", "0.6219542", "0.60233015", "0.5985441", "0.59377563", "0.5882648", "0.5832713", "0.5786872", "0.57491076", "0.574446", "0.57376844", "0.5717273", "0.57007015", "0.5654419", "0.56425226", "0.56347936", "0.5625611", "0.560976...
0.84716815
0
The set of all genes with at TWO OR MORE mutants in the dataset.
def genes_with_multiple_mutants(self): # the empty-set argument is needed in case there are no mutants in the dataset - set.union() with empty args is an error. return set.union(set(), *[set(genes) for N_mutants,genes in self.dataset.get_gene_dict_by_mutant_number(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_genes_in_dataset(self):\n # the empty-set argument is needed in case there are no mutants in the dataset - set.union() with empty args is an error.\n return set.union(set(), *[set(genes) for N_mutants,genes \n in self.dataset.get_gene_dict_by_mutant_number(sel...
[ "0.80721563", "0.6948248", "0.6710061", "0.6352312", "0.6285758", "0.61776936", "0.5969346", "0.5953357", "0.59360653", "0.5895782", "0.58800334", "0.5838031", "0.5808292", "0.57483584", "0.57375014", "0.5725144", "0.5679366", "0.5675286", "0.5651269", "0.5647856", "0.5641494...
0.8549979
0
The number of genes with TWO OR MORE mutants in the dataset.
def N_genes_with_multiple_mutants(self): return len(self.genes_with_multiple_mutants)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n(self):\n return len(self.genotypes)", "def getNumGenerations(self):\n return 1 + max(m.getNumGenerations() for m in self.members)", "def __len__(self) -> int:\n return len(self.__mutants)", "def N_genes_in_dataset(self):\n return len(self.all_genes_in_dataset)", "def gener...
[ "0.67937684", "0.67046225", "0.66733754", "0.66237825", "0.647608", "0.6352982", "0.62766045", "0.6200753", "0.605528", "0.6032482", "0.6026197", "0.59705", "0.5969641", "0.595732", "0.59484786", "0.5943661", "0.5912949", "0.59030277", "0.5875975", "0.5866802", "0.5833311", ...
0.8153984
0
Add mutant to dataset.
def add_mutant(self, mutant, overwrite=False): if mutant.IB in self._mutants_by_IB.keys() and not overwrite: raise MutantError("Can't add mutant that would overwrite previous mutant with same IB! " +"Pass overwrite=True argument if you want to overwrite.") self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_dataset(self, dataset: Dataset):\n pass", "def add_other_mutant_as_dataset(self, other_mutant, other_mutant_dataset_name, \n overwrite=False, check_constant_data=False):\n if other_mutant_dataset_name in self.by_dataset and not overwrite:\n r...
[ "0.6655881", "0.6413176", "0.6019999", "0.5857906", "0.56514895", "0.55309415", "0.54926395", "0.54362386", "0.5384364", "0.53043133", "0.52475846", "0.5245322", "0.5234252", "0.5210368", "0.51780087", "0.51474565", "0.5071842", "0.50533676", "0.5048791", "0.50422263", "0.501...
0.6503815
1
Remove mutant (by IB) can take a mutant or a IB.
def remove_mutant(self, mutant_or_IB): try: IB = mutant_or_IB.IB except AttributeError: IB = mutant_or_IB del self._mutants_by_IB[IB]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mutant(self, IB):\n return self._mutants_by_IB[IB]", "def _should_remove(self, mac, obj):\n ret = False\n if getattr(obj, self.toggle_val) == self.toggle_check\\\n and self.toggle.state == 'down':\n ret = True\n return ret", "def remove_tactic(self)...
[ "0.60149795", "0.59993804", "0.5992167", "0.59284204", "0.5794964", "0.5737003", "0.5682585", "0.56353986", "0.5630366", "0.5546742", "0.55403596", "0.5524952", "0.54973835", "0.54950535", "0.5481185", "0.54774433", "0.54470277", "0.543319", "0.5393304", "0.5376256", "0.53755...
0.79588664
0
Return the mutant with given IB. If mutant doesn't exist, create a new one with no position/reads/sequences.
def get_mutant(self, IB): return self._mutants_by_IB[IB]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_mutant(self, mutant, overwrite=False):\n if mutant.IB in self._mutants_by_IB.keys() and not overwrite:\n raise MutantError(\"Can't add mutant that would overwrite previous mutant with same IB! \"\n +\"Pass overwrite=True argument if you want to overwrite.\")\n...
[ "0.6065721", "0.5824929", "0.57916296", "0.5720389", "0.55480236", "0.50881934", "0.47943345", "0.4750953", "0.46834594", "0.4654471", "0.46411258", "0.45736966", "0.45549503", "0.45424083", "0.44928995", "0.44865704", "0.44850048", "0.44817802", "0.44811586", "0.44272077", "...
0.7926696
0
Check if dataset contains mutant with given IB. You can only check "IB in dataset" at present, not "mutant in dataset", since the latter would probably also just check by IB, so the syntax would be misleading.
def __contains__(self, IB): return IB in self._mutants_by_IB
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_improper(i0, i1, i2, i3, bond_set):\n if len(set([i0, i1, i2, i3])) == 4:\n if not ((i0, i1) in bond_set and (i1, i2) in bond_set and (i2, i3) in bond_set):\n return True\n return False", "def is_in(batch, data):\n _id = batch[-1]\n for d in data:\n if d[-1] == _id:\n ...
[ "0.59588236", "0.5774592", "0.57421535", "0.56637824", "0.5647611", "0.56438285", "0.55813533", "0.55634737", "0.55409455", "0.5475241", "0.54204434", "0.5393025", "0.5378124", "0.5369297", "0.5363346", "0.5348287", "0.5324083", "0.52803415", "0.5260735", "0.52119124", "0.517...
0.7593823
0
grab the next alignment object from the generator until the name matches ref_name.
def _next_until_name_match(generator, ref_name): curr_name = '' while not curr_name == ref_name: curr_aln = generator.next() curr_name = curr_aln.read.name.split()[0] return curr_aln
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __next__(self):\n try:\n stream = self._stream\n except AttributeError:\n raise StopIteration from None\n alignment = self._read_next_alignment(stream)\n if alignment is None:\n raise StopIteration\n return alignment", "def __next__(self):\n...
[ "0.63519776", "0.5905411", "0.5886675", "0.5681925", "0.55885965", "0.5567959", "0.5484562", "0.54833126", "0.54559267", "0.54559267", "0.54290843", "0.542644", "0.5404576", "0.53900135", "0.5364065", "0.5349766", "0.53343314", "0.533246", "0.533246", "0.533246", "0.53069097"...
0.7791878
0
Parse fastq+sam+sam files in parallel generator yielding (name, seq1, aln2, aln3) tuples. It checks that the read names match (except for the pairedend side or anything else after a space). It assumes that file1 is the reference, and the other two files may have some extra names (will be ignored).
def _parse_3files_parallel(cls, file1_fastx, file2_sam, file3_sam): generator1 = name_seq_generator_from_fasta_fastq(file1_fastx) generator2 = iter(HTSeq.SAM_Reader(file2_sam)) generator3 = iter(HTSeq.SAM_Reader(file3_sam)) if_finished_1, if_finished_2, if_finished_3 = False, False, Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fusion(first_fh, fused_fh, compare_file):\r\n # initialize\r\n ha_seq = \"\"\r\n ha_header = \"\"\r\n # parse through file\r\n for line in first_fh:\r\n # if a > is found assume it is header\r\n if line[0] == \">\":\r\n # ha_header = line\r\n # if the header i...
[ "0.6319581", "0.61748374", "0.61733645", "0.61505145", "0.60918087", "0.6071285", "0.6036485", "0.60167056", "0.59617764", "0.5954194", "0.5929781", "0.59196126", "0.58673304", "0.57962865", "0.5796238", "0.5788439", "0.5781865", "0.57712334", "0.57695675", "0.57692546", "0.5...
0.7638636
0
Add pairedend RISCC reads to dataset mutants, based on IB clustering.
def add_RISCC_alignment_files_to_data(self, cassette_side_flank_aligned_file, genome_side_aligned_file, IB_fastq_file, allowed_IBs=None, IB_cluster_file=None, best_genome_side_only=False, ignore_unaligned=False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assign_reads( medians, centroids ):\n log.info(\"Assigning subreads reads to the closet amplicon cluster\")\n assignments = {'5p':set(), '3p':set()}\n five_prime, three_prime = centroids\n for read, median in medians.iteritems():\n five_prime_diff = abs(median - five_prime)\n three_p...
[ "0.5384356", "0.50701267", "0.50394577", "0.49323264", "0.48745298", "0.4874417", "0.4799774", "0.47634873", "0.47457853", "0.47029266", "0.46941206", "0.46837968", "0.46686867", "0.46466538", "0.4642227", "0.46303773", "0.46147153", "0.46107095", "0.46027693", "0.46007156", ...
0.6346291
0
Set self.gene_annotation_header and self.total_genes_in_genome based on inputs. Set to blank if all inputs are blank; otherwise to the single unique nonblank value on the list; if there are multiple distinct nonblank values, raise exception.
def _set_joint_genome_info(self, gene_annotation_header_values, total_genes_in_genome_values): # Merge any pieces of global information that's not per-dataset self.gene_annotation_header = merge_values_to_unique(gene_annotation_header_values, blank_value=[], convert_for_set=tuple, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_empty_geomean_vals(product):\n\theaders = ['chemaxon', 'epi', 'test', 'sparc', 'geomean', 'measured']\n\tfor prop_data_list in product['data']:\n\t\tif len(prop_data_list) < len(headers):\n\t\t\tprop_data_list.append('')\n\treturn product", "def coerce_empty_numeric_values(self):\n if \"numeric\"...
[ "0.5443785", "0.48637012", "0.48046562", "0.47582003", "0.4712509", "0.46778277", "0.4662032", "0.4654403", "0.4654403", "0.45855978", "0.45841703", "0.45520344", "0.45424688", "0.45242676", "0.451611", "0.4511423", "0.44895178", "0.44530323", "0.43801317", "0.4379961", "0.43...
0.6543988
0
List of all mutants with nonzero reads in dataset_name (or all mutants if dataset_name=None).
def mutants_in_dataset(self, dataset_name=None): return [mutant for mutant in self if dataset_name is None or mutant.by_dataset[dataset_name].total_read_count>0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_genes_in_dataset(self):\n # the empty-set argument is needed in case there are no mutants in the dataset - set.union() with empty args is an error.\n return set.union(set(), *[set(genes) for N_mutants,genes \n in self.dataset.get_gene_dict_by_mutant_number(sel...
[ "0.6230707", "0.537474", "0.53254586", "0.52580535", "0.5242609", "0.4971017", "0.4961417", "0.49199918", "0.49074063", "0.49041936", "0.48865938", "0.48811442", "0.48632625", "0.48450068", "0.48434752", "0.4763551", "0.47558308", "0.4752522", "0.4736801", "0.47363997", "0.47...
0.8349818
0
Raise MutantError if self.summary, mutants, and sef.dataset_order don't all have the same set of datasets!
def _check_dataset_consistency(self): if not self.multi_dataset: raise MutantError("_check_dataset_consistency only makes sense for multi-datasets!") def _check_sets_raise_error(set1, set2, set1_name, set2_name): if not set1==set2: raise MutantError("Multi-datas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ensure_dataset_None(dataset_name):\n if dataset_name is not None:\n raise MutantError(\"Don't try to provide a dataset_name on a single mutant (rather than the multi-dataset subclass)!\")\n # MAYBE-TODO this could be accomplished with a decorator instead, right?", "def test_duplicat...
[ "0.60590947", "0.5892247", "0.58170164", "0.5749973", "0.5669064", "0.56428903", "0.56069684", "0.5565046", "0.55602545", "0.5522278", "0.55144644", "0.55016494", "0.5482615", "0.54678094", "0.5438125", "0.54357666", "0.54034233", "0.5400385", "0.538548", "0.53822416", "0.537...
0.78113204
0
A specific order of datasets, for printing can be set directly, defaults to alphabetical sort.
def dataset_order(self): self._check_dataset_consistency() try: return self._dataset_order except AttributeError: return sorted(self.summary.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_by_default(self):\n self.data.sort()", "def test_categories_are_sorted(self):\n self.data_sorted(self.test_data['shirts'], self.test_data['pants'])", "def sort_music_data(sort_by = None):\n for lists in read_file():\n print(lists)\n pass", "def _reorder_collected(self, dat...
[ "0.6724266", "0.6340067", "0.6126065", "0.6017532", "0.6009489", "0.59664404", "0.59582067", "0.59187067", "0.5870945", "0.5865429", "0.5843606", "0.584108", "0.5812359", "0.5812359", "0.5776693", "0.577544", "0.57472616", "0.56993455", "0.56975144", "0.56738526", "0.56730783...
0.74094456
0
Remove any mutants with at least readcount_min reads in other_dataset (or perfect reads, if perfect_reads=True)
def remove_mutants_in_other_dataset(self, other_dataset, readcount_min=1, perfect_reads=False): # TODO do I want this to be based on non-exact position equality instead? if perfect_reads: get_readcount = lambda m: m.perfect_read_count else: get_readcount = lambda m: m.total_read_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_mutants_not_in_other_dataset(self, other_dataset, readcount_min=1, perfect_reads=False):\n # TODO do I want this to be based on non-exact position equality instead?\n if perfect_reads: get_readcount = lambda m: m.perfect_read_count\n else: get_readcount = lambda m: m...
[ "0.7992664", "0.7603158", "0.6634517", "0.5842482", "0.5786048", "0.563014", "0.55709016", "0.5474332", "0.5413037", "0.5322938", "0.52375", "0.5231341", "0.51369655", "0.5125441", "0.5116463", "0.5109765", "0.5081535", "0.5081438", "0.5073213", "0.5072249", "0.50319", "0.5...
0.7930307
1
Remove any mutants with at least readcount_min reads in other_dataset (or perfect reads, if perfect_reads=True)
def remove_mutants_not_in_other_dataset(self, other_dataset, readcount_min=1, perfect_reads=False): # TODO do I want this to be based on non-exact position equality instead? if perfect_reads: get_readcount = lambda m: m.perfect_read_count else: get_readcount = lambda m: m.total_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_mutants_in_other_dataset(self, other_dataset, readcount_min=1, perfect_reads=False):\n # TODO do I want this to be based on non-exact position equality instead?\n if perfect_reads: get_readcount = lambda m: m.perfect_read_count\n else: get_readcount = lambda m: m.tot...
[ "0.7931165", "0.76038706", "0.66349447", "0.5843144", "0.5782819", "0.5628872", "0.5569599", "0.5472574", "0.54124075", "0.53238225", "0.5237388", "0.52301025", "0.5135954", "0.51233846", "0.5114688", "0.51076555", "0.5081119", "0.5079994", "0.50722814", "0.50722796", "0.5031...
0.79933906
0
Remove any mutants with below readcount_min reads (or perfect reads, if perfect_reads=True)
def remove_mutants_below_readcount(self, min_readcount, perfect_reads=False): if perfect_reads: get_readcount = lambda m: m.perfect_read_count else: get_readcount = lambda m: m.total_read_count # go over all mutants in self; need to convert dataset to a list to make a separate co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_mutants_not_in_other_dataset(self, other_dataset, readcount_min=1, perfect_reads=False):\n # TODO do I want this to be based on non-exact position equality instead?\n if perfect_reads: get_readcount = lambda m: m.perfect_read_count\n else: get_readcount = lambda m: m...
[ "0.7271599", "0.71542186", "0.65226847", "0.6235168", "0.5892789", "0.5843919", "0.58214986", "0.5782074", "0.5752648", "0.5536262", "0.5524399", "0.551734", "0.5517231", "0.5339049", "0.5330954", "0.53044456", "0.5239596", "0.5233504", "0.5209945", "0.51907754", "0.5190602",...
0.837361
0
To each mutant in the dataset, add the gene it's in (look up gene positions for each mutant using genefile). ALSO add gene data to all the RISCCgenomesideread mutants inside each mutant! If detailed_features is True, also look up whether the mutant is in an exon/intron/UTR. Read the file in N_run_groups passes to avoid...
def find_genes_for_mutants(self, genome_version, genefile, detailed_features=True, include_RISCC_reads=False, nearest_genes_for_intergenic=False, N_run_groups=3, verbosity_level=1): if self.multi_dataset: raise MutantError("find_genes_for_mutants not implemented for multi-datas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proc_dataset_v2(write=False):\n \n path = load_config()\n M = pd.read_csv(path['metadata_file'])\n T = pd.read_csv(path['rna_file'])\n mCH = pd.read_csv(path['mCH_file'])\n CH = pd.read_csv(path['CH_file'])\n\n def format_df(df):\n \"\"\"The inputs are genes x cells. Transpose data ...
[ "0.5643232", "0.56289685", "0.54290247", "0.5406451", "0.5230023", "0.52227926", "0.52050686", "0.5192278", "0.51909274", "0.51697755", "0.5094837", "0.50822145", "0.5081997", "0.50698656", "0.5034037", "0.50327355", "0.5028977", "0.5021501", "0.50142425", "0.4978028", "0.497...
0.74304503
0
Add gene annotation data to mutant.gene_annotation, including multiplegene cases; return True if annotations found. If mutant.gene is a single, this just gets the annotation list for it from gene_annotation_dict and puts that in mutant.gene_annotation (or [] if the gene isn't in gene_annotation_dict); If mutant.gene is...
def _get_annotation_for_gene(gene, gene_annotation_dict): # grab annotations for each gene annotations = [] for gene in gene.split(MULTIPLE_GENE_JOIN): try: annotations.append(gene_annotation_dict[gene]) except KeyError: pass # make joint annotat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_gene_annotation(self, genome_version, include_RISCC_reads=False, print_info=False):\n # add the annotation info to each mutant (or nothing, if gene has no annotation)\n # MAYBE-TODO should I even store gene annotation in each mutant (AND in each genome-side LEAPseq read), or just keep a separ...
[ "0.6410096", "0.55775297", "0.5299767", "0.52662283", "0.5193791", "0.51118064", "0.5048886", "0.5045176", "0.50307804", "0.501942", "0.5001189", "0.49972197", "0.4995329", "0.4965884", "0.48947483", "0.48524985", "0.48483244", "0.48313758", "0.4829132", "0.48207685", "0.4760...
0.7736066
0
Add gene annotation to each mutant, based on multiple annotation_files for that genome version.
def add_gene_annotation(self, genome_version, include_RISCC_reads=False, print_info=False): # add the annotation info to each mutant (or nothing, if gene has no annotation) # MAYBE-TODO should I even store gene annotation in each mutant (AND in each genome-side LEAPseq read), or just keep a separate per...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overall_annotation_function(path_to_species_trees, path_to_gene_trees, project_name = \"myproject\", path_to_ranger_outputs = \"\", ):\r\n\r\n #initially gather the names of the datasets from the species_trees folder\r\n dataset_names = gather_dataset_names(path_to_species_trees, project_name, \"_CC\")\r...
[ "0.63150656", "0.6087792", "0.5909039", "0.5808526", "0.57750446", "0.57686114", "0.5724871", "0.57081753", "0.56716824", "0.5651769", "0.5627074", "0.5604145", "0.55674523", "0.5563889", "0.55331784", "0.55304426", "0.55254304", "0.55189997", "0.5511156", "0.5480355", "0.547...
0.7471653
0
Return a string containing details for most common mutant, or count of most common mutants if multiple.
def _most_common_mutants_info(self, dataset=None): summ = self._get_summary(dataset) most_common_mutants = summ.most_common_mutants m = most_common_mutants[0] # calculate the fraction of total reads per mutant, assuming each mutant has the same readcount assert len(set([m.read_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_common_mutants(self):\n highest_readcount = max([mutant.read_info(self.dataset_name).total_read_count for mutant in self.dataset])\n highest_readcount_mutants = [mutant for mutant in self.dataset \n if mutant.read_info(self.dataset_name).total_read_count==...
[ "0.66965836", "0.6349603", "0.62805444", "0.6122623", "0.57724065", "0.5698563", "0.56918824", "0.56918824", "0.5688887", "0.5688197", "0.5687104", "0.5631871", "0.5602505", "0.5602353", "0.557191", "0.5551334", "0.5520492", "0.54514843", "0.53785723", "0.5359715", "0.5350116...
0.7904284
0
Sort the mutants by position or readcount, or leave unsorted.
def _sort_data(self, sort_data_by='position'): all_mutants = iter(self) if sort_data_by=='position': sorted_data = sorted(all_mutants, key = lambda m: (m.position, m.IB)) # x.position here is an Insertion_position object and has a sensible cmp function # TODO do unali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_reads(self): \n if not self.sampling:\n self.convert_to_array()\n self.reads = self.reads[self.reads[:,0].argsort()]", "def sort_mutations(self, mutations):\n return sorted(mutations, key=operator.itemgetter(\"offset\"))", "def sort_cards(self):\n self.cards.sort...
[ "0.5964748", "0.58288926", "0.5742678", "0.57124084", "0.5697459", "0.56780016", "0.5552178", "0.5547821", "0.5540576", "0.5532421", "0.5527822", "0.54764074", "0.5459857", "0.54162335", "0.53919667", "0.53919667", "0.53723526", "0.5371294", "0.5365716", "0.53613347", "0.5360...
0.72632295
0
Write detailed RISCC data (all reads per mutant) to separate file.
def print_detailed_RISCC_data(self, OUTPUT=sys.stdout, sort_data_by=None, max_distance=MAX_POSITION_DISTANCE): # TODO docstring! # TODO should probably add header # TODO add annotation! # TODO change this to be a proper tab-separated file? ### sort all mutants by position or re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_output(pris):\n pris.to_csv('reactors_pris_2016.csv',\n index=False,\n sep=',',\n )", "def write_rcm(self,rcm_filename):\n \n if(self.buildingsAdded != True):\n self.run_nc.add_building_output_locations({}, 0, 0,0) #Set build...
[ "0.5820573", "0.5751511", "0.57284915", "0.56944907", "0.5619381", "0.56188095", "0.55729157", "0.55714667", "0.55704516", "0.55553466", "0.5552754", "0.55219156", "0.5521283", "0.5508681", "0.5494961", "0.54939115", "0.548014", "0.5462899", "0.5447348", "0.5435847", "0.54278...
0.63001347
0
Read mutant input file, return as new dataset (.pickle format only).
def read_mutant_file(infile): return unpickle(infile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data_set():\n # shapes of datasets -- [] means expanded form:\n # - X: J\n # - net.R: J [x J x 1]\n # - F_DIST: J x J x num_features\n # - F_DIST_w1: J x J x num_features\n # - w['except_first'][-1]: (last weights) J x num_features [x 1]\n # - w['except_first'][1:-1]: (second to last ...
[ "0.6097754", "0.59648234", "0.59588504", "0.58907497", "0.5883596", "0.5860291", "0.5846655", "0.5843215", "0.57745373", "0.57522935", "0.57493174", "0.5684077", "0.5683538", "0.5667257", "0.5662685", "0.56449974", "0.5636096", "0.5633263", "0.56238824", "0.5590493", "0.55816...
0.7560404
0
Check that the function returns the right SPECIAL_POSITIONS object when given an unaligned HTSeq aln.
def _check_unaligned_alns(self, aln_parse_function, *extra_args): fake_aln_unaligned_1 = Fake_HTSeq_aln('AAA', 'name', unaligned=True, optional_field_data={'XM':1}) fake_aln_unaligned_2 = Fake_HTSeq_aln('AAA', 'name', unaligned=True, optional_field_data={}) fake_aln_multi_aligned_1 = Fak...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_align_unaligned_seqs(self):\n res = align_unaligned_seqs(self.seqs1_fp, RNA)\n self.assertEqual(res.toFasta(), self.seqs1_aln)", "def test_get_align_coords(self):\n # 01234 5\n # ACGGT--A\n # 012345\n # --GGTTTA\n m1, seq1 = DNA.make_seq(\"ACGGT--A\")....
[ "0.63133895", "0.55383784", "0.5371149", "0.5285918", "0.5271198", "0.51925683", "0.5169525", "0.5145871", "0.5103414", "0.5064759", "0.50444007", "0.4977112", "0.49596253", "0.4956812", "0.49547723", "0.49426582", "0.49426582", "0.49426582", "0.49426582", "0.49426582", "0.49...
0.68770176
0
Check basic inputs for function that takes (read_aln_or_pos, cassette_end, relative_read_direction).
def _check_basic_pos_inputs(self, get_pos_function): # should raise exception for invalid argument (valid arguments: HTSeq position object or (chrom,start,end,strand) tuple # (strand must be +/-, and start can't be after end) for bad_flanking_region in [None, '', 'aaa', 0, 1, 0.65, [], {}, True...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_common_args(args, function_name,\n valid_functions=['gaperture', 'gmap', 'gfind'],\n allow_no_coords=False):\n\n try:\n function_name = function_name.strip().lower()\n except AttributeError:\n raise gPhotonArgsError(\"Invalid function: {f}\".f...
[ "0.5927966", "0.59214574", "0.5877408", "0.5834172", "0.57960546", "0.5730392", "0.57066596", "0.56749415", "0.5674913", "0.5639737", "0.56005573", "0.557201", "0.5553413", "0.5532597", "0.5499041", "0.54693806", "0.5468923", "0.54674524", "0.54220945", "0.5385928", "0.538433...
0.68425304
0
Convenience function to make the args to Fake_HTSeq_genomic_pos from an Insertion_position
def _make_pos(pos): return pos.chromosome, pos.strand, pos.min_position, pos.min_position+20
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, chromosome, strand, full_position=None, position_before=None, position_after=None, immutable=False):\n # need to make instance mutable to be able to set anything, due to how __setattr__ is decorated\n self.make_mutable_REMEMBER_CLEANUP_FIRST() \n # now start setting attribu...
[ "0.5913934", "0.5540507", "0.5540507", "0.5540507", "0.5540507", "0.5540507", "0.5540507", "0.5540507", "0.5540507", "0.5540507", "0.5540507", "0.5540507", "0.55009013", "0.55009013", "0.55009013", "0.55009013", "0.55009013", "0.55009013", "0.55009013", "0.55009013", "0.55009...
0.5741503
1
Help method to quickly make a dataset based on a string of mutant positions/readcounts. Commaseparated mutants, first word is position, second is readcount. "+100 5, A100 10/10, cassette+400 1" Position is chromosome+strand+minpos, with chromosome optional and more complicated. If raw_chrom_names, just take the chromos...
def _make_test_mutant_dataset(positions_and_readcounts_string, raw_chrom_names=False): dataset = Insertional_mutant_pool_dataset() if not positions_and_readcounts_string: return dataset for N, string in enumerate(positions_and_readcounts_string.split(', ')): raw_pos, rea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findMutations(trimmed_consensus, trimmed_mutant, counting_direction):\n\tmutations = \"\"\n\tcount = 0 \n\tif counting_direction == \"r\":\n\t\ttrimmed_consensus = invertString(trimmed_consensus)\n\t\ttrimmed_mutant = invertString(trimmed_mutant)\n\tfor i in range(len(trimmed_consensus)):\n\t\tconsensus = trim...
[ "0.49266934", "0.48673043", "0.48296267", "0.4801651", "0.47721255", "0.47520983", "0.4717786", "0.46513838", "0.4617326", "0.45733854", "0.4565814", "0.4553901", "0.45357215", "0.4524307", "0.45105764", "0.44691744", "0.44661796", "0.44487408", "0.44387537", "0.44363236", "0...
0.7758807
0
What to make sure that any changes I make still allow the datasets to be pickled/unpickled correctly, since some stuff like lambdas and __slots__ etc interferes with that.
def test__pickle_unpickle(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pickle():\r\n M = Module()\r\n M.x = (T.dmatrix())\r\n M.y = (T.dmatrix())\r\n a = T.dmatrix()\r\n M.f = Method([a], a + M.x + M.y)\r\n M.g = Method([a], a * M.x * M.y)\r\n\r\n mode = get_mode()\r\n m = M.make(x=numpy.zeros((4,5)), y=numpy.ones((2,3)), mode=mode)\r\n\r\n m_dup =...
[ "0.62170494", "0.61310524", "0.59855705", "0.5935278", "0.5901065", "0.58910406", "0.58880556", "0.5863765", "0.5853036", "0.5848496", "0.5726836", "0.572173", "0.5718709", "0.56999195", "0.5698243", "0.56816524", "0.56652796", "0.56592995", "0.56532854", "0.5632119", "0.5606...
0.6965079
0
Ask user what style of drink they like
def drink_style_input(): # Define answered style questions dictionary answers_style = {} # Loop through style questions for style, question in questions.iteritems(): # Ask whether they like a drink style and set to lower case # Test if answer is yes, then add drink style and boolean to dictionary a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n answers_style = drink_style_input()\n drink = drink_make(answers_style)\n print \"\"\n print \"Your drink includes:\"\n for ingredient in drink:\n print \"A {}\".format(ingredient)", "def drink_make(drink_styles): \n # Define empty list for drink\n drink_ingredients = [] \n # Loop thro...
[ "0.639712", "0.63034374", "0.59951705", "0.5833803", "0.57443935", "0.57302874", "0.55725485", "0.5533288", "0.549301", "0.54182047", "0.5369108", "0.5357277", "0.5327648", "0.5317922", "0.5311883", "0.5305208", "0.5300284", "0.52954954", "0.5273153", "0.52573305", "0.5235851...
0.7765335
0
Construct drink using user's style preferences and ingredients by style
def drink_make(drink_styles): # Define empty list for drink drink_ingredients = [] # Loop through styles and add random ingredient to drink list for style, selected in drink_styles.iteritems(): # Test whether style selected by user if selected == True: drink_ingredients.append(random.choice(in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n answers_style = drink_style_input()\n drink = drink_make(answers_style)\n print \"\"\n print \"Your drink includes:\"\n for ingredient in drink:\n print \"A {}\".format(ingredient)", "def make_drink ():\n \n customer_pref = customer_order.drink_order()\n drink = []\n \n for p...
[ "0.64675385", "0.625151", "0.6151498", "0.6134938", "0.61196727", "0.61048126", "0.60791534", "0.607719", "0.60167503", "0.5968282", "0.59542197", "0.5853176", "0.5558934", "0.54750603", "0.52756566", "0.5242397", "0.5206469", "0.5190345", "0.5181955", "0.51619166", "0.512094...
0.793936
0
Run Pirate Bartender Ask user for styles and return drink ingredients
def main(): answers_style = drink_style_input() drink = drink_make(answers_style) print "" print "Your drink includes:" for ingredient in drink: print "A {}".format(ingredient)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drink_make(drink_styles): \n # Define empty list for drink\n drink_ingredients = [] \n # Loop through styles and add random ingredient to drink list\n for style, selected in drink_styles.iteritems():\n # Test whether style selected by user\n if selected == True:\n drink_ingredients.append(rand...
[ "0.6478046", "0.5842075", "0.5710219", "0.56645936", "0.56446636", "0.5596086", "0.5570129", "0.551248", "0.550472", "0.5448311", "0.54283273", "0.54248184", "0.5390015", "0.5384944", "0.5377172", "0.53676957", "0.53014386", "0.5243002", "0.52425283", "0.52145404", "0.5190738...
0.69387525
0
Independence Day in the United States, celebrated on July 4th. May be observed on the previous or following day if it occurs on a Saturday or Sunday.
def independence_day(year, observed=None): day = 4 if observed: weekday = calendar.weekday(year, JUL, 4) if weekday == SAT: day = 3 if weekday == SUN: day = 5 return (year, JUL, day)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hebrew_independence_day(self, jewish_year):\n month = 2\n day = 5\n original_hebrew_independence_date = HebrewDate(jewish_year, month, day)\n if original_hebrew_independence_date.weekday() == 6:\n day = 4\n if original_hebrew_independence_date.weekday() == 7:\n...
[ "0.6554653", "0.5694261", "0.5676444", "0.56217307", "0.56001997", "0.55737984", "0.55195194", "0.5491033", "0.5477347", "0.54401356", "0.54395264", "0.5433216", "0.5433216", "0.54014236", "0.5388311", "0.53674847", "0.53637344", "0.534773", "0.5320098", "0.5271103", "0.52643...
0.73383605
0
In most jurisdictions in the United States, Election day occurs on the first Tuesday in November.
def election_day(year): return nth_day_of_month(1, TUE, NOV, year)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meetup_day(year, month, day_of_week, day_occurrence):\n \n cal = calendar.monthcalendar(year, month)\n day_of_week_index = days_of_week[day_of_week]\n \n not_teenth = day_occurrence != 'teenth'\n day_is_in_first_week = cal[0][day_of_week_index] != 0\n \n if not_teenth and day_is_in_firs...
[ "0.66748834", "0.5912463", "0.5869916", "0.5838318", "0.5838318", "0.5784695", "0.57811135", "0.5774078", "0.5763169", "0.5745868", "0.5739217", "0.5718777", "0.5713595", "0.56897986", "0.56897986", "0.5679064", "0.564338", "0.5631577", "0.5598538", "0.5595918", "0.55901814",...
0.6208247
1
Christmas is celebrated on the 25th of December. For the purposes of business closings, it may be observed on the previous or following day if the 25th falls on a Saturday or Sunday, respectively.
def christmas(year, observed=None): day = 25 if observed: weekday = calendar.weekday(year, DEC, 25) if weekday == SAT: day = 24 if weekday == SUN: day = 26 return (year, DEC, day)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_until_christmas(d):\n import datetime\n\n if d == None:\n return None\n\n xmas_this = datetime.date(d.year, 12, 25)\n xmas_next = datetime.date(d.year + 1, 12, 25)\n\n if d == xmas_this:\n return 0\n elif d < xmas_this:\n return (xmas_this - d).days\n else:\n ...
[ "0.5951745", "0.58248746", "0.5754146", "0.5656661", "0.5640452", "0.55025434", "0.5470026", "0.5448984", "0.5358766", "0.5263799", "0.5253447", "0.52255183", "0.5210289", "0.52096266", "0.5208944", "0.5208575", "0.5197862", "0.51868194", "0.51768965", "0.5165653", "0.5148891...
0.64039904
0
Tu BeShvat, the 'New Year of Trees', is celebrated on the 15th of Shevat.
def tu_beshvat(year, eve=None): jd = hebrew.to_jd_gregorianyear(year, hebrew.SHEVAT, 15) if eve: jd = jd - 1 return gregorian.from_jd(jd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twenty_seventeen():\n return 2017", "def yearlyDepreciation():\n return .10", "def increment_year(self):", "def sukkot(year, eve=None):\n jd = hebrew.to_jd_gregorianyear(year, hebrew.TISHRI, 15)\n if eve:\n jd = jd - 1\n return gregorian.from_jd(jd)", "def new_years_eve(year):...
[ "0.6772096", "0.64986193", "0.6126908", "0.6072159", "0.606915", "0.59305495", "0.5918589", "0.5857435", "0.5834787", "0.5815584", "0.5772973", "0.5769094", "0.5739822", "0.5701493", "0.56905806", "0.5651845", "0.56207174", "0.56139946", "0.5611614", "0.5566634", "0.5548395",...
0.6524505
1
Revolution Day, a public holiday in Mexico observed on the third Monday in November.
def dia_revolucion(year): return nth_day_of_month(3, MON, NOV, year)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def election_day(year):\n return nth_day_of_month(1, TUE, NOV, year)", "def wkday_on_first(yr, mon): # returns day of week of first of month of the given year (1/1/2016)\r\n TotalDays = 0\r\n for x in range(1754, yr):\r\n YearNum = yeardays(x)\r\n TotalDays += YearNum\r\n for x in rang...
[ "0.6295589", "0.6026804", "0.60245025", "0.59761655", "0.5968329", "0.5934792", "0.5931478", "0.5897197", "0.5892322", "0.5892249", "0.58864856", "0.5849594", "0.5817999", "0.58040303", "0.5774847", "0.5774847", "0.5727384", "0.5635808", "0.5634328", "0.5630868", "0.5609257",...
0.6376459
0
Return the short time version e.g. Apr15
def short_time(self): return "%s%02d" % (util.SHORT_MONTH[self.month_num], self.year - 2000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortDate(self, date):\n return u'%s %02i' % (date.pMonth(), date.day())", "def twenty_seventeen():\n return 2017", "def now_short(_format=\"%Y%m%d-%H%M%S\"):\n return time.strftime(_format, time.localtime()) + \"\\t\"", "def time_hack(self):\n now = datetime.datetime.now()\n monthname...
[ "0.63859946", "0.5892262", "0.5783507", "0.57542473", "0.570186", "0.56883734", "0.56549394", "0.56004983", "0.559018", "0.55878234", "0.5565777", "0.5543981", "0.55357987", "0.5523186", "0.5511338", "0.5483309", "0.54828346", "0.5475784", "0.5471855", "0.54618084", "0.542506...
0.7720047
0
Retrieve all of the triples linking phrases from the AMR object. We use the Framenet words that are found in the AMR Object as the linker.
def get_triples_linker(): triples_linkers = [] concepts = list(self.amr_obj.concepts()) # Retrieve all concept that has the word ARG in it for concept in concepts: triple = self.amr_obj.triples(head=concept[0]) items = [item for item in tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_triples(self, bundle_url=None):\n # metadata triples\n # transcription triples\n # translation triples\n # gloss triples\n # NER triples\n pass", "def linked_words(self):\n return self[pair_data.PROPERTIES][pair_data.LINKED_WORDS]", "def list(self):\n\t\...
[ "0.6250458", "0.6226203", "0.6032588", "0.5930905", "0.58461785", "0.5834479", "0.5614722", "0.5560175", "0.5539191", "0.55331725", "0.5495651", "0.54529977", "0.5452302", "0.54013497", "0.5397558", "0.53082573", "0.5281321", "0.52532434", "0.5239895", "0.5156461", "0.5147574...
0.7512734
0
Checking whether the role is an agent (denoted by 'pag') or not
def is_agent(f_rel, rel_var): # TODO: beside 'pag' is there any other role? m = re.match(r'(.*)-(\d*)$', rel_var) key = m.group(1) n = m.group(2) # some annotation does not have the correspondence frameset, just put false if found ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_agent_by_role(self, username, role):\n current_user = self.this_user\n new_user = self.verify_current_user(username)\n self.this_user = current_user\n if new_user and new_user[\"role\"] == role:\n return new_user\n return False", "def test_show_agent(self):...
[ "0.64683294", "0.6237958", "0.62285286", "0.5953416", "0.5951429", "0.58070844", "0.5790452", "0.5789454", "0.57131404", "0.5685838", "0.56456906", "0.56294304", "0.56220144", "0.56133395", "0.5613335", "0.5591917", "0.55668414", "0.5560702", "0.55188465", "0.54573995", "0.54...
0.7379751
0
Given a triple, generate an amr string from it
def generate_amr_string_from_triples(self): def get_alignment(f_concept_var): """ Get alignment for a single concept """ for triplet, a in self.amr_obj.alignments().items(): if f_concept_var == triplet[0] and triplet[1] == ':instance-of': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triple(str_to_triple):\n return ''.join([char * 3 for char in str_to_triple])", "def __n3_to_str(triple):\n s, p, o = triple\n s = s.n3()\n p = p.n3()\n o = o.n3()\n if s.startswith('<') and s.endswith('>'):\n s = s[1:len(s) - 1]\n if p.startswith('<') and p.endswith('>'):\n ...
[ "0.69918025", "0.6543586", "0.60001856", "0.599101", "0.5819799", "0.5699199", "0.55604106", "0.55587226", "0.5380458", "0.535493", "0.5332849", "0.5326733", "0.52886426", "0.52294433", "0.52108353", "0.52092993", "0.52076393", "0.5204793", "0.52039593", "0.5092317", "0.50835...
0.67517376
1
Get alignment for a single concept
def get_alignment(f_concept_var): for triplet, a in self.amr_obj.alignments().items(): if f_concept_var == triplet[0] and triplet[1] == ':instance-of': return int(a.split('.')[1].split(',')[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetAlignment(self):\r\n\r\n return self.alignment", "def align(self):\n return self[\"align\"]", "def align(self):\n return self[\"align\"]", "def align(self):\n return self[\"align\"]", "def GetAlignment(self):\r\n\r\n return self._flag", "def get_segment_alignment...
[ "0.68454945", "0.6783263", "0.6783263", "0.6783263", "0.6474947", "0.63738024", "0.60854924", "0.60745746", "0.6050638", "0.60419714", "0.60137933", "0.5971896", "0.5971896", "0.58954287", "0.5851324", "0.5851324", "0.5851324", "0.5809287", "0.58061635", "0.57436806", "0.5700...
0.78405607
0
Get all amr string from the concept
def get_all_amr_string(f_concept_var): def get_triples(key): result_triples = [] f_triples = self.amr_obj.triples(dep=key, rel=':ARG-of', normalize_inverses=True) if f_triples: result_triples.extend(f_triples) f_triples = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_amr_string_from_triples(self):\n def get_alignment(f_concept_var):\n \"\"\"\n Get alignment for a single concept\n \"\"\"\n for triplet, a in self.amr_obj.alignments().items():\n if f_concept_var == triplet[0] and triplet[1] == ':instan...
[ "0.62805957", "0.59305984", "0.57337254", "0.56466794", "0.5593321", "0.55783033", "0.55317634", "0.55317634", "0.5517116", "0.55127764", "0.55023813", "0.5495977", "0.54629284", "0.54532874", "0.5445935", "0.54427445", "0.5428915", "0.5425408", "0.5423252", "0.54044414", "0....
0.66864014
0
Write tok to file, for openIE relation extraction later
def write_tok_to_file(self): dir_path = os.path.join(self.output_path, 'tokens') if not os.path.exists(dir_path): os.makedirs(dir_path) for dataset_name, dataset in self.amr_corpus.items(): f = open(os.path.join(dir_path, dataset_name + '_tok.txt'), 'w') for d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_tokens(self, tokenizer):\n output_file = '{}ktT.xml'.format(tokenizer.filename[:-5])\n with open(output_file, 'w') as f:\n print 'writing tokens to {}'.format(output_file)\n f.write(''.join(tokenizer.token_output))", "def write_to_file(self, filename):\n self....
[ "0.68534285", "0.665422", "0.66518503", "0.64659524", "0.618629", "0.6139454", "0.61091554", "0.61091554", "0.6091548", "0.60892123", "0.60817105", "0.6043151", "0.6030217", "0.6002952", "0.59830815", "0.59830815", "0.5968159", "0.5950414", "0.59480244", "0.59361947", "0.5909...
0.74253917
0
Write amr_string from each triple to file, for use by AMR generation
def write_amr_string_to_file(self): dir_path = os.path.join(self.output_path, 'amr_string') if not os.path.exists(dir_path): os.makedirs(dir_path) for dataset_name, dataset in self.amr_corpus.items(): f = open(os.path.join(dir_path, dataset_name + '_amr_string.txt'), 'w')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_amr_string_from_triples(self):\n def get_alignment(f_concept_var):\n \"\"\"\n Get alignment for a single concept\n \"\"\"\n for triplet, a in self.amr_obj.alignments().items():\n if f_concept_var == triplet[0] and triplet[1] == ':instan...
[ "0.6043795", "0.5816451", "0.5616476", "0.5615036", "0.55679107", "0.5558254", "0.55434495", "0.55120385", "0.5497597", "0.5473476", "0.5469896", "0.5452916", "0.5444766", "0.5437203", "0.54188925", "0.5401833", "0.5394112", "0.53601915", "0.53462917", "0.5338236", "0.5273775...
0.7671765
0
Dynamically pads the batch_data with pad_id
def _dynamic_padding(self, batch_data, pad_id): pad_p_len = min(self.max_p_len, max(batch_data['passage_length'])) pad_q_len = min(self.max_q_len, max(batch_data['question_length'])) batch_data['passage_token_ids'] = [(ids + [pad_id] * (pad_p_len - len(ids)))[: pad_p_len] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dynamic_padding(self, batch_data, pad_id = 0 ):\n #print 'dynamic _padding...'\n #print 'pad_id' + str(pad_id)\n max_p_len = 1000\n max_q_len =1000\n pad_p_len = min(max_p_len, max(batch_data['passage_length']))+1\n #print 'pad_p_len' + str(pad_p_len)\n pad_q_l...
[ "0.82784224", "0.72639644", "0.69665056", "0.6958741", "0.6956212", "0.68224317", "0.6813602", "0.68095857", "0.68010575", "0.6763136", "0.67258495", "0.66987", "0.667535", "0.66577417", "0.6612682", "0.66086715", "0.6608627", "0.6553975", "0.65246", "0.64727557", "0.6432696"...
0.8182605
1
Convert the question and passage in the original dataset to ids
def convert_to_ids(self, vocab): for data_set in [self.train_set, self.dev_set, self.test_set]: if data_set is None: continue for sample in data_set: sample['question_token_ids'] = vocab.convert_to_ids(sample['question_tokens']) for passage...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_to_ids(raw_data, word_to_id):\n docs = tokenize_keras(raw_data)\n uid = word_to_id[UNKNOWN_WORD]\n return [[word_to_id.get(w, uid) for w in doc] for doc in docs]", "def _compute_question_ids(self):\n if self._origin.question_ids:\n # lines to keep: those with already sent email...
[ "0.69351757", "0.64325917", "0.6149097", "0.61358285", "0.6019004", "0.59935755", "0.59873396", "0.59230286", "0.5898484", "0.5884933", "0.5883382", "0.5849986", "0.58040035", "0.57681507", "0.57341343", "0.572762", "0.5713004", "0.5608902", "0.56045425", "0.5583348", "0.5575...
0.73733747
0