Exemple #1
0
def main():

    args = parser.parse_args()
    datas = []

    for i in args.file:
        data = fuse.ListWindows()
        data.load(i, False, verbose = args.verbose)
        datas.append(data)
    
    data1 = datas[0]
    data2 = datas[1]

    compare(data1, data2, args)
Exemple #2
0
def process_files(args):
    outfile = open(args.output, 'w')

    used_names = {}
    current_file = 0

    if len(args.metadata) != len(args.file):
        # Not of the same length: ignore metadata
        args.metadata = ['' for i in range(len(args.file))]

    for vidjil in args.file:
        try:
            data = fuse.ListWindows()
            data.load(vidjil, "")
        except Exception:
            print "** Warning ** file %s could not be loaded" % vidjil
        else:
            write_fuse_to_fasta(data, outfile, used_names, vidjil, args, args.metadata[current_file])
        current_file += 1

    outfile.close()
Exemple #3
0
def main():

    print('%%%%', ' '.join(sys.argv))
    args = parser.parse_args()

    for i in args.file:
        data = fuse.ListWindows()
        data.load(i, False, verbose=args.verbose)

        if data.d['samples'].d['number'] < args.sample + 1:
            print("! no sample %d in %s'" % (args.sample, i))
            continue
        sample = args.sample

        m = regex_filename.match(i)
        i_short = m.group(1) if m else i

        if args.analysis:
            # TODO: hardcoded for output of links.py
            # should be more flexible
            ii = 'data.vidjil/' + 'pat-' + i_short + '.analysis'
            data_analysis = analysis.Analysis(data)
            data_analysis.load(ii)
            data_analysis.cluster_stats()

            if str(data_analysis.d['samples']['run_timestamp']) == str(
                    data.d['samples'].d['run_timestamp']):
                print("%% timestamps: OK")
            else:
                print("%% timestamps: XXX", i,
                      data.d['samples'].d['run_timestamp'], "instead of",
                      data_analysis.d['samples']['run_timestamp'])
        else:
            data_analysis = None

        print('%s %% %s' % (i_short, i))
        print('%%  ', data.d["reads"])
        segmented_reads = data.d['reads'].d['segmented'][sample]

        out = []
        for w in data:
            if data_analysis:
                tag = data_analysis.tag_of_clone(w)
                if not tag:
                    continue
            else:
                tag = ''
            reads = w.d['reads'][sample]
            ratio = float(reads) / segmented_reads
            if reads >= args.min and ratio >= args.min_ratio:
                out += [(-reads, w, tag)]
        for bla, w, tag in sorted(out[:args.top]):
            segmented_reads_germline = data.d['reads'].d['germline'][
                w.d['germline']][sample]
            print(
                w.latex(base_germline=segmented_reads_germline,
                        base=segmented_reads,
                        tag=tag))
        if not out:
            print(r'\\')

        if data_analysis:
            for c in data_analysis.missing_clones(data):
                print('%% !! %s' % c)

        print(r'  \hline')