query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
compute the min alignment length as n standard deviations below the mean
def compute_min_alignment_length(seqs_f, fraction=0.75): med_length = median([len(s) for _, s in parse_fasta(seqs_f)]) return int(med_length * fraction)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def above_1std(magnitudes):\n std = np.std(magnitudes)\n mean = np.mean(magnitudes)\n\n gt_1_std = magnitudes[magnitudes - mean > std].size\n\n return gt_1_std / magnitudes.size", "def beyond_1std(magnitudes):\n std = np.std(magnitudes)\n mean = np.mean(magnitudes)\n\n abs_deviations = np.ab...
[ "0.6064018", "0.60013705", "0.5947445", "0.5910501", "0.5796016", "0.5696152", "0.56879586", "0.56352067", "0.5608706", "0.56033266", "0.56008923", "0.5593933", "0.55905515", "0.5587925", "0.55567396", "0.5545519", "0.5541964", "0.55366236", "0.5535294", "0.55309206", "0.5522...
0.66111296
0
Initialize with list of AlphaDiversityCalc objects.
def __init__(self, alpha_calcs, params=None): self.Params = params or {} self.Calcs = alpha_calcs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __evalAlphas(self):\n #breit wheeler\n self.__alphaObjBW = alpha(self.getMomenta('bw'),self.__config)\n self.__alphaBW = [self.__alphaObjBW(index) for index in [1,2,3]]\n #compton\n self.__alphaObjC = alpha(self.getMomenta('c'),self.__config)\n self.__alphaC = [self.__...
[ "0.56725574", "0.55539864", "0.5525553", "0.5475682", "0.53953195", "0.53906155", "0.532778", "0.5311181", "0.5254709", "0.5233968", "0.52301687", "0.5220818", "0.5192028", "0.51813537", "0.5179122", "0.517842", "0.51526284", "0.51374274", "0.5129726", "0.5118253", "0.5107424...
0.6210981
0
Return new TaxonAssigner object with specified params.
def __init__(self, params): self.Params = params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, params):\r\n _params = {\r\n 'Confidence': 0.80,\r\n 'id_to_taxonomy_fp': None,\r\n 'reference_sequences_fp': None,\r\n 'training_data_properties_fp': None,\r\n 'max_memory': None\r\n }\r\n _params.update(params)\r\n ...
[ "0.80628014", "0.7692011", "0.7191928", "0.59298426", "0.56996524", "0.56309307", "0.5368178", "0.49969974", "0.49528956", "0.49428636", "0.49341932", "0.49341932", "0.49285984", "0.49034557", "0.48916125", "0.4869988", "0.4866994", "0.48348865", "0.4828991", "0.48015335", "0...
0.0
-1
finds closest (by bit distance) match to query_seq
def correct_barcode_bitwise(query_seq, seq_possibilities, nt_to_bits=DEFAULT_GOLAY_NT_TO_BITS): if nt_to_bits is None: nt_to_bits = DEFAULT_NT_TO_BITS dists = [] query_seq_bits = seq_to_bits(query_seq, nt_to_bits) for seq in seq_possibilities: possible_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest_match(\r\n reference_sequence: str, query_sequences: List[str], matrix_str: str = BLOSUM62\r\n) -> Union[str, List, None]:\r\n scores = [\r\n (reference_sequence, query_sequence, matrix_score(reference_sequence, query_sequence, matrix_str))\r\n for query_sequence in query_sequences\...
[ "0.65498054", "0.6433237", "0.6423725", "0.61715674", "0.6169254", "0.589814", "0.5810443", "0.5746611", "0.5701561", "0.5579111", "0.5549849", "0.55339205", "0.5522968", "0.5460714", "0.5453801", "0.54494774", "0.5375362", "0.53709185", "0.53654206", "0.5362275", "0.53418165...
0.6314104
3
Gets metric by name from qiime.beta_metrics Metrics should be f(matrix) > distance_array.
def get_phylogenetic_row_metric(name): # looks for name, inserting one_sample to find functions # in qiime.beta_metrics return getattr(qiime.beta_metrics, 'one_sample_' + name.lower())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_phylogenetic_metric(name):\r\n # looks for name, inserting possible dist_ to find functions\r\n # in qiime.beta_metrics\r\n try:\r\n return getattr(qiime.beta_metrics, 'dist_' + name.lower())\r\n except AttributeError:\r\n try:\r\n return getattr(qiime.beta_metrics,\r\n...
[ "0.6751773", "0.62629986", "0.5890884", "0.58417845", "0.57725513", "0.5691983", "0.56760067", "0.5615306", "0.5574441", "0.5509284", "0.5506791", "0.5381948", "0.53768486", "0.5354281", "0.5346025", "0.5340224", "0.5340224", "0.53200424", "0.5319389", "0.5268138", "0.5266738...
0.5733468
5
Checks for barcode and other demultiplexing duplicates Default check is for unique barcodes. A potential tricky situation to handle is variable length barcodes, than when combined with the 5' end of a primer sequence, are indistinguishable, and these are tested for as well. Finally, combinations of barcode sequences an...
def check_bc_duplicates(header, mapping_data, errors, has_barcodes=True, variable_len_barcodes=False, added_demultiplex_field=None): if (has_barcodes and not variable_len_barcodes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_bc_duplicates_added_demultiplex_finds_dups(self):\r\n\r\n # Should find duplicates\r\n header =\\\r\n ['SampleID', 'BarcodeSequence', 'LinkerPrimerSequence', 'run_prefix',\r\n 'Description']\r\n mapping_data = [['s-1', 'CGTA', 'AAAA', '1', 's1&data'],\r\n ...
[ "0.76905644", "0.7529921", "0.73979884", "0.73819005", "0.7313312", "0.7264987", "0.7231813", "0.713173", "0.7078308", "0.6921526", "0.66308194", "0.65421844", "0.6367795", "0.61441314", "0.6133555", "0.6044207", "0.6041805", "0.5979575", "0.59518355", "0.5915582", "0.5911519...
0.73578906
4
Checks that all barcodes and added demultiplex fields are unique
def check_added_demultiplex_dups(header, mapping_data, errors, has_barcodes=True, added_demultiplex_field=None): # Treat as variable length to test combinations of barcodes and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_bc_duplicates(header,\r\n mapping_data,\r\n errors,\r\n has_barcodes=True,\r\n variable_len_barcodes=False,\r\n added_demultiplex_field=None):\r\n\r\n if (has_barcodes and not variable_le...
[ "0.71827155", "0.6884757", "0.67935556", "0.677186", "0.671457", "0.66131335", "0.6613115", "0.660644", "0.6587565", "0.6530678", "0.6522367", "0.6274631", "0.6271306", "0.6264754", "0.62593776", "0.6173322", "0.6132288", "0.61079645", "0.608782", "0.6079145", "0.60742843", ...
0.6686863
5
Makes linear color gradient from start to end, using nbins. Returns list of (x, y, z) tuples in current colorspace. eps is used to prevent the case where start and end are the same.
def linear_gradient(start, end, nbins, eps=1e-10): start = array(start) end = array(end) result = [] n_minus_1 = max(float(nbins - 1), eps) for i in range(nbins): result.append( list((start * (n_minus_1 - i) / n_minus_1) + (end * (i / n_minus_1)))) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linearGradient(self,start_rgb, finish_rgb, n):\n rgb_list = [start_rgb]\n\n for t in range(1, n):\n current_color = [int((start_rgb[j]) + (float(t)/(n-1))*(finish_rgb[j] - start_rgb[j])) for j in range(3)]\n rgb_list.append(current_color)\n\n return rgb_list", "def ...
[ "0.73452604", "0.65776324", "0.64449483", "0.63144046", "0.6032746", "0.6027613", "0.5936039", "0.5873644", "0.58552706", "0.58190656", "0.56958175", "0.5649965", "0.55901235", "0.5586716", "0.5568367", "0.55381876", "0.5517778", "0.5504679", "0.5504433", "0.5490492", "0.5476...
0.8392048
0
Creates taxonomy prefs dict given specific taxonomy levels. color_prefs is not required taxonomy_levels is a list of the level number i.e. Phylum is 2 prefs will include a 'colors' dictionary for each given level if there is a cooresponding level in color_prefs that is the dictionary for the level otherwise it adds and...
def taxonomy_process_prefs(taxonomy_levels, color_prefs=None): prefs = {} for j, col in enumerate(taxonomy_levels): key = str(col) col = str(col) # Color by only one level prefs[key] = {} prefs[key]['column'] = col if color_prefs: for p in c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_taxonomy_process_prefs(self):\r\n taxonomy_levels = [2, 3, 4]\r\n exp1 = {}\r\n exp1['level_2'] = {'column': '2'}\r\n exp1['level_3'] = {'column': 3, 'colors':\r\n {'a': ('red', (0, 100, 100))}}\r\n obs1 = taxonomy_process_prefs(taxonomy_levels,...
[ "0.67251575", "0.65538836", "0.55017084", "0.5486468", "0.47304592", "0.47200954", "0.47145322", "0.46950573", "0.46137148", "0.45915067", "0.45855725", "0.4583326", "0.44819936", "0.44287673", "0.44264543", "0.44137198", "0.4411337", "0.4411337", "0.44111973", "0.43910542", ...
0.8686916
0
Returns the original file name, but with a different extension E.g. get_filname_with_new_ext('/Users/shared/test.fasta', '.fastq', '.') returns 'test.fastq'
def get_filename_with_new_ext(original_file_path, new_ext, output_directory): return path.join(output_directory, path.splitext(path.split(original_file_path)[1])[0] + new_ext)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_name_with_extension(file_name: str):\n return file_name + '.txt'", "def fextension(filename):\n filename = os.path.normpath(filename)\n return os.path.splitext(filename)[1]", "def changeExtension(filename, newext):\n (name, ext) = os.path.splitext(filename)\n return name + newext", ...
[ "0.7772528", "0.7541834", "0.74996835", "0.7487406", "0.7436864", "0.73999023", "0.73914796", "0.73893255", "0.7317965", "0.7281751", "0.7272696", "0.7264851", "0.72646767", "0.72261715", "0.7198852", "0.7164043", "0.7141683", "0.71361667", "0.7114619", "0.7084941", "0.708494...
0.8126617
0
Returns filehandle, allowing gzip input.
def get_infile(filename): if filename.endswith(".gz"): fin = GzipFile(filename, "rb") else: fin = open(filename, "U") return fin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_file_handle(input_file):\n if str(input_file).endswith(\".gz\"):\n gzipped_file_handle = gzip.open(input_file, \"rt\")\n return gzipped_file_handle\n else:\n normal_fh = open(input_file, \"r\")\n return normal_fh", "def gzopen(f):\n return gzip.open(f, 'rb') if f.e...
[ "0.8088844", "0.7374141", "0.72541636", "0.70825887", "0.7026094", "0.6950485", "0.6900594", "0.67522097", "0.67318094", "0.673055", "0.66228724", "0.6571157", "0.6546901", "0.65040433", "0.64553195", "0.6401213", "0.63679653", "0.6339832", "0.6335667", "0.63019395", "0.61767...
0.64187163
16
Returns a random string of specified length.
def make_tmp_name(length=8): return ("".join(sample(list(lowercase), length)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_string(length: int) -> str:\n return \"\".join(random.choices(string.ascii_letters + string.digits, k=length))", "def generate_random_string(length):\r\n return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))", "def _generate_random_string(length: int)...
[ "0.8749894", "0.87261075", "0.8715581", "0.8704573", "0.8673997", "0.8670696", "0.8652055", "0.8651259", "0.863912", "0.86175054", "0.861313", "0.8575154", "0.85520226", "0.8546521", "0.85432017", "0.8493881", "0.8451578", "0.8428424", "0.83970994", "0.83857214", "0.8384207",...
0.0
-1
Returns the path to the qiime R source directory
def _get_R_script_dir(self): qiime_dir = get_qiime_project_dir() script_dir = join(qiime_dir, 'qiime', 'support_files', 'R') return script_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qiime_project_dir():\r\n # Get the full path of util.py\r\n current_file_path = abspath(__file__)\r\n # Get the directory containing util.py\r\n current_dir_path = dirname(current_file_path)\r\n # Return the directory containing the directory containing util.py\r\n return dirname(current_...
[ "0.71739393", "0.7051836", "0.7008556", "0.6906183", "0.68266267", "0.68266267", "0.6811717", "0.67730486", "0.6751428", "0.6723182", "0.66426504", "0.65671283", "0.6482308", "0.6475257", "0.64751387", "0.6456401", "0.64446104", "0.64443", "0.6431254", "0.6411851", "0.6403258...
0.7742713
0
Returns distance in meters between two lat long points Vincenty's formula is accurate to within 0.5mm, or 0.000015" (!), on the ellipsoid being used. Calculations based on a spherical model, such as the (much simpler) Haversine, are accurate to around 0.3% (which is still good enough for most purposes, of course).
def dist_vincenty(lat1, lon1, lat2, lon2, iterations=20): if lat1 < -90 or lat1 > 90 or lat2 < -90 or lat2 > 90 or lon1 < -180 or lon1 > 180 or lon2 < -180 or lon2 > 180: raise ValueError( "Latitude values shoulds range from (-90,90) and longitude from (-180,180) but one of the input values i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_in_meters(coord1, coord2):\n return vincenty(coord1, coord2).meters", "def distance(lat0, lng0, lat1, lng1):\n # convert decimal degrees to radians \n lat0, lng0, lat1, lng1 = map(radians, [lat0, lng0, lat1, lng1])\n # haversine formula \n dlng = lng1 - lng0 \n dlat = lat1 - lat0 \...
[ "0.7338322", "0.72701234", "0.72169656", "0.72095287", "0.7173326", "0.71467596", "0.71444523", "0.713688", "0.71180993", "0.7108938", "0.7086338", "0.7045101", "0.7044094", "0.7023428", "0.701177", "0.70050436", "0.70011055", "0.69998485", "0.69964755", "0.6989287", "0.69832...
0.6679604
67
Construct a richness estimator instance.
def __init__(self, biom_table, point_estimator_cls): if biom_table.isEmpty(): raise EmptyTableError("The input BIOM table cannot be empty.") self._biom_table = biom_table self._point_estimator_cls = point_estimator_cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_constructor(self):\r\n self.assertTrue(isinstance(self.estimator1,\r\n ObservationRichnessEstimator))", "def __init__(\n self,\n estimator = SGDClassifier(),\n ):\n self.estimator = estimator", "def __init__(self, binner=...
[ "0.6374413", "0.59943587", "0.58005166", "0.5761237", "0.5721853", "0.56875205", "0.56225854", "0.5614264", "0.55631536", "0.55432904", "0.5537957", "0.5531488", "0.54575557", "0.5398764", "0.53687763", "0.5252083", "0.5242758", "0.5242007", "0.52257764", "0.52111995", "0.515...
0.0
-1
Construct an abstract point estimator.
def __init__(self, sample_data): n = self._calculate_total_individual_count(sample_data) if n < 1: raise EmptySampleError("Encountered a sample without any recorded " "observations.") else: self._n = n self._s_obs = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_constructor(self):\r\n self.assertTrue(isinstance(self.est1, AbstractPointEstimator))", "def point(cls): # No range because it's unknown at this time.\r\n def factory(i, name):\r\n return cls(i, name, (0, 0), lambda a: point.Point(*a).floor(), None)\r\n return factory", ...
[ "0.711588", "0.6573497", "0.6173394", "0.6038222", "0.6005561", "0.5996821", "0.5995789", "0.5896764", "0.5889232", "0.58639014", "0.5833214", "0.58215564", "0.58116543", "0.57959014", "0.57593554", "0.5742369", "0.57375675", "0.5736913", "0.5722504", "0.571243", "0.5669691",...
0.0
-1
Filters map according to several criteria. keep only sample ids in good_sample_ids drop cols that are different in every sample (except id) drop cols that are the same in every sample
def filter_mapping_file(map_data, map_header, good_sample_ids, include_repeat_cols=False, column_rename_ids=None): # keeping samples to_keep = [] to_keep.extend([i for i in map_data if i[0] in good_sample_ids]) # keeping columns headers = [] to_keep = zip(*to_kee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_samples_from_otu_table_sample_ids_dense(self):\r\n otu_table = parse_biom_table_str(dense_otu_table1)\r\n\r\n # keep two samples\r\n expected_sample_ids = set(['PC.593', 'PC.607'])\r\n filtered_otu_table = filter_samples_from_otu_table(\r\n otu_table,\r\n ...
[ "0.69836164", "0.6868131", "0.63786715", "0.6269247", "0.6252829", "0.6145104", "0.6094028", "0.60927314", "0.6014374", "0.6012128", "0.6006211", "0.59870875", "0.5947299", "0.5941629", "0.5926825", "0.577172", "0.5752711", "0.5670692", "0.56296694", "0.56218714", "0.559596",...
0.716227
0
Returns indices of the wanted items in the input items if present. input_items must be iterable, and wanted_items may be either a single value or a list. The return value will always be a list of indices, and an empty list if none were found. If wanted_items is a single string, it is treated as a scalar, not an iterabl...
def _get_indices(input_items, wanted_items): # Note: Some of this code is taken from Jeremy Widmann's # get_valid_indices() function, part of make_distance_histograms.py from QIIME 1.8.0. try: iter(input_items) except: raise ValueError("The input_items to search must be iterable.")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_item_indexes(list_arg: list, item: Any) -> Tuple[int, ...]:\n indexes = [index for index, value in enumerate(list_arg) if value == item]\n return indexes", "def get_indexes(self, items: Iterable[_T]) -> List[int]:\n return [self.get_index(item) for item in items]", "def get_index_list(inp...
[ "0.6219046", "0.59450495", "0.5736665", "0.54543614", "0.5391847", "0.5306798", "0.51638687", "0.5081332", "0.50774765", "0.4975943", "0.49742422", "0.4891163", "0.48786867", "0.48779047", "0.48236454", "0.48035905", "0.47112992", "0.4702991", "0.46931744", "0.46858814", "0.4...
0.8686683
0
Returns even or odd parit for parity vector
def calc_parity_vector(parity_vector): return reduce(lambda x, y: x ^ y, parity_vector[1:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parity(it):\n \n return sum(it)%2", "def parity(n):\n if n%2==0:\n p=1\n else:\n p=-1\n return p", "def parity_odd(x):\r\n\t\t\tx = x ^ (x >> 4)\r\n\t\t\tx = x ^ (x >> 2)\r\n\t\t\tx = x ^ (x >> 1)\r\n\t\t\treturn x & 1", "def parity(n):\n # bin(n) returns 0b.... \n # bin(n)...
[ "0.78922135", "0.7647666", "0.74781656", "0.730741", "0.72137314", "0.713582", "0.6883719", "0.67042017", "0.6686967", "0.6655184", "0.6543899", "0.648572", "0.6434135", "0.63494873", "0.6345113", "0.63244885", "0.6306936", "0.6270682", "0.6248601", "0.6218997", "0.61301535",...
0.71930873
5
Returns list of n roughly equalsized fragments of seq
def _fragment_seq(self, seq): num_fragments = self.Params['num_fragments'] results = [] start = 0 for i in range(num_fragments): # My notes: # len(seq[i::n]) gives the number of even multiples of # num_fragments exist between i (inclusive) and t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_by_n(seq, n):\n while seq:\n yield seq[:n]\n seq = seq[n:]", "def split_by_n( seq, n ):\n while seq:\n yield seq[:n]\n seq = seq[n:]", "def chunk_it(seq, n):\n\n avg = len(seq) / float(n)\n out = []\n last = 0.0\n while last < ...
[ "0.75146836", "0.7408617", "0.72748494", "0.72734255", "0.726248", "0.7127064", "0.71060526", "0.7102967", "0.7082412", "0.7035279", "0.7032958", "0.7009278", "0.6989898", "0.6985965", "0.6985965", "0.6981534", "0.6981534", "0.6981534", "0.69785935", "0.6969405", "0.69655186"...
0.7089558
8
Produce a generator that feeds lists of arrays to any gradient test. In this function, a row is a full row of the OTU table, a single 1D array.
def correlation_row_generator(bt, pmf, category): data = array([i for i in bt.iterObservationData()]) # ensure that the order of the category vector sample values is the same # as the order of the samples in data. otherwise will have hard to # diagnose correspondence issues try: cat_ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correlation_row_generator(self):\r\n otu_table_1 = \"\"\"{\"id\": \"None\",\"format\": \"Biological Observation Matrix 1.0.0\",\r\n \"format_url\": \"http://biom-format.org\",\"type\": \"OTU table\",\"generated_by\":\r\n \"BIOM-Format 1.1.2\",\"date\": \"2013-08-16T10:16:20.131837\",\...
[ "0.58578724", "0.5765301", "0.53726107", "0.53681445", "0.5320379", "0.5289184", "0.52858925", "0.52700067", "0.5265181", "0.52620846", "0.52339333", "0.5194401", "0.5139816", "0.5135782", "0.5123291", "0.5123019", "0.50944287", "0.5078378", "0.5056492", "0.50392985", "0.5039...
0.0
-1
processes mapping data in list of lists format into a 2 deep dict
def mapping_file_to_dict(mapping_data, header): map_dict = {} for i in range(len(mapping_data)): sam = mapping_data[i] map_dict[sam[0]] = {} for j in range(len(header)): if j == 0: continue # sampleID field map_dict[sam[0]][header[j]] = sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_list2map(variable_lists):\n return_dict = dict()\n for single_variable in variable_lists:\n return_dict[single_variable[\"name\"]] = single_variable[\"value\"]\n return return_dict", "def convert(data):\n return {k: [d[k] for d in data] for k in data[0].keys()}", "def _DataArrays...
[ "0.6719464", "0.63448745", "0.6284819", "0.6215812", "0.6199614", "0.6127543", "0.61182654", "0.6038233", "0.60361266", "0.60136914", "0.5954533", "0.5921091", "0.5895489", "0.58763105", "0.58646166", "0.58144313", "0.5780234", "0.5731729", "0.5706881", "0.56934464", "0.56931...
0.5938091
11
Return a dict mapping otu identifier to dict of otu metadata
def parse_taxonomy_to_otu_metadata( lines, labels=['taxonomy', 'score'], process_fs=[taxa_split, float]): result = {} for line in lines: line = line.strip() fields = line.split('\t') id_ = fields[0].split()[0] result[id_] = {} for i, field in enumerate(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _metadata_map():\n return {\n 'date_added': 'dateAdded',\n 'dns_active': 'dnsActive',\n 'last_modified': 'lastModified',\n 'private_flag': 'privateFlag',\n 'whois_active': 'whoisActive',\n 'key_name': 'Key Name',\n 'value_type'...
[ "0.6205478", "0.5898494", "0.58840925", "0.57922596", "0.5728667", "0.5718662", "0.568489", "0.5677916", "0.56683975", "0.5622163", "0.5617839", "0.5606058", "0.5603443", "0.5596908", "0.5592238", "0.55745924", "0.55731356", "0.556955", "0.5565423", "0.5556275", "0.55519974",...
0.0
-1
Generate a random file name
def make_img_name(file_ext='.png'): fn = [] # format seqs and write out to temp file for i in range(0, 30): fn.append(choice(ALPHABET)) return ''.join(fn) + file_ext
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_random_file_name():\n\n def random_file_name_factory():\n length = random.randint(10, 15)\n chars = string.ascii_letters + string.digits + \"-_\"\n return f\"{''.join(random.choice(chars) for _ in range(length))}.jpg\"\n\n return random_file_name_factory", "def random_filena...
[ "0.8673791", "0.8474601", "0.81332344", "0.8110434", "0.80433744", "0.78686684", "0.7822265", "0.7804698", "0.7747093", "0.7693933", "0.76667315", "0.76128775", "0.7600892", "0.7497085", "0.7453262", "0.7427402", "0.73805606", "0.73590475", "0.73411536", "0.7258651", "0.72410...
0.68273824
52
Write pie charts into an html file
def write_html_file(out_table, outpath): page_out = PAGE_HTML % ('Taxa Summaries', out_table) out = open(outpath, "w+") out.write(page_out) out.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_pie_chart(self):\r\n\r\n filename1 = '/tmp/qiimewebfiles/charts/pie_chart.png'\r\n filename2 = '/tmp/qiimewebfiles/charts/pie_chart_legend.pdf'\r\n filename3 = '/tmp/qiimewebfiles/charts/pie_chart.pdf'\r\n\r\n obs1, obs2, obs3, obs4 = make_pie_chart(self.fracs, self.dir_pa...
[ "0.63504213", "0.62447816", "0.6240993", "0.6220964", "0.6166505", "0.6140455", "0.6108837", "0.6103606", "0.6069156", "0.6068391", "0.6038528", "0.6011603", "0.5943441", "0.585414", "0.58429223", "0.5813831", "0.5760504", "0.57601213", "0.57593596", "0.57550544", "0.5734179"...
0.55475
24
Return searchsorted right and left indices of x and sorted copy of x.
def ssl_ssr_sx(x): y = sorted(copy(x)) ssl = searchsorted(y, x, 'left') ssr = searchsorted(y, x, 'right') return ssl, ssr, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def torch_searchsort(x, xs):\n x = torch.cat((torch.tensor([-10.0]), x, torch.tensor([10000.0])))\n ind = 0\n for i in range(1, len(x) - 1):\n if x[i-1] < xs and xs <= x[i]:\n return i - 1", "def _findIndex(self, x):\n if x< self[0][0] or x> self[-1][0]:\n return None\n\n id...
[ "0.6571079", "0.6548718", "0.6542276", "0.6512829", "0.649932", "0.6474657", "0.61898315", "0.61711264", "0.6171113", "0.6051589", "0.6048927", "0.60230803", "0.60151565", "0.5988331", "0.59875304", "0.5970464", "0.5945527", "0.5902682", "0.58937603", "0.5892609", "0.5874686"...
0.53098434
94
Returns the number of ways of choosing k items from n.
def combinations(n, k): return exp(gammaln(n + 1) - gammaln(k + 1) - gammaln(n - k + 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nchoosek(n, k):\n if n < k:\n return 0\n return partition(n, [k, n - k])", "def count_k(n, k):\n if n == 0:\n return 1\n elif n < 0:\n return 0\n else:\n total = 0\n i = 1\n while i <= k:\n total += count_k(n - i, k)\n i += 1\n ...
[ "0.76481616", "0.76086855", "0.75618786", "0.75203013", "0.7474671", "0.74277985", "0.7403128", "0.7403128", "0.7294517", "0.7288614", "0.7286898", "0.72848123", "0.7278209", "0.70908463", "0.7054607", "0.6862164", "0.6844451", "0.6787132", "0.6720928", "0.667261", "0.6672547...
0.65924233
23
Returns the probability for the sign test.
def sign_test(success, trials, alt="two sided"): lo = ["less", "lo", "lower", "l"] hi = ["greater", "hi", "high", "h", "g"] two = ["two sided", "2", 2, "two tailed", "two"] alt = alt.lower().strip() if alt in lo: p = binomial_low(success, trials, 0.5) elif alt in hi: succ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_probability(self):\n return 0", "def _basic_probability(count: int, sequence_total_count: int) -> float:\n return float(count) / sequence_total_count", "def sign(p):\n to_count = filter(lambda x: x[0] > x[1], combinations(p, 2))\n sign_exp = sum(1 for _ in to_c...
[ "0.69732195", "0.6566263", "0.6554603", "0.65079796", "0.63967633", "0.6387453", "0.6300271", "0.6256594", "0.62087303", "0.6188935", "0.6157443", "0.6132342", "0.6016182", "0.5985022", "0.59560823", "0.59488636", "0.59313", "0.5930668", "0.5921073", "0.59113336", "0.5909476"...
0.61947674
9
Runs a Mantel test on two distance matrices. Returns the pvalue, Mantel correlation statistic, and a list of Mantel correlation statistics for each permutation test.
def mantel_test(m1, m2, n, alt="two sided", suppress_symmetry_and_hollowness_check=False): # Perform some sanity checks on our input. if alt not in ("two sided", "greater", "less"): raise ValueError("Unrecognized alternative hypothesis. Must be either " "'tw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_mantel_test(method, fps, distmats, num_perms, tail_type, comment,\r\n control_dm_fp=None, control_dm=None,\r\n sample_id_map=None):\r\n if len(fps) != len(distmats):\r\n raise ValueError(\"Must provide the same number of filepaths as there \"\r\n ...
[ "0.66088784", "0.64496493", "0.64379895", "0.6323703", "0.6269569", "0.6108901", "0.60023975", "0.5991034", "0.58869326", "0.58196175", "0.57506275", "0.57281244", "0.56926334", "0.568861", "0.56810236", "0.5677646", "0.5674668", "0.56658363", "0.5641539", "0.563034", "0.5617...
0.5961132
8
Returns a list containing the flattened lower triangle of the matrix. The returned list will contain the elements in columnmajor order. The diagonal will be excluded.
def _flatten_lower_triangle(matrix): matrix = asarray(matrix) flattened = [] for col_num in range(matrix.shape[1]): for row_num in range(matrix.shape[0]): if col_num < row_num: flattened.append(matrix[row_num][col_num]) return flattened
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ltri( m, context = FloatContext ):\n zero = context.zero\n n,n_ = shape_mat(m)\n return [[ m[i][j] if i >= j else zero \n for j in xrange(n_)] \n for i in xrange(n)]", "def extract_ltri( m, context = FloatContext ):\n rows, cols = shape_mat(m)\n return [ row[:i+...
[ "0.6841883", "0.6702337", "0.6439424", "0.6392179", "0.63396007", "0.6254415", "0.6169574", "0.60808176", "0.57293016", "0.57229453", "0.571749", "0.5677524", "0.5659009", "0.562499", "0.55937934", "0.5591171", "0.5576954", "0.5550264", "0.5523891", "0.5520601", "0.5501629", ...
0.83642626
0
Calculate the Fisher Z transform of a correlation coefficient. Relies on formulation in Sokal and Rohlf Biometry pg 575.
def fisher_z_transform(r): if abs(r) == 1: # fisher z transform is undefined, have to return nan return nan return .5 * log((1. + r) / (1. - r))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_fisher_z_transform(z):\r\n return ((e ** (2 * z)) - 1.) / ((e ** (2 * z)) + 1.)", "def cPofZ(self,arr,zx):\n sig1=(zx-arr['zmg'])/arr['sigma_pz']\n sig2=(zx-self.zcat)/self.sigmacat\n return (1.-self.Acat)*0.5*(1 + erf(sig1/np.sqrt(2)))+self.Acat*0.5*(1 + erf(sig2/np.sqrt(2)))...
[ "0.6503687", "0.6368698", "0.6323625", "0.61223364", "0.5961166", "0.59606785", "0.59559333", "0.5944561", "0.5849304", "0.5849304", "0.5809808", "0.5789188", "0.576919", "0.57467115", "0.565845", "0.5645857", "0.56409794", "0.5631336", "0.5623368", "0.5591538", "0.55185366",...
0.6756389
0
Convert ascii character to Phred quality score with ASCII offset of 64. Illuminaspecific ASCII offset of 64. This is used by Illumina in CASAVA versions prior to 1.8.0, and in Illumina internal formats (e.g., export.txt files).
def ascii_to_phred64(c): return ascii_to_phred(c, 64)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trans_ascii (data):\n quality = []\n asl = data[2]\n for char in asl:\n change= ord (char)-64\n quality.append(change)\n \n return quality", "def Illumina_Sanger(qual):\n QualityScoreOut = ''\n for quality in qual:\n newQual = chr((ord(quality) - 64) + 33)\n ...
[ "0.668183", "0.6541075", "0.64120245", "0.6379441", "0.6292351", "0.6124963", "0.6045719", "0.6002399", "0.5972976", "0.5937479", "0.58825064", "0.5858484", "0.58555293", "0.5843213", "0.58037883", "0.5710925", "0.5710925", "0.5708372", "0.5667568", "0.5573314", "0.550621", ...
0.6357597
4
Return mean of pairwise dists, assumes distmat is symmetric,hollow.
def mpd(distmat): return distmat.sum() / (distmat.size - distmat.shape[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cluster_average(cls, indices, dist_mat):\n distances = cls.get_all_distances(indices, dist_mat)\n return np.mean(distances)", "def mntd(distmat):\r\n return masked_array(distmat, eye(distmat.shape[0])).min(0).mean()", "def get_avg_dists(state1_samids, state2_samids, distdict):\r\n #...
[ "0.67233086", "0.65043026", "0.6434992", "0.6334677", "0.62604004", "0.62171125", "0.6174855", "0.6011026", "0.5824025", "0.5762961", "0.5753274", "0.57470614", "0.5746505", "0.5703409", "0.5673164", "0.5621048", "0.55988723", "0.5579399", "0.5520048", "0.5511463", "0.5493505...
0.6142668
7
Calc mean,std of mntd of iters of rand nxn mtx's drawn from distmat.
def random_mntd(distmat, n, iters): means = [] indices = arange(distmat.shape[0]) # square so rows=cols for i in range(iters): shuffle(indices) # shuffling indices after its been shuffled is not # mathematically different than shuffling fresh arange(n) means.append(mntd(reduc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_mpd(distmat, n, iters):\r\n means = []\r\n indices = arange(distmat.shape[0]) # square so rows=cols\r\n for i in range(iters):\r\n shuffle(indices) # shuffling indices after its been shuffled is not\r\n # mathematically different than shuffling fresh arange(n)\r\n means.a...
[ "0.7929084", "0.7562073", "0.713619", "0.653145", "0.64292043", "0.62695396", "0.62168217", "0.6162063", "0.6095344", "0.5974731", "0.59288925", "0.5904683", "0.59040725", "0.5814543", "0.5806043", "0.5710278", "0.5710185", "0.5692851", "0.5651215", "0.5639679", "0.5615481", ...
0.83231676
0
Downloads and exports a Google Spreadsheet in TSV format. Returns a string containing the spreadsheet contents in TSV format (e.g. for writing out to a file or parsing). The first line is assumed to be the spreadsheet header (i.e. containing column names), which can optionally be followed by one or more comment lines (...
def load_google_spreadsheet(spreadsheet_key, worksheet_name=None): spreadsheet_key = _extract_spreadsheet_key_from_url(spreadsheet_key) gd_client = SpreadsheetsService() try: worksheets_feed = gd_client.GetWorksheetsFeed(spreadsheet_key, v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _csv_download(page):\n # gc = gspread.login(page.timetable.google_user, page.timetable.google_passwd)\n gc = googleoauth.authenticate_google_docs()\n csv_file = gc.open('WebValley2019')\n\n # gsession = gss.Client(page.timetable.google_user, page.timetable.google_passwd)\n # ss = gss.Spreadsheet...
[ "0.62646157", "0.58970404", "0.57873696", "0.5633179", "0.5600481", "0.55599767", "0.5438678", "0.5393161", "0.5292376", "0.52434003", "0.50734925", "0.5073006", "0.5065928", "0.5015467", "0.49501356", "0.4947132", "0.4932423", "0.48733056", "0.48597744", "0.482677", "0.48229...
0.49325714
16
Extracts a key from a URL in the form '...key=some_key&foo=42... If the URL doesn't look valid, assumes the URL is the key and returns it unmodified.
def _extract_spreadsheet_key_from_url(url): result = url if 'key=' in url: result = url.split('key=')[-1].split('#')[0].split('&')[0] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key_from_url(file_url):\t\n\tparts = urlparse(file_url)\n\tbucket_name = get_bucket_name_from_url(file_url)\n\tkey = parts.path.replace(\"/\" + bucket_name + \"/\", \"\")\n\treturn key", "def test_extract_spreadsheet_key_from_url(self):\r\n # Pass various URLs with different key/value combos.\r\n ...
[ "0.6913936", "0.670915", "0.6607211", "0.64731854", "0.6425161", "0.62731916", "0.6213581", "0.6182519", "0.601577", "0.60109144", "0.5934833", "0.5933971", "0.59252626", "0.59252626", "0.58834875", "0.5876676", "0.5791102", "0.57763016", "0.5710467", "0.5703208", "0.5702552"...
0.8274044
0
Creates a list of "cleaned" headers which spreadsheets accept. A Google Spreadsheet converts the header names into a "cleaned" internal representation, which must be used to reference a cell at a particular header/column. They are all lower case and contain no spaces or special characters. If two columns have the same ...
def _get_cleaned_headers(headers): cleaned_headers = [] for header in headers: # Google strips special characters, whitespace, and underscores first, # and then strips any *leading* digits. This order is extremely # important! sanitized = sub(r'^\d+', '', sub(r'[\W_]', '', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_headers(df):\n filtered_headers = [header.replace(\"'\",'').replace(' ', '').replace('(', '').replace(')', '').replace('.', '').replace('[', '').replace(']', '') for header in df.columns]\n map_to_new_headers = {}\n for i in range(len(df.columns)):\n map_to_new_headers[df.columns[i]] = fi...
[ "0.71050245", "0.68625146", "0.6744428", "0.64650214", "0.64556235", "0.62124306", "0.61873305", "0.61334276", "0.60060763", "0.5999718", "0.59747994", "0.5961036", "0.5933726", "0.5933586", "0.59319717", "0.59241074", "0.584846", "0.5777832", "0.57690054", "0.57528013", "0.5...
0.7913014
0
Provides normalized version of item for sorting with digits.
def _natsort_key(item, case_sensitivity=False): item = str(item) try: chunks = re.split('(\d+(?:\.\d+)?)', item) except TypeError: # if item is a tuple or list (i.e., indexable, but not a string) # work with the first element chunks = re.split('(\d+(?:\.\d+)?)', item...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(item):\n item = item.lower().strip().rstrip('_')\n return item", "def _natsort_key_case_insensitive(item):\r\n # added the lower() call to allow for case-insensitive sorting\r\n item = str(item).lower()\r\n\r\n try:\r\n chunks = re.split('(\\d+(?:\\.\\d+)?)', item)\r\n...
[ "0.66072255", "0.62556684", "0.6198954", "0.6132228", "0.59685695", "0.591562", "0.59106004", "0.581557", "0.5740937", "0.5683111", "0.5663693", "0.5630346", "0.55907965", "0.5586796", "0.55688524", "0.5560471", "0.5546669", "0.55381554", "0.55358267", "0.55358267", "0.553375...
0.62943757
1
Provides normalized version of item for sorting with digits.
def _natsort_key_case_insensitive(item): # added the lower() call to allow for case-insensitive sorting item = str(item).lower() try: chunks = re.split('(\d+(?:\.\d+)?)', item) except TypeError: # if item is a tuple or list (i.e., indexable, but not a string) # work with...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(item):\n item = item.lower().strip().rstrip('_')\n return item", "def _natsort_key(item, case_sensitivity=False):\r\n item = str(item)\r\n\r\n try:\r\n chunks = re.split('(\\d+(?:\\.\\d+)?)', item)\r\n except TypeError:\r\n # if item is a tuple or list (i.e., in...
[ "0.66079605", "0.6293011", "0.61967933", "0.6132036", "0.59669507", "0.5914318", "0.5910265", "0.58145046", "0.5740379", "0.5681062", "0.5661351", "0.56298345", "0.55894685", "0.5585278", "0.5570249", "0.5560119", "0.5544676", "0.5536434", "0.55351406", "0.55351406", "0.55350...
0.6253837
2
Returns filehandle, allowing gzip input.
def get_infile(filename): if filename.endswith(".gz"): fin = GzipFile(filename, "rb") else: fin = open(filename, "U") return fin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_file_handle(input_file):\n if str(input_file).endswith(\".gz\"):\n gzipped_file_handle = gzip.open(input_file, \"rt\")\n return gzipped_file_handle\n else:\n normal_fh = open(input_file, \"r\")\n return normal_fh", "def gzopen(f):\n return gzip.open(f, 'rb') if f.e...
[ "0.8088392", "0.73740125", "0.7256136", "0.7084364", "0.7026025", "0.6951708", "0.6900397", "0.675228", "0.6732267", "0.6731117", "0.662136", "0.65709144", "0.6547866", "0.65044224", "0.64552873", "0.64025074", "0.6368126", "0.63421994", "0.6335111", "0.63020384", "0.61754394...
0.6417081
15
Return whether barcode is valid, and attempt correction.
def check_barcode(curr_barcode, barcode_type, valid_map, attempt_correction=True, added_demultiplex_field=None, curr_id=None): corrected_bc = False if added_demultiplex_field: added_demultiplex_lens =\ set([len(bc.split(',')[1]) for bc in valid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correct_barcode(self):\r\n original = 'ATTTTTTTTTCG'\r\n recieved = 'ATTTTTTTTTTT'\r\n possibilities = ['TGTATTCGTGTA', 'ATTTTTTTTTCG', 'TGTAGGCGTGTA',\r\n 'TGTAGAAGTGTA', 'TGTAGGCGTATA', 'TGTAAAAAAAAA']\r\n decoded, num_errors = barcode.correct_barcode(...
[ "0.7534087", "0.7484415", "0.7164887", "0.69924086", "0.69600046", "0.68867385", "0.68234366", "0.64509904", "0.6408136", "0.6375408", "0.63490975", "0.62643296", "0.6151657", "0.6126091", "0.60628134", "0.6036191", "0.59971565", "0.59371847", "0.59183574", "0.58908033", "0.5...
0.70738715
3
gets a single quantile value for a dataset using R. type 7 method
def _quantile(data, quantile): index = quantile * (len(data) - 1) bottom_index = int(floor(index)) top_index = int(ceil(index)) difference = index - bottom_index output = (1 - difference) * \ data[bottom_index] + difference * data[top_index] return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantile(self, hypercube):\n raise NotImplementedError()", "def quantile(x,p):\n p_index = int(p*len(x))\n return sorted(x)[p_index]", "def get_percentile(self, q):\n return None", "def get_percentile(self, q):\n return None", "def quantile_func(q):\n def f(x):\n re...
[ "0.72360146", "0.7051114", "0.70201594", "0.70201594", "0.69984514", "0.6964652", "0.6964652", "0.6964652", "0.6954513", "0.68826085", "0.6860677", "0.67054975", "0.67054975", "0.67054975", "0.6687504", "0.66518044", "0.6643509", "0.66357005", "0.65895075", "0.6582762", "0.65...
0.6738514
11
Default constructor. Initializes an instance with the provided list of distance matrices.
def __init__(self, dms, num_dms=-1, min_dm_size=-1): self._num_dms = num_dms self._min_dm_size = min_dm_size self.DistanceMatrices = dms
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, list_of_matrices):\n self._nz_tuples = None\n self._maps = None\n self._build_maps(list_of_matrices)", "def __init__(self, elems, distanceFunc):\n\n # Copy elements, so that a change in the original list doens't affect us.\n # Initializes the first layer of t...
[ "0.71489555", "0.6744947", "0.6473067", "0.6180763", "0.61607593", "0.6154997", "0.61336666", "0.60712904", "0.5912458", "0.5818539", "0.57944226", "0.5765813", "0.57098126", "0.56682616", "0.56552696", "0.56047666", "0.55812633", "0.55705965", "0.55558026", "0.55558026", "0....
0.69439393
1
Sets the instance's list of categories.
def Categories(self, new_categories): if not isinstance(new_categories, ListType): raise TypeError("The supplied categories must be a list of " "strings.") for new_cat in new_categories: if not isinstance(new_cat, str): raise Type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories(self, categories: List[str]):\n\n self._categories = categories", "def categories(self, categories):\n self._categories = categories", "def categories(self, categories):\n\n self._categories = categories", "def categories(self, categories):\n\n self._categories = ca...
[ "0.8180503", "0.8054752", "0.79539806", "0.79539806", "0.79539806", "0.79539806", "0.77416676", "0.7283826", "0.6795959", "0.6541874", "0.65221226", "0.652018", "0.6424709", "0.63194025", "0.62667936", "0.6245432", "0.60854113", "0.60817057", "0.6035427", "0.6035427", "0.6035...
0.61341965
16
Returns an n x n, euclidean distance matrix, where n = len(cats).
def _derive_euclidean_dm(self, cat_mat, dim): res_mat = [] for i in range(dim): res_mat.append([0 for k in range(dim)]) for j in range(i): res_mat[i][j] = self._vector_dist(cat_mat[i], cat_mat[j]) res_mat[j][i] = res_mat[i][j] re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_euclidean_distance_Ndimension(self):\n\n self.assertEqual(15, euclidean_distance([0, 0, 0], [10, 10, 5]))\n self.assertEqual(15, euclidean_distance([0, 0, 0], [-10, -10, -5]))\n\n self.assertEqual(17, euclidean_distance([0, 0, 0, 0], [10, 10, 8, 5]))\n self.assertEqual(17, eucl...
[ "0.63608915", "0.6311762", "0.61636347", "0.6086619", "0.60644704", "0.6023166", "0.5941106", "0.593605", "0.59331864", "0.59106016", "0.5839895", "0.5833054", "0.5741629", "0.57378864", "0.571314", "0.5686183", "0.56578124", "0.56476825", "0.563727", "0.5628646", "0.56128794...
0.7085353
0
Calculates the Euclidean distance between two vectors.
def _vector_dist(self, vec1, vec2): return sqrt(sum([(float(v1) - float(v2)) ** 2 for v1, v2 in zip(vec1, vec2)]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distance(vector_1: Vector, vector_2: Vector) -> VectorOut:\n return np.sqrt(np.sum((np.asarray(vector_1) - np.asarray(vector_2)) ** 2))", "def euclidean_distance(vector1, vector2):\n e_dist = [(v1 - v2) ** 2 for v1, v2 in zip(vector1, vector2)]\n e_dist = math.sqrt(sum(e_dist))\n return...
[ "0.8404837", "0.8364985", "0.8345691", "0.83009183", "0.82114553", "0.8192061", "0.80804276", "0.8064695", "0.80627894", "0.80497986", "0.7939299", "0.79302233", "0.7912856", "0.7898598", "0.7885811", "0.7884806", "0.785643", "0.7766007", "0.7762393", "0.7749784", "0.7745183"...
0.8213617
4
Runs a Mantel test over the current distance matrices.
def __call__(self, num_perms=999): m1, m2 = self.DistanceMatrices alt = self.TailType # We suppress the symmetry and hollowness check since we are # guaranteed to have DistanceMatrix instances (we don't need to check a # second time here). results = mantel_test(m1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\r\n super(MantelTests, self).setUp()\r\n\r\n # Create two small test distance matrices.\r\n sample_ids = [\"S1\", \"S2\", \"S3\"]\r\n m1 = array([[0, 1, 2], [1, 0, 3], [2, 3, 0]])\r\n m2 = array([[0, 2, 7], [2, 0, 6], [7, 6, 0]])\r\n m1_dm = DistanceMatrix...
[ "0.70924836", "0.6946999", "0.65381736", "0.65378904", "0.6165956", "0.6134014", "0.6129247", "0.6078076", "0.59961593", "0.5978494", "0.59586674", "0.595806", "0.59397167", "0.59159815", "0.59097683", "0.59074956", "0.59048647", "0.58268934", "0.58065736", "0.57879245", "0.5...
0.61849463
4
Returns the path to the qiime R source directory
def _get_R_script_dir(self): qiime_dir = get_qiime_project_dir() script_dir = join(qiime_dir, 'qiime', 'support_files', 'R') return script_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qiime_project_dir():\r\n # Get the full path of util.py\r\n current_file_path = abspath(__file__)\r\n # Get the directory containing util.py\r\n current_dir_path = dirname(current_file_path)\r\n # Return the directory containing the directory containing util.py\r\n return dirname(current_...
[ "0.71736056", "0.7050493", "0.70075685", "0.69053704", "0.6825664", "0.6825664", "0.6809757", "0.6771447", "0.6749572", "0.6721281", "0.66418624", "0.6567186", "0.6480654", "0.6474615", "0.64742595", "0.64541686", "0.6444045", "0.64425254", "0.64304566", "0.6410117", "0.64009...
0.77418804
2
Resets the value of clip_qual_left for each read in the SFF data. For efficiency, the original read objects are not copied, and are modified as a side effect of this function.
def set_clip_qual_left(sff_data, technical_read_length): # TODO: Move to PyCogent header, reads = sff_data # sfftools use 1-based indexing clip_idx = technical_read_length + 1 def adjust_read(read): read['clip_qual_left'] = clip_idx return read return header, imap(a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_quality(self, reads):\n cut = self.quality_cutoff * 3\n start = 0\n qscores = reads[0][3]\n qual = ord(qscores[0]) + ord(qscores[1]) + ord(qscores[2]) - 99\n while qual < cut:\n start += 1\n try:\n qual += ord(qscores[start + 2]) - or...
[ "0.60202354", "0.5504652", "0.5438248", "0.5282291", "0.50549793", "0.49743077", "0.4939186", "0.4939186", "0.4895485", "0.48903704", "0.48795104", "0.4875207", "0.48593444", "0.48376766", "0.48351744", "0.4824226", "0.482289", "0.4804124", "0.4777413", "0.47692508", "0.47619...
0.7141343
0
Return the directory containing QIIME scripts. The scripts directory is inferred from the location of print_qiime_config.py (equivalent to running ``which print_qiime_config.py``). Will raise a ``ScriptsDirError`` if the scripts directory cannot be determined.
def get_qiime_scripts_dir(): script_fp = which('print_qiime_config.py') if script_fp is None: raise ScriptsDirError("Could not find the directory containing QIIME " "scripts. QIIME scripts must be accessible via " "the PATH environment v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scripts_dir(self):\n\n return os.path.join(self.path, 'Scripts' if sys.platform == 'win32'\n else 'bin')", "def test_get_qiime_scripts_dir(self):\r\n # get_qiime_scripts_dir will raise an error if it can't find a scripts\r\n # directory.\r\n scripts_dir = get_qiime_...
[ "0.76418823", "0.7155229", "0.69632226", "0.6878322", "0.6666741", "0.6666741", "0.6666741", "0.6614911", "0.6527753", "0.6449683", "0.6185446", "0.6103047", "0.5968703", "0.5899031", "0.5843286", "0.57601035", "0.57345283", "0.5698694", "0.56807274", "0.5663875", "0.56481856...
0.89993876
0
Returns the temp directory that should be used by QIIME scripts
def get_qiime_temp_dir(): qiime_config = load_qiime_config() qiime_config_value = qiime_config['temp_dir'] if qiime_config_value is not None: result = qiime_config_value else: result = '/tmp/' return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_temp_path():\n return os.getcwd() + \"/temp/\"", "def get_temp_dir():\n return tempfile.mkdtemp()", "def temp_directory(self):\n\n return self.get_raw(\"temp_directory\")", "def tempdir():\n\n # Create a directory and return the path\n return tempfile.mkdtemp()", "def sys_get...
[ "0.855277", "0.84744465", "0.82829946", "0.8273283", "0.81811154", "0.81584656", "0.8136526", "0.81322354", "0.81260616", "0.8048723", "0.79245996", "0.78713477", "0.78693324", "0.7854217", "0.7815373", "0.7811751", "0.77807343", "0.7773903", "0.77525896", "0.7743445", "0.773...
0.8672323
0
compute the median of the absolute deviations from the median
def median_absolute_deviation(x): x = asarray(x) median_x = median(x) median_abs_deviation = median(abs(x - median_x)) return median_abs_deviation, median_x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def median_absolute_deviation(x: np.ndarray) -> np.ndarray:\n return np.median(abs(x - np.median(x)))", "def median(self):\n # TO DO\n pass", "def median_absolute_deviation(values, q=None, return_median=False):\n if q is None:\n q = 1.482602218505602 # 1.0 / scipy.stats.norm.ppf(0.7...
[ "0.8193849", "0.7831032", "0.78197306", "0.77533805", "0.7704742", "0.7671658", "0.7670615", "0.7656723", "0.7654313", "0.76501", "0.764544", "0.7626023", "0.7613524", "0.7610276", "0.7592124", "0.7576799", "0.75517166", "0.75438654", "0.75415915", "0.75302845", "0.74893993",...
0.80844384
1
calculates the interquartile range of x x can be a list or an array returns min_val and max_val of the IQR
def IQR(x): x.sort() # split values into lower and upper portions at the median odd = len(x) % 2 midpoint = int(len(x) / 2) if odd: low_vals = x[:midpoint] high_vals = x[midpoint + 1:] else: # if even low_vals = x[:midpoint] high_vals = x[midpoint:] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interquartile_range(xs: List[float]) -> float:\n return quantile(xs, 0.75) - quantile(xs, 0.25)", "def interquartile_range(x):\n return (quantile(x,0.75) - quantile(x,0.25))", "def interq_range(sig):\n #ny.percentile(sig, 75) - ny.percentile(sig, 25)\n return np.percentile(sig, 75) - np.percent...
[ "0.82118887", "0.8116232", "0.7314758", "0.7219347", "0.6973636", "0.68285614", "0.6540529", "0.63932616", "0.63007987", "0.6284868", "0.6218757", "0.6202188", "0.6183039", "0.61811906", "0.6167323", "0.61633694", "0.6137818", "0.612418", "0.6115752", "0.6101491", "0.60625935...
0.7283655
3
This function tests whether an object is an array
def isarray(a): try: validity = isinstance(a, ndarray) except: validity = False return validity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsArray(obj):\n return isinstance(obj, (list, tuple))", "def is_arraylike(obj):\n if isinstance(obj, list):\n return True\n elif isinstance(obj, np.ndarray):\n return True\n elif isinstance(obj, pd.Series):\n return True\n elif isinstance(obj, pd.DataFrame):\n retur...
[ "0.83790463", "0.82952887", "0.78410655", "0.7759407", "0.77552557", "0.76584667", "0.7636191", "0.7628386", "0.75581044", "0.7444995", "0.7409759", "0.73884463", "0.717511", "0.71528465", "0.70953476", "0.7003281", "0.6997394", "0.69802105", "0.6865733", "0.68397504", "0.680...
0.75173235
9
Returns the Java version, or None if not installed
def get_java_version(): o, e, exit_status = qiime_system_call("java -version") if exit_status != 0: return None # expect the first line of stderr to be 'java version "x.y.z_build"' e = e.strip().splitlines() version_line = e[0] if not version_line.startswith('java version'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_java_version(java_path: Optional[Union[Path, str]] = None) -> Optional[Version]:\n if java_path is None:\n if JAVA_HOME_VAR in environ:\n java_path = path.join(environ[JAVA_HOME_VAR], \"bin\", \"java\")\n else:\n java_path = \"java\"\n if isinstance(java_path, Path...
[ "0.7216025", "0.7146274", "0.71338314", "0.7072079", "0.6814184", "0.6716393", "0.66763914", "0.65996337", "0.6527288", "0.64871615", "0.6462176", "0.6426842", "0.6426842", "0.64220953", "0.64136755", "0.636862", "0.63428015", "0.6333814", "0.6328413", "0.63253146", "0.632504...
0.8124306
0
check if a string is a valid branchname/refname for git
def is_valid_git_refname(refname): if len(refname) == 0: return False # git imposes a few requirements to accept a string as a # refname/branch-name # They can include slash / for hierarchical (directory) grouping, but no # slash-separated component can begin with a dot . or end wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_git_refname(self):\r\n # valid branchnames\r\n self.assertTrue(is_valid_git_refname('master'))\r\n self.assertTrue(is_valid_git_refname('debuggatron_2000'))\r\n self.assertTrue(is_valid_git_refname('refname/bar'))\r\n self.assertTrue(is_valid_git_refname('ref.na...
[ "0.79320574", "0.791769", "0.67501396", "0.67203665", "0.62849706", "0.61696523", "0.59306496", "0.5873341", "0.5872555", "0.5834097", "0.58012754", "0.58010453", "0.5795807", "0.57854915", "0.5765613", "0.5746446", "0.572548", "0.5721674", "0.57173187", "0.56951356", "0.5663...
0.841363
0
Converts a list into an numpy array
def _chk_asarray(a, axis): if axis is None: a = ravel(a) outaxis = 0 else: a = asarray(a) outaxis = axis return a, outaxis
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_numpy(a: List[tvm.nd.NDArray]) -> List[np.ndarray]:\n assert a is not None, \"Empty result cannot be converted to numpy\"\n return [x.numpy() for x in a]", "def listoflistToarray(l):\n max_dim=max([len(c) for c in l])\n all_array=[np.pad(c,(0,max_dim-len(c)),\"constant\",constant_value...
[ "0.78794366", "0.77643484", "0.7035512", "0.6887171", "0.6804242", "0.66597223", "0.6625578", "0.66064155", "0.66035634", "0.6599899", "0.6585208", "0.6538672", "0.65203327", "0.65179163", "0.64212126", "0.6378672", "0.63727", "0.6352784", "0.63464713", "0.63455033", "0.63074...
0.0
-1
Instantiates a MetadataMap object.
def __init__(self, sample_metadata, Comments): self._metadata = sample_metadata self.Comments = Comments self.no_data_value = 'no_data'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new():\n return ResearchMap()", "def __init__(self, mapElement=None):\n super().__init__() # init real Map stuff. absolutely necessary\n self._create_new_mindmap_hierarchy() # initialize a new instance\n if isinstance(mapElement, Elements.Map):\n self._from_map(mapElement...
[ "0.6519399", "0.630552", "0.6115899", "0.6084194", "0.60340434", "0.60268384", "0.6014825", "0.5999359", "0.59614205", "0.5941939", "0.59344774", "0.5895004", "0.5816193", "0.5800513", "0.5797123", "0.5795069", "0.5793026", "0.5785523", "0.577298", "0.57138103", "0.56648266",...
0.0
-1
Test this instance for equality with another.
def __eq__(self, other): if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testEquality(self):\n pass", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return equal(self, other)", "def test_equal(self):\n self.assertTrue(self.a == self.a)\n ...
[ "0.8481818", "0.81709707", "0.81709707", "0.81384295", "0.8048093", "0.7946097", "0.7946097", "0.7907177", "0.7907177", "0.78898937", "0.7868924", "0.7868924", "0.7868924", "0.78356946", "0.78356946", "0.78356946", "0.78356946", "0.78356946", "0.78356946", "0.78356946", "0.78...
0.0
-1
Test this instance for inequality with another.
def __ne__(self, other): return not self.__eq__(other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __neq__(self, other): \n return not self == other", "def __eq__(self, other):\n return abs(self - other) < 10e-10", "def __eq__(self, other):\n return not self.__ne__(other)", "def __eq__(self, other):\n return super().__ne__(other)", "def __ne__(self, other):\n ...
[ "0.76353043", "0.7604608", "0.7527", "0.7509268", "0.74682033", "0.74682033", "0.74408966", "0.74408966", "0.743726", "0.74232465", "0.74232465", "0.74232465", "0.74232465", "0.74232465", "0.74232465", "0.74232465", "0.74232465", "0.74232465", "0.74232465", "0.74232465", "0.7...
0.0
-1
Returns True if the category is numeric and False otherwise. A category is numeric if all values within the category can be converted to a float.
def isNumericCategory(self, category): category_values = self.getCategoryValues(self.SampleIds, category) is_numeric = True for category_value in category_values: try: float(category_value) except ValueError: is_numeric = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isNumericCategory(self):\n obs = self.overview_map.isNumericCategory('Treatment')\n self.assertEqual(obs, False)\n\n obs = self.overview_map.isNumericCategory('DOB')\n self.assertEqual(obs, True)", "def is_numeric(self) -> bool:\n return False", "def test_isNumericCa...
[ "0.73678356", "0.7315209", "0.7292299", "0.72664076", "0.7082336", "0.6898732", "0.6812119", "0.6646779", "0.65671283", "0.65328854", "0.65263027", "0.65052134", "0.6474965", "0.64602154", "0.6444974", "0.64411813", "0.64133173", "0.6411924", "0.6403705", "0.6381601", "0.6361...
0.8970309
0
Returns the names of all categories in the metadata map. The category names are returned as a list of strings in alphabetical order.
def CategoryNames(self): return sorted(self.getSampleMetadata(self.SampleIds[0]).keys()) \ if len(self.SampleIds) > 0 else []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category_names(self):\n return list(self.categories.keys())", "def category_names(self):\n return self._category_names", "def list_categories(self) -> List[Tuple[str, str]]:\n category_list = [(name, path) for name, path in self.category_map.items()]\n # Fix the order of category list.\...
[ "0.8162541", "0.79831105", "0.7430287", "0.73823494", "0.7301545", "0.7273312", "0.72691053", "0.7261066", "0.72265595", "0.72230166", "0.7196569", "0.7171038", "0.71617514", "0.70136416", "0.69959927", "0.6982386", "0.69195163", "0.6875747", "0.68597335", "0.68553025", "0.68...
0.78233063
2
Remove samples that are not in ``sample_ids_to_keep``. If ``strict=True``, a ``ValueError`` will be raised if any of the sample IDs in ``sample_ids_to_keep`` cannot be found in the metadata map.
def filterSamples(self, sample_ids_to_keep, strict=True): for sid in self.SampleIds: if sid not in sample_ids_to_keep: del self._metadata[sid] if strict: extra_samples = set(sample_ids_to_keep) - set(self.SampleIds) if extra_samples: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_sample_by_id(\n self, ids: AnyGenericIdentifier, **kwargs\n ) -> Optional[AnyGenericIdentifier]:\n target_ids = np.asarray(ids)\n if self.xsid.isin(target_ids).sum() == len(target_ids):\n return self._remove_samples_by_id(target_ids, **kwargs)\n else:\n ...
[ "0.6517689", "0.6142446", "0.58880925", "0.58324176", "0.58319473", "0.5656601", "0.5462819", "0.5421898", "0.5394651", "0.5354865", "0.5265912", "0.52365637", "0.51746875", "0.5108278", "0.5095027", "0.5093516", "0.50621784", "0.50555694", "0.5048498", "0.5037008", "0.499057...
0.8602226
0
Returns the path to the qiime R source directory.
def _get_R_script_dir(self): qiime_dir = get_qiime_project_dir() script_dir = join(qiime_dir, 'qiime', 'support_files', 'R') return script_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qiime_project_dir():\r\n # Get the full path of util.py\r\n current_file_path = abspath(__file__)\r\n # Get the directory containing util.py\r\n current_dir_path = dirname(current_file_path)\r\n # Return the directory containing the directory containing util.py\r\n return dirname(current_...
[ "0.72659874", "0.71835905", "0.7026262", "0.70079523", "0.6978047", "0.6929851", "0.6929851", "0.68812567", "0.6868368", "0.6810021", "0.67729944", "0.67151827", "0.66693574", "0.66325474", "0.65855044", "0.65673524", "0.65590113", "0.6544381", "0.6538809", "0.65255487", "0.6...
0.77916765
1
Returns the path to the R script to be executed.
def _get_R_script_path(self): return join(self._get_R_script_dir(), self._R_script)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_R_script_path(self):\r\n return join(self._get_R_script_dir(), self._r_script)", "def _get_R_script_path(self):\r\n return join(self._get_R_script_dir(), self._r_script)", "def _get_R_script_dir(self):\r\n qiime_dir = get_qiime_project_dir()\r\n script_dir = join(qiime_dir,...
[ "0.88645846", "0.88645846", "0.7781342", "0.7781342", "0.7781342", "0.7309737", "0.7117977", "0.6958692", "0.69560784", "0.6908475", "0.6840207", "0.65893275", "0.65607", "0.6527092", "0.64310426", "0.631211", "0.6269857", "0.624567", "0.62346953", "0.62346953", "0.62200487",...
0.8895581
0
Returns inverse of d, setting keys to values and values to list of keys. Note that each value will _always_ be a list, even if one item. Can be invoked with anything that can be an argument for dict(), including an existing dict or a list of tuples. However, keys are always appended in arbitrary order, not the input or...
def invert_dict(d): if isinstance(d, dict): temp = d else: temp = dict(d) result = {} for key, val in temp.iteritems(): if val not in result: result[val] = [] result[val].append(key) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invert(d):\n if d:\n return [dict(zip(d, i)) for i in zip(*d.values())]", "def invert_dict(d):\n inverse = dict()\n for key in d:\n val = d[key]\n # If val is in inverse, setdefault(val,[]) will just return\n # inverse[val], so this is like saying inverse[val].append(ke...
[ "0.71811914", "0.6698385", "0.6517623", "0.6424737", "0.60699224", "0.60536337", "0.5993593", "0.5946048", "0.58656144", "0.582533", "0.5808538", "0.5789065", "0.57117456", "0.5681991", "0.5676642", "0.5667063", "0.5662814", "0.5662814", "0.56320953", "0.5609546", "0.55930966...
0.65130603
3
Creates bins of sequence lens Useful for checking for valid aligned sequences.
def check_fasta_seqs_lens(input_fasta_fp): seq_lens = defaultdict(int) input_fasta_f = open(input_fasta_fp, "U") for label, seq in parse_fasta(input_fasta_f): seq_lens[len(seq)] += 1 input_fasta_f.close() formatted_seq_lens = [] for curr_key in seq_lens: forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_pad_mask(seq_lens):\n bs = seq_lens.size(0)\n max_time = seq_lens.max()\n seq_range = torch.arange(0, max_time, dtype=torch.int32, device=seq_lens.device)\n seq_range = seq_range.unsqueeze(0).expand(bs, max_time)\n mask = seq_range < seq_lens.unsqueeze(-1)\n return mask", "def make_age...
[ "0.61783385", "0.5904238", "0.59030366", "0.5874971", "0.58408403", "0.5781123", "0.5767474", "0.55725706", "0.55547285", "0.553515", "0.55074227", "0.5486172", "0.5464284", "0.54100615", "0.5381559", "0.53313684", "0.5324309", "0.5303888", "0.52731234", "0.523513", "0.520842...
0.0
-1
Tests that all sample IDs from mapping file are found in seq labels
def check_all_ids(fasta_labels, sample_ids): # Need to get modified fasta labels with underscore stripped raw_fasta_labels = set([label.split('_')[0] for label in fasta_labels]) sample_ids_not_found = [] for curr_id in sample_ids: if curr_id not in raw_fasta_label...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_label_indices_sample():\n expected = {0, 1, 2, 3}\n actual = util.get_label_indices(4, \"sample\")\n assert expected.intersection(set(actual))", "def test_check_all_ids(self):\r\n\r\n fasta_labels = ['sample1_1', 'sample1_2', 'sample3_3', 'sample2_4']\r\n\r\n sample_ids = ['sample...
[ "0.724974", "0.7123213", "0.7019788", "0.70128787", "0.6969896", "0.69674844", "0.6952323", "0.68479544", "0.6794556", "0.6728537", "0.6724429", "0.66979903", "0.66878", "0.6671758", "0.65992355", "0.6591061", "0.6571839", "0.6505247", "0.6470125", "0.645294", "0.6382257", ...
0.66713023
14
generate the toplevel index page
def generate_index_page(index_links, index_fp, order=[_index_headers['run_summary']]): # get containing directory for index_fp top_level_dir = split(split(index_fp)[0])[1] index_page_header = get_index_page_header() index_lines = [index_page_header] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n page = get_page_arg()\n\n items = load_data(page)\n total_pages = get_total_pages()\n context = {\"current_page\": page,\n \"total_pages\": total_pages,\n \"items\": items}\n\n return render_template('index.html', **context)", "def index():\n\n return {...
[ "0.70936733", "0.70704126", "0.7035931", "0.7005656", "0.6969515", "0.69618285", "0.6891507", "0.68145657", "0.6812006", "0.67965215", "0.6775357", "0.6749702", "0.6736186", "0.6691579", "0.668981", "0.6682336", "0.66630816", "0.6642437", "0.6612706", "0.6606615", "0.6606615"...
0.6725128
13
Test that we can find the directory containing QIIME scripts.
def test_get_qiime_scripts_dir(self): # get_qiime_scripts_dir will raise an error if it can't find a scripts # directory. scripts_dir = get_qiime_scripts_dir() self.assertTrue(isdir(scripts_dir), "The QIIME scripts directory does " "not exist: %s" % scripts_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_qiime_scripts_dir(self):\r\n obs = get_qiime_scripts_dir()\r\n\r\n # We can't do much testing of the observed value, but let's at least\r\n # check that the directory exists.\r\n self.assertTrue(isdir(obs))", "def test_get_qiime_project_dir(self):\r\n\r\n # Do an e...
[ "0.78888476", "0.7095885", "0.6965876", "0.6923819", "0.63069737", "0.6272988", "0.6252138", "0.6130988", "0.6109121", "0.6109121", "0.6109121", "0.6063167", "0.6049399", "0.6011027", "0.59395754", "0.5922645", "0.58561355", "0.5782959", "0.5780418", "0.5749835", "0.5702966",...
0.86149687
0
Raises errors if invalid SampleIDs supplied
def test_check_mapping_data_invalid_sampleids(self): mapping_data = ['Sample1\tAAAA\tACTG\tFile1\ts.1'.split('\t'), 'Sam&ple2\tCCCC\tACTG\tFile2\ts.2'.split('\t'), 'Sample3\tTTTT\tACTG\tFile3\ts.3'.split('\t') ] headers = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_sample_ids(tumor_ids, normal_ids, expected_ids):\n if tumor_ids and normal_ids:\n arg_ids = set(tumor_ids + normal_ids)\n if arg_ids.symmetric_difference(expected_ids):\n print(\"Specified sample IDs:\",\n \", \".join(tumor_ids), \"(tumor) /\",\n ...
[ "0.69351166", "0.68496805", "0.6842933", "0.6803445", "0.6783971", "0.67526674", "0.658722", "0.6511453", "0.64769065", "0.6424928", "0.6392973", "0.6357554", "0.6350647", "0.62689936", "0.6262451", "0.6262451", "0.6230653", "0.620408", "0.62003356", "0.6178936", "0.61595035"...
0.6291059
13
AlphaDiversity __init__ should store metric, name, params
def test_init(self): c = AlphaDiversityCalc(observed_otus) self.assertEqual(c.Metric, observed_otus) self.assertEqual(c.Params, {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n self.metric = 'ACURCY'", "def __init__(self):\n super().__init__()\n self.metric = 'MAHLNBS'", "def __init__(self):\n super().__init__()\n self.metric = 'AUC'", "def __init__(self):\n super().__init__()\n self....
[ "0.70491505", "0.68786556", "0.6831932", "0.67831004", "0.67824405", "0.67029756", "0.66652644", "0.6643479", "0.66429514", "0.6636226", "0.6634421", "0.6626509", "0.65915763", "0.65810925", "0.6566919", "0.6537389", "0.6534936", "0.65262777", "0.6522142", "0.6488326", "0.648...
0.695457
1
Abstract TaxonAssigner __init__ should store name, params
def test_init(self): p = TaxonAssigner({}) self.assertEqual(p.Name, 'TaxonAssigner') self.assertEqual(p.Params, {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, params):\r\n _params = {\r\n 'Confidence': 0.80,\r\n 'id_to_taxonomy_fp': None,\r\n 'reference_sequences_fp': None,\r\n 'training_data_properties_fp': None,\r\n 'max_memory': None\r\n }\r\n _params.update(params)\r\n ...
[ "0.84420127", "0.82170045", "0.74503237", "0.6419056", "0.63100904", "0.6304798", "0.6282559", "0.6174831", "0.6163666", "0.6127048", "0.610635", "0.60937566", "0.6038813", "0.60376906", "0.6008651", "0.59984374", "0.59393674", "0.5907912", "0.58942956", "0.5892005", "0.58708...
0.6804477
3
RdpTaxonAssigner.__init__ should set default attributes and params
def test_init(self): self.assertEqual(self.default_app.Name, 'RdpTaxonAssigner')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, params):\r\n _params = {\r\n 'Confidence': 0.80,\r\n 'id_to_taxonomy_fp': None,\r\n 'reference_sequences_fp': None,\r\n 'training_data_properties_fp': None,\r\n 'max_memory': None\r\n }\r\n _params.update(params)\r\n ...
[ "0.8051706", "0.77154505", "0.74556786", "0.7077688", "0.70707446", "0.70669216", "0.6016109", "0.5964835", "0.5803026", "0.5801025", "0.5782054", "0.57641786", "0.57641786", "0.5750485", "0.572595", "0.5724398", "0.5712945", "0.56923705", "0.5677021", "0.5661355", "0.5652802...
0.5462746
35
correct_barcode should correctly assign barcode to 2nd possibility, 2 errors
def test_correct_barcode(self): original = 'ATTTTTTTTTCG' recieved = 'ATTTTTTTTTTT' possibilities = ['TGTATTCGTGTA', 'ATTTTTTTTTCG', 'TGTAGGCGTGTA', 'TGTAGAAGTGTA', 'TGTAGGCGTATA', 'TGTAAAAAAAAA'] decoded, num_errors = barcode.correct_barcode(recieved, possi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correct_barcode_no_error_correction(self):\r\n barcode = \"GGAGACAAGGGT\"\r\n barcode_to_sample_id = {\r\n \"GGAGACAAGGGA\": \"s1\",\r\n \"ACACCTGGTGAT\": \"s2\"}\r\n correction_fn = None\r\n\r\n actual = correct_barcode(barcode, barcode_to_sample_id, corr...
[ "0.8040793", "0.79315007", "0.7567298", "0.7336297", "0.7285581", "0.7266206", "0.72593397", "0.7188327", "0.717698", "0.71624744", "0.7138813", "0.7043331", "0.6956788", "0.6935819", "0.6728963", "0.6705005", "0.66977936", "0.66636986", "0.6424947", "0.64089566", "0.637265",...
0.8233028
0
correct_barcode should not assign barcode to to a tie situation
def test_correct_barcode_bitwise_tie(self): nt_to_bits = {"A": "11", "C": "00", "T": "10", "G": "01"} # ~ original = 'ATTTTTTTTTCG' #doesn't matter, last entry is just # as close to recieved as original is recieved = 'ATTTTTTTTTTT' possibilities = ['TGTATTCGTGTA', 'ATTTTTT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correct_barcode_no_error_correction(self):\r\n barcode = \"GGAGACAAGGGT\"\r\n barcode_to_sample_id = {\r\n \"GGAGACAAGGGA\": \"s1\",\r\n \"ACACCTGGTGAT\": \"s2\"}\r\n correction_fn = None\r\n\r\n actual = correct_barcode(barcode, barcode_to_sample_id, corr...
[ "0.7608354", "0.7358244", "0.7342083", "0.67923534", "0.6742199", "0.66620487", "0.65922964", "0.6332085", "0.6327996", "0.62583005", "0.62437576", "0.6218524", "0.6098731", "0.6098461", "0.60577065", "0.6044356", "0.5970685", "0.59445757", "0.58585757", "0.5806525", "0.58034...
0.6643164
6
iter_color_groups should iterate over color groups correctly.
def test_iter_color_groups(self): obs = iter_color_groups(self.mapping, self.prefs) obs1 = list(obs) obs_label = obs1[0][0] obs_groups = obs1[0][1] obs_colors = obs1[0][2] obs_data_colors = obs1[0][3] obs_data_color_order = obs1[0][4] data_colo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_color_groups(self):\r\n data_colors = color_dict_to_objects(self.data_color_hsv)\r\n\r\n exp = None\r\n obs = color_groups(self.groups, data_colors, self.data_color_order)\r\n\r\n self.assertEqual(obs, exp)", "def test_get_group_colors(self):\r\n\r\n data_colors = colo...
[ "0.766605", "0.7280512", "0.6903963", "0.6469302", "0.63861734", "0.6330357", "0.6201469", "0.6015716", "0.5904687", "0.5760493", "0.575252", "0.5735826", "0.5732428", "0.56977403", "0.5689754", "0.553577", "0.55184823", "0.55155927", "0.54933965", "0.5472813", "0.5450528", ...
0.82986265
0
get_group_colors should iterate over color groups correctly.
def test_get_group_colors(self): data_colors = color_dict_to_objects(self.data_color_hsv) exp = (self.colors, data_colors, self.data_color_order) obs = get_group_colors(self.groups, self.colors, data_colors, self.data_color_order) self.assertEqual(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group_colors(groups, colors, data_colors=data_colors,\r\n data_color_order=data_color_order):\r\n\r\n added_data_colors = {}\r\n if isinstance(colors, dict):\r\n # assume we're getting some of the colors out of a dict\r\n if colors.items() != []:\r\n for k...
[ "0.7321239", "0.72668946", "0.71839064", "0.6697492", "0.66628456", "0.66030544", "0.63645273", "0.63457793", "0.6148788", "0.60484743", "0.5986208", "0.595714", "0.5886008", "0.5879816", "0.58792245", "0.58474326", "0.58338255", "0.58303213", "0.5772704", "0.57577384", "0.57...
0.77890056
0
Test that sampleId_pairs returns the correct combos/sampleId's.
def test_sampleId_pairs(self): # expected values dose_vps = \ [('1xDose', '2xDose'), ('1xDose', 'Control'), ('2xDose', 'Control')] ttd_vps = \ [('31', '21'), ('31', '55'), ('31', '67'), ('21', '55'), ('21', '67'), ('55', '67')] do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_map_sample_ids(self):\r\n expected = ['s4', 's1', 's2', 's3']\r\n actual = map_sample_ids(self.sample_ids1, self.sample_id_map1)\r\n self.assertEqual(actual, expected)\r\n expected = ['s1', 's2', 's3', 's4']\r\n actual = map_sample_ids(self.sample_ids2, self.sample_id_ma...
[ "0.7379718", "0.73010206", "0.6999549", "0.6980964", "0.6939443", "0.6922288", "0.6734749", "0.6730469", "0.66457117", "0.66457117", "0.6634565", "0.6589484", "0.64334387", "0.6386897", "0.6365137", "0.63427037", "0.6315736", "0.6309852", "0.6303999", "0.6220689", "0.61957055...
0.8513367
0
Test Moran's I on distance matrix with nondiagonal zeros.
def test_compare_categories_morans_i_zeros(self): method = 'morans_i' compare_categories(self.dm2_fp, self.map2_fp, method, ['NumCat'], 999, self.test_dir) results_fp = join(self.test_dir, '%s_results.txt' % method) self.files_to_remove.append(results_fp) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_matrix_distance(self):\n # note that the score matrix must contain 'diagonal' elements m[i][i]\n # to avoid failure when the sequences match.\n m = {\"U\": {\"U\": 0, \"C\": 1, \"A\": 5}, \"C\": {\"C\": 0, \"A\": 2, \"G\": 4}}\n self.assertEqual(self.RNA(\"UUUCCC\").matrix_dist...
[ "0.63939977", "0.61509657", "0.61509657", "0.5918569", "0.5892827", "0.58719116", "0.58626074", "0.58567727", "0.5853549", "0.58245885", "0.5790331", "0.5760023", "0.5757075", "0.57496065", "0.5747695", "0.5722436", "0.57198995", "0.57038665", "0.56994504", "0.56747305", "0.5...
0.0
-1
Test compare_categories() on invalid input that should error out.
def test_compare_categories_invalid_input(self): # Non-numeric categories with BEST and Moran's I. for method in self.num_methods: self.assertRaises(TypeError, compare_categories, self.dm1_fp, self.map1_fp, method, self.cat_categories, self.num_perms, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_category_input_1(self):\n assert validation.check_category_input(1, []) == False", "def test_check_category_input_2(self):\n choices = [(1, 'choice 1'), (2, 'choice 2')]\n assert validation.check_category_input(3, choices) == False", "def test_category_invalid(self):\n ...
[ "0.72558904", "0.6967396", "0.6916288", "0.6872563", "0.679183", "0.6721438", "0.6617516", "0.6532291", "0.64855945", "0.6464263", "0.64602053", "0.64289844", "0.6411176", "0.64010024", "0.6371498", "0.631171", "0.6309396", "0.6296743", "0.62393725", "0.62310433", "0.62245345...
0.8044374
0
Test running mantel test on two distmats that are incompatible.
def test_run_mantel_test_too_small(self): exp = '# A sample comment.\nDM\tDM\tNumber of entries\tMantel r ' + \ 'statistic\tp-value\tNumber of permutations\tTail type\nfoo.txt\t' + \ 'bar.txt\t\tToo few samples\n' obs = run_mantel_test('mantel', [self.fp1, self.fp2], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mantel_test_invalid_distance_matrix(self):\r\n # Single asymmetric, non-hollow distance matrix.\r\n self.assertRaises(ValueError, mantel_test, array([[1, 2], [3, 4]]),\r\n array([[0, 0], [0, 0]]), 999)\r\n\r\n # Two asymmetric distance matrices.\r\n sel...
[ "0.6768934", "0.6749704", "0.6720166", "0.67067415", "0.6628436", "0.6490698", "0.6477109", "0.64399654", "0.6437533", "0.63701916", "0.6342147", "0.6220667", "0.6180116", "0.6172408", "0.61654663", "0.6129409", "0.6122598", "0.6115497", "0.61116254", "0.61102426", "0.6101061...
0.0
-1
Test using a sample ID map that is incomplete.
def test_make_compatible_taxa_summaries_sample_id_map_incomplete_map(self): self.assertRaises(ValueError, _make_compatible_taxa_summaries, self.taxa_summary3, self.taxa_summary4, self.sample_id_map3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_map_sample_ids(self):\r\n expected = ['s4', 's1', 's2', 's3']\r\n actual = map_sample_ids(self.sample_ids1, self.sample_id_map1)\r\n self.assertEqual(actual, expected)\r\n expected = ['s1', 's2', 's3', 's4']\r\n actual = map_sample_ids(self.sample_ids2, self.sample_id_ma...
[ "0.7807454", "0.7676753", "0.76762724", "0.73206776", "0.7303138", "0.726232", "0.716163", "0.703441", "0.69862926", "0.69625264", "0.6787078", "0.6771914", "0.67403334", "0.6695887", "0.66476816", "0.66374177", "0.6629168", "0.6609879", "0.6545724", "0.6545594", "0.6482399",...
0.62781256
26
Test on taxa summaries that have no common sample IDs.
def test_make_compatible_taxa_summaries_incompatible(self): self.assertRaises(ValueError, _make_compatible_taxa_summaries, self.taxa_summary3, self.taxa_summary4) self.assertRaises(ValueError, _make_compatible_taxa_summaries, self.taxa_summary1, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_core_observations_across_sample_ids_no_core(self):\r\n actual = core_observations_across_sample_ids(self.otu_table_data2,\r\n [\"S1\", \"s2\", \"s3\", \"s4\"],\r\n fraction_for_core=1.)\r\n ...
[ "0.65271956", "0.64716846", "0.6361295", "0.633824", "0.6198949", "0.61501414", "0.6144836", "0.6099675", "0.6040916", "0.5912129", "0.58962", "0.58746755", "0.58677095", "0.5856113", "0.58112234", "0.58055794", "0.5793776", "0.578858", "0.5769501", "0.5769501", "0.5762385", ...
0.55812323
40
Test when the taxa summaries have no intersection.
def test_sort_and_fill_taxa_summaries_no_intersection(self): exp = [(['Even1', 'Even2'], ['Eukarya', 'foo'], array([[0.5, 0.6], [0.0, 0.0]])), (['Even1', 'Even2'], ['Eukarya', 'foo'], array([[0.0, 0.0], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compare_taxa_summaries_no_permutations(self):\r\n # Verified with R's cor.test function.\r\n exp = ('# Correlation coefficient: pearson.\\n# The parametric '\r\n 'p-value(s) were calculated using a one-sided (positive '\r\n 'association) test of significance using...
[ "0.5811386", "0.5803989", "0.57428086", "0.5669357", "0.5659517", "0.560434", "0.5597631", "0.55910033", "0.55824584", "0.5485582", "0.5469024", "0.54610133", "0.5428131", "0.53871137", "0.534548", "0.5345129", "0.529956", "0.528615", "0.5250797", "0.5242913", "0.5226474", ...
0.70535433
0
Test running on taxa summaries that have mismatched taxa info.
def test_compute_correlation_incompatible_taxa(self): self.assertRaises(ValueError, _compute_correlation, self.taxa_summary_obs1_mismatch, self.taxa_summary_exp1, 'expected', 'pearson', 'low', 999, 0.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compare_taxa_summaries_invalid_input(self):\r\n # Invalid comparison mode.\r\n self.assertRaises(ValueError, compare_taxa_summaries,\r\n self.taxa_summary_obs1, self.taxa_summary_exp1, 'foo',\r\n 'pearson')\r\n # Invalid correlation ty...
[ "0.7360188", "0.7325517", "0.72328967", "0.6965286", "0.6846915", "0.66137344", "0.65963393", "0.6463617", "0.6364973", "0.635977", "0.6336691", "0.6334088", "0.6231445", "0.62314326", "0.6178969", "0.6159777", "0.61419666", "0.6108688", "0.6029008", "0.60027236", "0.5995026"...
0.68330705
5
core_observations_across_sample_ids handles invalid input as expected
def test_core_observations_across_sample_ids_invalid(self): self.assertRaises(ValueError, core_observations_across_sample_ids, self.otu_table_data1, ["S1", "s2"], fraction_for_core=1.001) self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_core_observations_across_sample_ids_no_core(self):\r\n actual = core_observations_across_sample_ids(self.otu_table_data2,\r\n [\"S1\", \"s2\", \"s3\", \"s4\"],\r\n fraction_for_core=1.)\r\n ...
[ "0.73646283", "0.7096564", "0.65549344", "0.63630575", "0.6240969", "0.62191427", "0.6051876", "0.6018775", "0.60087675", "0.5905475", "0.58208007", "0.58101803", "0.5762269", "0.5753019", "0.5724958", "0.5724496", "0.56497747", "0.5629322", "0.56237", "0.5620653", "0.5620653...
0.7383749
0
Set up test data, output dir for unit tests
def setUp(self): self.valid_mapping_data_golay = valid_mapping_data_golay self.valid_mapping_data_golay_upper = valid_mapping_data_golay_upper self.valid_mapping_data_var_len_bcs = valid_mapping_data_var_len_bcs self.valid_mapping_data_no_bcs_added_demultiplex =\ valid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.test_root = tempfile.mkdtemp(dir=tmpdir)\n self.test_input = os.path.join(self.test_root, 'input')\n self.test_output = os.path.join(self.test_root, 'output')\n self.test_output_tree = os.path.join(self.test_output, 'tree')\n self.test_output_meta = os.pat...
[ "0.81107897", "0.8006544", "0.7680137", "0.76646286", "0.75922984", "0.75809777", "0.75765467", "0.7543082", "0.74492097", "0.73579705", "0.73579705", "0.73579705", "0.73579705", "0.73221874", "0.73190767", "0.7309944", "0.7255049", "0.7229703", "0.7206426", "0.7204289", "0.7...
0.0
-1
Corrects barcode with exact match to given barcodes
def test_attempt_bc_correction_exact_match(self): curr_bc = "AGCAGCACTTGT" all_bcs = ["AACTCGTCGATG", "AGCAGCACTTGT", "ACAGAGTCGGCT"] barcode_type = "golay_12" actual_bc, actual_errs = attempt_bc_correction(curr_bc, all_bcs, b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correct_barcode_exact_match(self):\r\n barcode = \"GGAGACAAGGGA\"\r\n barcode_to_sample_id = {\r\n \"GGAGACAAGGGA\": \"s1\",\r\n \"ACACCTGGTGAT\": \"s2\"}\r\n correction_fn = None\r\n\r\n actual = correct_barcode(barcode, barcode_to_sample_id, correction_f...
[ "0.78917783", "0.7772554", "0.7302875", "0.6955409", "0.68505305", "0.6501231", "0.6499392", "0.6468834", "0.64518964", "0.6381223", "0.6345494", "0.6306279", "0.62957567", "0.6287522", "0.6262101", "0.6078352", "0.5999856", "0.5997763", "0.5975938", "0.59731233", "0.5965087"...
0.61608857
15
Returns empty string, no errors for zero length barcode
def test_attempt_bc_correction_no_barcode(self): curr_bc = "" all_bcs = [""] barcode_type = 0 actual_bc, actual_errs = attempt_bc_correction(curr_bc, all_bcs, barcode_type) expected_bc = "" expected_errs = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_code(self) -> str:\n if len(self.code) >= self.BARCODE_LENGTH:\n code = self.code[:self.BARCODE_LENGTH]\n\n # Calculate the checksum digit\n check_digit = self.calculate_checksum(code)\n return code + str(check_digit)", "def checkBarcode(barcode):\r\n...
[ "0.70336574", "0.6922889", "0.63205606", "0.63151693", "0.63137376", "0.6227066", "0.6212405", "0.6198921", "0.61817396", "0.61761874", "0.61646605", "0.6149736", "0.5991188", "0.5969364", "0.59561193", "0.5912054", "0.5911976", "0.58922714", "0.5838528", "0.5770463", "0.5767...
0.6091583
12
Gets corrected barcode and no matches to added demultiplex field
def test_get_curr_bc_added_field_bc_and_added_field_no_hit(self): curr_bc = "" ids_bcs_added_field = {("", "1"): "s1", ("", "2"): "s2", ("", "3"): "s3"} fasta_label = "123ABC region=1 length=255" all_bcs = [""] barcode_type = 0, dis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_curr_bc_added_field_barcode_only_no_errs_no_correction(self):\r\n\r\n curr_bc = \"AGCAGCACTTGT\"\r\n ids_bcs_added_field = {(\"AACTCGTCGATG\", \"\"): \"s1\",\r\n (\"AGCAGCACTTGT\", \"\"): \"s2\", (\"ACAGAGTCGGCT\", \"\"): \"s3\"}\r\n fasta_label = \"1...
[ "0.6773668", "0.6711673", "0.64199287", "0.6315681", "0.62939423", "0.6071315", "0.5987921", "0.5901413", "0.5894737", "0.58161867", "0.5798646", "0.5790996", "0.57897574", "0.5711651", "0.57029325", "0.5654523", "0.5630455", "0.5627762", "0.56084865", "0.55671185", "0.556202...
0.6162608
5
Test that errors are thrown on bad input.
def test_sample_ids_from_category_state_coverage_invalid_input(self): # Using SampleID for coverage, subject, or splitter category. self.assertRaises(ValueError, sample_ids_from_category_state_coverage, self.tutorial_mapping_f, 'SampleID', 'DOB', r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_with_invalid_input(self):\n for dataset_type in ['ruler', 'pencil', 'cheese']:\n with self.assertRaises(ValueError) as exc:\n check_dataset_type(dataset_type)\n self.assertEqual(\"Dataset type not 'regular' or 'raw' is %s\" % dataset_type,\n ...
[ "0.7646355", "0.74732614", "0.7330099", "0.7325165", "0.7322163", "0.7304801", "0.7283459", "0.7280039", "0.723218", "0.7213631", "0.7189745", "0.7089766", "0.69922644", "0.6989655", "0.6984586", "0.69749165", "0.6972549", "0.6953583", "0.6905646", "0.6884287", "0.6861997", ...
0.0
-1
_get_indices() should return a list of size 1 for a single item in a list that exists in the search list.
def test_get_indices_one_existing_item_list(self): item_to_find = ['PC.355'] self.assertEqual(_get_indices(self.dist_matrix_header, item_to_find), [1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_indices(input_items, wanted_items):\r\n # Note: Some of this code is taken from Jeremy Widmann's\r\n # get_valid_indices() function, part of make_distance_histograms.py from QIIME 1.8.0.\r\n try:\r\n iter(input_items)\r\n except:\r\n raise ValueError(\"The input_items to search m...
[ "0.7378837", "0.7062886", "0.67311704", "0.65930766", "0.64264196", "0.6367182", "0.6360139", "0.63577443", "0.63576627", "0.63103926", "0.6285134", "0.62766427", "0.62578773", "0.62032807", "0.6193279", "0.61468923", "0.6139803", "0.6131929", "0.61170864", "0.6106565", "0.60...
0.69062996
2
_get_indices() should throw an error if the search list is None, and return an empty list if the search list is empty.
def test_get_indices_null_or_empty_search_list(self): search_list = None self.assertRaises(ValueError, _get_indices, search_list, 'item') search_list = [] self.assertEqual(_get_indices(search_list, 'item'), []) search_list = '' self.assertEqual(_get_indices(sear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_indices_no_items_to_search(self):\r\n item_to_find = []\r\n self.assertEqual(_get_indices(self.dist_matrix_header, item_to_find),\r\n [])\r\n item_to_find = ''\r\n self.assertEqual(_get_indices(self.dist_matrix_header, item_to_find),\r\n ...
[ "0.7225598", "0.6287488", "0.62460774", "0.5818007", "0.57960397", "0.5715178", "0.5708069", "0.5674469", "0.5671301", "0.56687474", "0.5661346", "0.5624029", "0.55601346", "0.55436325", "0.5542161", "0.55330354", "0.5532859", "0.5467213", "0.5450728", "0.54404855", "0.542008...
0.75840676
0
extract_per_individual_states_from_sample_metadata handles invalid input
def test_extract_per_individual_states_from_sample_metadata_invalid(self): self.assertRaises(KeyError, extract_per_individual_states_from_sample_metadata, self.individual_states_and_responses_map_f1, state_category="some-invalid-c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extract_per_individual_states_from_sample_metadata(self):\r\n expected = {'001': ['001A', '001B'],\r\n '006': ['006A', '006B'],\r\n '007': ['007A', '007B'],\r\n '008': ['008A', '008B']}\r\n actual = extract_per_individual_states_from_s...
[ "0.8324693", "0.76368827", "0.7623717", "0.73384356", "0.66621786", "0.65734243", "0.5971411", "0.5933306", "0.5918493", "0.58698344", "0.5815019", "0.57827365", "0.57268506", "0.5720483", "0.5626442", "0.5532057", "0.5513011", "0.54918486", "0.54844934", "0.5484441", "0.5484...
0.7579958
3
Test correctly raises an error on bad input.
def test_cast_y_axis_extrema_invalid_input(self): self.assertRaises(ValueError, _cast_y_axis_extrema, 'foo')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_input(alice):\n with pytest.raises(TypeError):\n alice.pack(\"blah\")", "def test_validate_input_rejection(self):\n with nose.assert_raises(exceptions.RejectionError):\n self.dtm1.validate_input('000011')", "def test_wrong_input(self):\n\n test_float = 2954.02\n ...
[ "0.7674494", "0.7624044", "0.7603118", "0.75841063", "0.75523627", "0.751939", "0.74743915", "0.7453983", "0.7376594", "0.73117447", "0.7296594", "0.7285998", "0.7243268", "0.71520144", "0.7151653", "0.71410406", "0.7129787", "0.71250945", "0.7122759", "0.70882404", "0.707328...
0.0
-1
Test that grouped correlation results are correctly formatted.
def test_grouped_correlation_formatter(self): obs_rhos, obs_pvals, obs_f_pvals, obs_f_rhos, obs_f_hs = \ run_grouped_correlation(self.mds1, self.otus1, 'pearson', CORRELATION_TEST_CHOICES, 'parametric_t_distribution') obs_lines = grouped_correlation_fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grouped_correlation_row_generator(self):\r\n category = 'val'\r\n gc_to_samples = \\\r\n {'1': ['s1', 's3', 's7', 's9', 's2'],\r\n '2': ['s6', 's5', 's4', 's8', 's10']}\r\n bt = parse_biom_table(self.bt_str)\r\n pmf = parse_mapping_file_to_dict(self.mf_or...
[ "0.6863243", "0.66166186", "0.65718156", "0.6489005", "0.64264065", "0.62673044", "0.62436724", "0.6118696", "0.609138", "0.60614604", "0.6054925", "0.5997348", "0.5985475", "0.5952734", "0.5925707", "0.58435106", "0.58228874", "0.57969815", "0.57870674", "0.5767576", "0.5753...
0.7929429
0
make_HTML_table should Make HTML tables for one set charts
def test_make_HTML_table(self): # test pie charts fracs_labels_other, fracs_labels, all_counts, other_cat, red, other_frac = \ get_fracs(self.counts1, 5, 10, 'pie') img_data = make_HTML_table("Phylum", other_frac, 10, red, other_cat, fracs_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_HTML_table(l, other_frac, total, red, other_cat, fracs_labels_other,\r\n fracs_labels, dir_path, all_counts, level,\r\n prefs, pref_colors, background_color, label_color, chart_type,\r\n label, generate_image_type,\r\n plot_width,...
[ "0.75786716", "0.71039385", "0.7082773", "0.7067026", "0.70176846", "0.6954981", "0.6895339", "0.6763901", "0.6687952", "0.6668799", "0.66515106", "0.66515106", "0.6643246", "0.6577566", "0.6551358", "0.6547367", "0.64763635", "0.6471805", "0.64496785", "0.6449541", "0.644154...
0.7449876
1
stdev_from_mean returns num std devs from mean for each val in x
def test_stdev_from_mean(self): x = [2.1, 4.2, 5.9, 8.4, 9.6] result = stdev_from_mean(x) self.assertFloatEqual( result, [-1.292463399014413, -0.60358696806764478, -0.045925095396451399, 0.77416589382589174, 1.1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stdev_from_mean(x):\r\n x = array(x)\r\n return (x - mean(x)) / std(x)", "def stdev(values):\n mean = avg(values)\n diffs = [(value - mean) ** 2 for value in values]\n return avg(diffs) ** 0.5", "def std_deviation_of_mean_value(x):\n\n import numpy as np\n x = np.array(x)\n ...
[ "0.88022584", "0.80162585", "0.78191644", "0.76924706", "0.76469624", "0.76407045", "0.7498243", "0.74418306", "0.74380845", "0.74339056", "0.7385239", "0.7364035", "0.7340163", "0.7326558", "0.7281538", "0.7271138", "0.7260991", "0.72365606", "0.7221531", "0.72169876", "0.72...
0.84916115
1
Set up required values for all G test test.
def setUp(self): pass # nothing required by all
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.params_1 = {\"S\":100,\"K\":100,\"Vol\":0.2,\"R\":0.05,\"T\":1}\n self.params_2 = {\"S\":100,\"K\":100,\"Vol\":0.2,\"R\":0.00,\"T\":1}\n pass", "def setUp(self):\n self.number_of_tests = 20 # number of pseudo-random seeds\n self.max_nq = 2 # maximal nu...
[ "0.70728576", "0.68890285", "0.6801041", "0.6756314", "0.66775054", "0.66227436", "0.66112846", "0.65473115", "0.65369564", "0.65363914", "0.65089905", "0.6475528", "0.64651555", "0.6416974", "0.64070016", "0.63986", "0.639366", "0.63730013", "0.63685673", "0.63326687", "0.63...
0.0
-1