Exemplo n.º 1
0
def action(args):
    if not os.path.exists(args.assembly):
        raise ValueError("No such file: %s" % (args.assembly,))
    for f in args.fastas:
        if not os.path.exists(f):
            raise ValueError("No such file: %s" % (f,))

    assembly = seqlab.assembly.deserialize(args.assembly)
    for f in args.fastas:
        with open(f):
            for seq in Bio.SeqIO.parse(f, "fasta"):
                assembly.add_sequence(
                    seq.description, seq.seq.tostring(), align_to=args.align_to if not args.no_alignment else None
                )
    assembly.serialize(args.output if args.output else args.assembly)
    return 0
Exemplo n.º 2
0
def action(args):
    if not os.path.exists(args.assembly):
        raise ValueError("No such file: %s" % (args.assembly, ))
    for f in args.fastas:
        if not os.path.exists(f):
            raise ValueError("No such file: %s" % (f, ))

    assembly = seqlab.assembly.deserialize(args.assembly)
    for f in args.fastas:
        with open(f):
            for seq in Bio.SeqIO.parse(f, 'fasta'):
                assembly.add_sequence(
                    seq.description,
                    seq.seq.tostring(),
                    align_to=args.align_to if not args.no_alignment else None)
    assembly.serialize(args.output if args.output else args.assembly)
    return 0
Exemplo n.º 3
0
def action(args):
    if not os.path.exists(args.first_ab1):
        raise ValueError("No such file: %s" % (args.first_ab1,))
    if not os.path.exists(args.second_ab1):
        raise ValueError("No such file: %s" % (args.second_ab1,))
    if args.metadata and not os.path.exists(args.metadata):
        raise ValueError("No such file: %s" % (args.metadata))
    for f in args.additional_sequences:
        if not os.path.exists(f):
            raise ValueError("No such file: %s" % (f,))

    assembly = seqlab.contig.ab1toassembly(args.first_ab1, args.second_ab1)
    if args.metadata:
        with open(args.metadata) as h:
            assembly.metadata = json.load(h)
    for f in args.additional_sequences:
        with open(f):
            for seq in Bio.SeqIO.parse(f, 'fasta'):
                assembly.add_sequence(seq.description, seq.seq.tostring(),
                                      align_to='contig')
    assembly.serialize(args.output)
    return 0