Example #1
0
def extract_file(input_file):
    try:
        (raw_data, raw_label, raw_start,
         raw_length) = labelop.get_label_raw(input_file, FLAGS.basecall_group,
                                             FLAGS.basecall_subgroup)
    except IOError:
        return False, (None, None)
    except:
        return False, (None, None)

    raw_data_array = []
    for index, start in enumerate(raw_start):
        raw_data_array.append(
            [start, start + raw_length[index],
             str(raw_label['base'][index])])
    if FLAGS.mode == 'rna':
        raw_data = raw_data[::-1]
    return True, (raw_data, np.array(raw_data_array, dtype='S5'))
Example #2
0
def extract_file(input_file):
    try:
        (raw_data, raw_label, raw_start,
         raw_length) = labelop.get_label_raw(input_file, FLAGS.basecall_group,
                                             FLAGS.basecall_subgroup)
    except Exception as e:
        print(str(e))
        return False, (None, None)
    raw_data_array = []
    for index, start in enumerate(raw_start):
        #        if raw_length[index]==0:
        #            print("input_file:" + input_file)
        #            raise ValueError("catch a label with length 0")
        raw_data_array.append(
            [start, start + raw_length[index],
             str(raw_label['base'][index])])
    if FLAGS.mode == 'rna':
        raw_data = raw_data[::-1]
    return True, (raw_data, np.array(raw_data_array, dtype='S8'))
Example #3
0
def extract_file(input_file):
    try:
        raw_info,channel_info = labelop.get_label_raw(
            input_file, FLAGS.basecall_group,
            FLAGS.basecall_subgroup)
        raw_data, raw_label, raw_start, raw_length = raw_info
        offset,range_s,digitisation = channel_info
    except Exception as e:
        return str(e), (None, None) ,(None, None,None)
    raw_data_array = []
    for index, start in enumerate(raw_start):
#        if raw_length[index]==0:
#            print("input_file:" + input_file)
#            raise ValueError("catch a label with length 0")
        raw_data_array.append(
            [start, start + raw_length[index], raw_label['base'][index].decode()])
    if FLAGS.mode=='rna':
        raw_data = raw_data[::-1]
    if len(raw_data_array)>FLAGS.min_bps:
        return SUCCEED_TAG, (raw_data, raw_data_array) , (offset,digitisation,range_s)
    else:
        return "Read has too few nucleotides output", (None, None) ,(None, None,None)