Merge branch 'luke_tests'
This commit is contained in:
@ -106,7 +106,7 @@ def run(config):
|
||||
raise RuntimeError('No file format specified')
|
||||
|
||||
# Temporary way to handle NA values
|
||||
NA_list = ["nan"]
|
||||
#NA_list = ["nan"]
|
||||
|
||||
# Create DMS
|
||||
d = OBIDMS(config['obi']['defaultdms'])
|
||||
@ -126,10 +126,11 @@ def run(config):
|
||||
view[i][tag] = seq['tags'][tag]
|
||||
i+=1
|
||||
|
||||
print(view)
|
||||
# print(view.__repr__())
|
||||
#print(view)
|
||||
print(view.__repr__())
|
||||
|
||||
view.save_and_close()
|
||||
d.close()
|
||||
|
||||
print("Done.")
|
||||
|
@ -1,5 +1,3 @@
|
||||
../../../src/obidmscolumn_bool.c
|
||||
../../../src/obidmscolumn_bool.h
|
||||
../../../src/bloom.h
|
||||
../../../src/bloom.c
|
||||
../../../src/char_str_indexer.h
|
||||
@ -39,3 +37,15 @@
|
||||
../../../src/obiview.c
|
||||
../../../src/utils.h
|
||||
../../../src/utils.c
|
||||
../../../src/obidmscolumn_bool.c
|
||||
../../../src/obidmscolumn_bool.h
|
||||
../../../src/obidmscolumn_char.c
|
||||
../../../src/obidmscolumn_char.h
|
||||
../../../src/obidmscolumn_float.c
|
||||
../../../src/obidmscolumn_float.h
|
||||
../../../src/obidmscolumn_int.c
|
||||
../../../src/obidmscolumn_int.h
|
||||
../../../src/obidmscolumn_seq.c
|
||||
../../../src/obidmscolumn_seq.h
|
||||
../../../src/obidmscolumn_str.c
|
||||
../../../src/obidmscolumn_str.h
|
||||
|
@ -1,5 +1,3 @@
|
||||
../../../src/obidmscolumn_char.c
|
||||
../../../src/obidmscolumn_char.h
|
||||
../../../src/bloom.h
|
||||
../../../src/bloom.c
|
||||
../../../src/char_str_indexer.h
|
||||
@ -39,3 +37,15 @@
|
||||
../../../src/obiview.c
|
||||
../../../src/utils.h
|
||||
../../../src/utils.c
|
||||
../../../src/obidmscolumn_bool.c
|
||||
../../../src/obidmscolumn_bool.h
|
||||
../../../src/obidmscolumn_char.c
|
||||
../../../src/obidmscolumn_char.h
|
||||
../../../src/obidmscolumn_float.c
|
||||
../../../src/obidmscolumn_float.h
|
||||
../../../src/obidmscolumn_int.c
|
||||
../../../src/obidmscolumn_int.h
|
||||
../../../src/obidmscolumn_seq.c
|
||||
../../../src/obidmscolumn_seq.h
|
||||
../../../src/obidmscolumn_str.c
|
||||
../../../src/obidmscolumn_str.h
|
||||
|
@ -1,9 +1,7 @@
|
||||
../../../src/obidmscolumn_float.c
|
||||
../../../src/obidmscolumn_float.h
|
||||
../../../src/char_str_indexer.h
|
||||
../../../src/char_str_indexer.c
|
||||
../../../src/bloom.h
|
||||
../../../src/bloom.c
|
||||
../../../src/char_str_indexer.h
|
||||
../../../src/char_str_indexer.c
|
||||
../../../src/crc64.h
|
||||
../../../src/crc64.c
|
||||
../../../src/dna_seq_indexer.h
|
||||
@ -39,3 +37,15 @@
|
||||
../../../src/obiview.c
|
||||
../../../src/utils.h
|
||||
../../../src/utils.c
|
||||
../../../src/obidmscolumn_bool.c
|
||||
../../../src/obidmscolumn_bool.h
|
||||
../../../src/obidmscolumn_char.c
|
||||
../../../src/obidmscolumn_char.h
|
||||
../../../src/obidmscolumn_float.c
|
||||
../../../src/obidmscolumn_float.h
|
||||
../../../src/obidmscolumn_int.c
|
||||
../../../src/obidmscolumn_int.h
|
||||
../../../src/obidmscolumn_seq.c
|
||||
../../../src/obidmscolumn_seq.h
|
||||
../../../src/obidmscolumn_str.c
|
||||
../../../src/obidmscolumn_str.h
|
||||
|
@ -1,9 +1,7 @@
|
||||
../../../src/obidmscolumn_int.c
|
||||
../../../src/obidmscolumn_int.h
|
||||
../../../src/char_str_indexer.h
|
||||
../../../src/char_str_indexer.c
|
||||
../../../src/bloom.h
|
||||
../../../src/bloom.c
|
||||
../../../src/char_str_indexer.h
|
||||
../../../src/char_str_indexer.c
|
||||
../../../src/crc64.h
|
||||
../../../src/crc64.c
|
||||
../../../src/dna_seq_indexer.h
|
||||
@ -39,3 +37,15 @@
|
||||
../../../src/obiview.c
|
||||
../../../src/utils.h
|
||||
../../../src/utils.c
|
||||
../../../src/obidmscolumn_bool.c
|
||||
../../../src/obidmscolumn_bool.h
|
||||
../../../src/obidmscolumn_char.c
|
||||
../../../src/obidmscolumn_char.h
|
||||
../../../src/obidmscolumn_float.c
|
||||
../../../src/obidmscolumn_float.h
|
||||
../../../src/obidmscolumn_int.c
|
||||
../../../src/obidmscolumn_int.h
|
||||
../../../src/obidmscolumn_seq.c
|
||||
../../../src/obidmscolumn_seq.h
|
||||
../../../src/obidmscolumn_str.c
|
||||
../../../src/obidmscolumn_str.h
|
||||
|
@ -1,5 +1,3 @@
|
||||
../../../src/obidmscolumn_seq.c
|
||||
../../../src/obidmscolumn_seq.h
|
||||
../../../src/bloom.h
|
||||
../../../src/bloom.c
|
||||
../../../src/char_str_indexer.h
|
||||
@ -39,3 +37,15 @@
|
||||
../../../src/obiview.c
|
||||
../../../src/utils.h
|
||||
../../../src/utils.c
|
||||
../../../src/obidmscolumn_bool.c
|
||||
../../../src/obidmscolumn_bool.h
|
||||
../../../src/obidmscolumn_char.c
|
||||
../../../src/obidmscolumn_char.h
|
||||
../../../src/obidmscolumn_float.c
|
||||
../../../src/obidmscolumn_float.h
|
||||
../../../src/obidmscolumn_int.c
|
||||
../../../src/obidmscolumn_int.h
|
||||
../../../src/obidmscolumn_seq.c
|
||||
../../../src/obidmscolumn_seq.h
|
||||
../../../src/obidmscolumn_str.c
|
||||
../../../src/obidmscolumn_str.h
|
||||
|
@ -1,5 +1,3 @@
|
||||
../../../src/obidmscolumn_str.c
|
||||
../../../src/obidmscolumn_str.h
|
||||
../../../src/bloom.h
|
||||
../../../src/bloom.c
|
||||
../../../src/char_str_indexer.h
|
||||
@ -39,3 +37,15 @@
|
||||
../../../src/obiview.c
|
||||
../../../src/utils.h
|
||||
../../../src/utils.c
|
||||
../../../src/obidmscolumn_bool.c
|
||||
../../../src/obidmscolumn_bool.h
|
||||
../../../src/obidmscolumn_char.c
|
||||
../../../src/obidmscolumn_char.h
|
||||
../../../src/obidmscolumn_float.c
|
||||
../../../src/obidmscolumn_float.h
|
||||
../../../src/obidmscolumn_int.c
|
||||
../../../src/obidmscolumn_int.h
|
||||
../../../src/obidmscolumn_seq.c
|
||||
../../../src/obidmscolumn_seq.h
|
||||
../../../src/obidmscolumn_str.c
|
||||
../../../src/obidmscolumn_str.h
|
||||
|
@ -37,3 +37,15 @@
|
||||
../../../src/obiview.c
|
||||
../../../src/utils.h
|
||||
../../../src/utils.c
|
||||
../../../src/obidmscolumn_bool.c
|
||||
../../../src/obidmscolumn_bool.h
|
||||
../../../src/obidmscolumn_char.c
|
||||
../../../src/obidmscolumn_char.h
|
||||
../../../src/obidmscolumn_float.c
|
||||
../../../src/obidmscolumn_float.h
|
||||
../../../src/obidmscolumn_int.c
|
||||
../../../src/obidmscolumn_int.h
|
||||
../../../src/obidmscolumn_seq.c
|
||||
../../../src/obidmscolumn_seq.h
|
||||
../../../src/obidmscolumn_str.c
|
||||
../../../src/obidmscolumn_str.h
|
||||
|
@ -37,3 +37,15 @@
|
||||
../../../src/obiview.c
|
||||
../../../src/utils.h
|
||||
../../../src/utils.c
|
||||
../../../src/obidmscolumn_bool.c
|
||||
../../../src/obidmscolumn_bool.h
|
||||
../../../src/obidmscolumn_char.c
|
||||
../../../src/obidmscolumn_char.h
|
||||
../../../src/obidmscolumn_float.c
|
||||
../../../src/obidmscolumn_float.h
|
||||
../../../src/obidmscolumn_int.c
|
||||
../../../src/obidmscolumn_int.h
|
||||
../../../src/obidmscolumn_seq.c
|
||||
../../../src/obidmscolumn_seq.h
|
||||
../../../src/obidmscolumn_str.c
|
||||
../../../src/obidmscolumn_str.h
|
||||
|
51
python/obitools3/obigrep.py
Normal file
51
python/obitools3/obigrep.py
Normal file
@ -0,0 +1,51 @@
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
from obitools3.obidms._obidms import OBIDMS
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
parser = argparse.ArgumentParser(description='Pseudo obigrep.')
|
||||
|
||||
parser.add_argument('-V', '--view', dest='view', type=str,
|
||||
help='Name of the view that should be considered')
|
||||
|
||||
parser.add_argument('-N', '--new_view', dest='new_view', type=str,
|
||||
help='Name of the new view that should be created')
|
||||
|
||||
# parser.add_argument('-k', '--key', dest='key', type=str,
|
||||
# help='Name of the key that should be considered')
|
||||
#
|
||||
# parser.add_argument('-c', '--comp', dest='comparison', type=int,
|
||||
# help='Comparison to be made: -1:< ; 0:== ; 1:>')
|
||||
#
|
||||
# parser.add_argument('-v', '--value', dest='value', type=object,
|
||||
# help='Value to be compared')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
d = OBIDMS('tdms')
|
||||
|
||||
#condition = 1
|
||||
line_selec = []
|
||||
|
||||
v = d.open_view(args.view)
|
||||
|
||||
i = 0
|
||||
for l in v :
|
||||
if l['score'] > 350 :
|
||||
line_selec.append(i)
|
||||
i+=1
|
||||
|
||||
new_v = d.new_view(args.new_view, view_to_clone=v, line_selection=line_selec, view_type="NUC_SEQS_VIEW", comments="obigrep "+args.view+" to "+args.new_view) #args.key+" "+str(args.comparison)+" "+str(args.value)+" "+)
|
||||
|
||||
print("\n")
|
||||
print(new_v.__repr__())
|
||||
|
||||
v.save_and_close()
|
||||
new_v.save_and_close()
|
||||
|
||||
d.close()
|
||||
|
||||
print("\nDone.")
|
||||
|
43
python/obitools3/obihead.py
Normal file
43
python/obitools3/obihead.py
Normal file
@ -0,0 +1,43 @@
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
from obitools3.obidms._obidms import OBIDMS
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
parser = argparse.ArgumentParser(description='Pseudo obihead.')
|
||||
|
||||
parser.add_argument('-V', '--view', dest='view', type=str,
|
||||
help='Name of the view that should be considered')
|
||||
|
||||
parser.add_argument('-N', '--new_view', dest='new_view', type=str,
|
||||
help='Name of the new view that should be created')
|
||||
|
||||
parser.add_argument('-n', '--nb', dest='nb_lines', type=int,
|
||||
help='Number of lines that should be taken')
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
d = OBIDMS('tdms')
|
||||
|
||||
#condition = 1
|
||||
line_selec = []
|
||||
|
||||
v = d.open_view(args.view)
|
||||
|
||||
for i in range(0, args.nb_lines) :
|
||||
line_selec.append(i)
|
||||
|
||||
new_v = d.new_view(args.new_view, view_to_clone=v, line_selection=line_selec, view_type="NUC_SEQS_VIEW", comments="obihead "+str(args.nb_lines)+", "+args.view+" to "+args.new_view) #args.key+" "+str(args.comparison)+" "+str(args.value)+" "+)
|
||||
|
||||
print("\n")
|
||||
print(new_v.__repr__())
|
||||
|
||||
v.save_and_close()
|
||||
new_v.save_and_close()
|
||||
|
||||
d.close()
|
||||
|
||||
print("\nDone.")
|
||||
|
14
src/bloom.c
14
src/bloom.c
@ -26,9 +26,9 @@
|
||||
#define MAKESTRING(n) STRING(n)
|
||||
#define STRING(n) #n
|
||||
|
||||
#ifdef __linux__
|
||||
unsigned detect_bucket_size(unsigned fallback_size);
|
||||
#endif
|
||||
//#ifdef __linux__ // TODO commented because triggers error on luke21
|
||||
//unsigned detect_bucket_size(unsigned fallback_size);
|
||||
//#endif
|
||||
|
||||
|
||||
static int test_bit_set_bit(unsigned char * buf, unsigned int x, int set_bit)
|
||||
@ -89,11 +89,11 @@ static void setup_buckets(struct bloom * bloom, unsigned int cache_size)
|
||||
// either compute it or use built-in default
|
||||
|
||||
if (cache_size == 0) {
|
||||
#ifdef __linux__
|
||||
cache_size = detect_bucket_size(BLOOM_BUCKET_SIZE_FALLBACK);
|
||||
#else
|
||||
//#ifdef __linux__ // TODO commented because triggers error on luke21
|
||||
// cache_size = detect_bucket_size(BLOOM_BUCKET_SIZE_FALLBACK);
|
||||
//#else
|
||||
cache_size = BLOOM_BUCKET_SIZE_FALLBACK;
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
bloom->buckets = (bloom->bytes / cache_size);
|
||||
|
@ -587,16 +587,19 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
||||
}
|
||||
|
||||
// Build the indexer name if needed
|
||||
if (((data_type == OBI_STR) || (data_type == OBI_SEQ)) && (strcmp(indexer_name, "") == 0))
|
||||
if ((data_type == OBI_STR) || (data_type == OBI_SEQ))
|
||||
{
|
||||
final_indexer_name = obi_build_indexer_name(column_name, version_number);
|
||||
if (final_indexer_name == NULL)
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
final_indexer_name = (char*) malloc((strlen(indexer_name)+1)*sizeof(char));
|
||||
strcpy(final_indexer_name, indexer_name);
|
||||
if (strcmp(indexer_name, "") == 0)
|
||||
{
|
||||
final_indexer_name = obi_build_indexer_name(column_name, version_number);
|
||||
if (final_indexer_name == NULL)
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
final_indexer_name = (char*) malloc((strlen(indexer_name)+1)*sizeof(char));
|
||||
strcpy(final_indexer_name, indexer_name);
|
||||
}
|
||||
}
|
||||
|
||||
returned_data_type = data_type;
|
||||
|
Reference in New Issue
Block a user