Example #1
0
import logging

from optparse import OptionParser
from itertools import groupby

from jcvi.formats.agp import AGP, TPF, get_phase
from jcvi.formats.base import BaseFile
from jcvi.formats.fasta import Fasta, SeqIO
from jcvi.formats.blast import BlastLine
from jcvi.formats.coords import Overlap_types
from jcvi.formats.base import must_open
from jcvi.utils.cbook import memoized
from jcvi.apps.entrez import fetch
from jcvi.apps.base import ActionDispatcher, debug, popen, mkdir, sh

debug()

GoodPct = 99
GoodOverlap = 500
GoodOverhang = 10000


class Overlap(object):
    def __init__(self, blastline, asize, bsize):
        b = blastline
        aid = b.query
        bid = b.subject

        self.aid = aid.split("|")[3] if aid.count("|") >= 3 else aid
        self.bid = bid.split("|")[3] if bid.count("|") >= 3 else bid
        self.asize = asize
Example #2
0
File: soap.py Project: rrane/jcvi
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

"""
Script to write and assist SOAPdenovo assembly.
"""

import os.path as op
import sys

from jcvi.formats.fastq import guessoffset, readlen
from jcvi.assembly.base import FastqNamings, Library, get_libs
from jcvi.apps.base import OptionParser, ActionDispatcher, debug, need_update, sh

debug()


class FillLine(object):
    def __init__(self, row):
        args = row.split()
        self.start = int(args[0])
        self.end = int(args[1])
        self.leftextend = int(args[2])
        self.rightextend = int(args[3])
        self.closed = int(args[4]) == 1
        self.extendlength = int(args[5])
        self.before = int(args[6])
        self.after = int(args[7])
        # Convert from unsigned to signed
        # <http://stackoverflow.com/questions/1375897/how-to-get-the-signed-integer-value-of-a-long-in-python>
        if self.after > 0 and (self.after & 0x80000000):
Example #3
0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-


import sys
import os.path as op
import logging

from optparse import OptionParser

from jcvi.formats.base import must_open
from jcvi.apps.base import ActionDispatcher, debug
debug()

default_template = """#!/usr/bin/env python
# -*- coding: UTF-8 -*-

\"\"\"

\"\"\"

import sys

from optparse import OptionParser

from jcvi.apps.base import ActionDispatcher, debug
debug()


def main():
Example #4
0
File: script.py Project: rrane/jcvi
#!/usr/bin/env python
# -*- coding: UTF-8 -*-


import sys
import logging

from jcvi.formats.base import write_file
from jcvi.apps.base import OptionParser, debug
debug()

default_template = """
\"\"\"

\"\"\"

import sys

from jcvi.apps.base import OptionParser, ActionDispatcher, debug
debug()


def main():

    actions = (
        ('app', ''),
            )
    p = ActionDispatcher(actions)
    p.dispatch(globals())

Example #5
0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys
import os.path as op
import logging

from optparse import OptionParser

from jcvi.formats.base import must_open
from jcvi.apps.base import ActionDispatcher, debug
debug()

default_template = """#!/usr/bin/env python
# -*- coding: UTF-8 -*-

\"\"\"

\"\"\"

import sys

from optparse import OptionParser

from jcvi.apps.base import ActionDispatcher, debug
debug()


def main():

    actions = (