Пример #1
0
import os
import re
import yaml
import glob
import xml.parsers.expat
from uuid import uuid4
import json
import numpy as np
import csv
import collections
import xml.etree.cElementTree as ET
from bs4 import BeautifulSoup
import datetime

from scilifelab.log import minimal_logger
LOG = minimal_logger("bcbio")

from bcbio.broad.metrics import PicardMetricsParser
from bcbio.pipeline.qcsummary import FastQCParser


class MetricsParser():
    """Basic class for parsing metrics"""
    def __init__(self, log=None):
        self.log = LOG
        if log:
            self.log = log

    def parse_bc_metrics(self, in_handle):
        data = {}
        while 1:
Пример #2
0
"""Database backend for connecting to statusdb"""
import re
import collections
from itertools import izip
from scilifelab.db import Couch
from scilifelab.utils.timestamp import utc_time
from scilifelab.utils.misc import query_yes_no, merge
from scilifelab.db.statusDB_utils import save_couchdb_obj
from uuid import uuid4
from scilifelab.log import minimal_logger

LOG = minimal_logger(__name__)

# Statusdb views essential for pm qc functionality
# FIXME: import ViewDefinition from couchdb.design and create views if not present
VIEWS = {
    'samples': {
        'names': {
            'name':
            '''function(doc) {if (!doc["name"].match(/_[0-9]+$/)) {emit(doc["name"], null);}}''',
            'name_fc':
            '''function(doc) {if (!doc["name"].match(/_[0-9]+$/)) {emit(doc["name"], doc["flowcell"]);}}''',
            'name_fc_proj':
            '''var list; function(doc) {if (!doc["name"].match(/_[0-9]+$/)) {list = [doc["flowcell"], doc["sample_prj"]];emit(doc["name"], list);}}''',
            'name_proj':
            '''function(doc) {if (!doc["name"].match(/_[0-9]+$/)) {emit(doc["name"], doc["sample_prj"]);}}''',
            'id_to_name': '''function(doc) {emit(doc["_id"], doc["name"]);}''',
        }
    },
    'flowcells': {
        'names': {
Пример #3
0
"""Database backend for connecting to statusdb"""
import re
import collections
from itertools import izip
from scilifelab.db import Couch
from scilifelab.utils.timestamp import utc_time
from scilifelab.utils.misc import query_yes_no, merge
from scilifelab.db.statusDB_utils import save_couchdb_obj
from uuid import uuid4
from scilifelab.log import minimal_logger

LOG = minimal_logger(__name__)

# Statusdb views essential for pm qc functionality
# FIXME: import ViewDefinition from couchdb.design and create views if not present
VIEWS = {'samples' : {'names': {'name' : '''function(doc) {if (!doc["name"].match(/_[0-9]+$/)) {emit(doc["name"], null);}}''',
                                'name_fc' : '''function(doc) {if (!doc["name"].match(/_[0-9]+$/)) {emit(doc["name"], doc["flowcell"]);}}''',
                                'name_fc_proj' : '''var list; function(doc) {if (!doc["name"].match(/_[0-9]+$/)) {list = [doc["flowcell"], doc["sample_prj"]];emit(doc["name"], list);}}''',
                                'name_proj' : '''function(doc) {if (!doc["name"].match(/_[0-9]+$/)) {emit(doc["name"], doc["sample_prj"]);}}''',
                                'id_to_name' : '''function(doc) {emit(doc["_id"], doc["name"]);}''',
                                }},
         'flowcells' : {'names' : {'name' : '''function(doc) {emit(doc["name"], null);}''',
                                   'id_to_name' : '''function(doc) {emit(doc["_id"], doc["name"]);}''',
                                   'Barcode_lane_stat' : '''function(doc) {emit(doc["name"],doc["illumina"]["Demultiplex_Stats"]["Barcode_lane_statistics"] );}'''}},
         'projects' : {'project' : {'project_id' : '''function(doc) {emit(doc.project_id, doc._id)}''',
                                    'project_name' : '''function(doc) {emit(doc.project_name, doc._id)}'''},
                       'names' : {'id_to_name' : '''function(doc) {emit(doc["_id"], doc["project_name"]);}''',
                                  'name' : '''function(doc) {emit(doc["project_name"], null);}'''}},
         }

# Regular expressions for general use
Пример #4
0
 def __init__(self, **kwargs):
     self.con = None
     self.log = minimal_logger(repr(self))
     self.connect(**kwargs)
Пример #5
0
 def __init__(self, **kwargs):
     self.con = None
     self.log = minimal_logger(repr(self))
     self.connect(**kwargs)
Пример #6
0
#!/usr/bin/env python

import couchdb
import json
import argparse
import logbook
import sys
import os
import ConfigParser

from scilifelab.log import minimal_logger
from couchdb import PreconditionFailed

#Set up logging
l = minimal_logger("CouchDB replicator")

class Config(object):
    """Singleton class that holds the confiuration for the CouchDB replicator.
    """

    _instance = None

    def __new__(self, *args, **kwargs):
        if not self._instance:
            self._instance = super(Config, self).__new__(self, *args, **kwargs)
        return self._instance


    def __init__(self, config_file=None):
        config = ConfigParser.SafeConfigParser()
        try:
Пример #7
0
import os
import re
import yaml
import glob
import xml.parsers.expat
from uuid import uuid4
import json
import numpy as np
import csv
import collections
import xml.etree.cElementTree as ET
from bs4 import BeautifulSoup
import datetime

from scilifelab.log import minimal_logger
LOG = minimal_logger("bcbio")

from bcbio.broad.metrics import PicardMetricsParser
from bcbio.pipeline.qcsummary import FastQCParser

class MetricsParser():
    """Basic class for parsing metrics"""
    def __init__(self, log=None):
        self.log = LOG
        if log:
            self.log = log

    def parse_bc_metrics(self, in_handle):
        data = {}
        while 1:
            line = in_handle.readline()