Exemplo n.º 1
0
###################################################
###################################################
###################################################
# Pipeline configuration
###################################################
from cgatcore import pipeline as P
P.get_parameters([
    "%s/pipeline.yml" % os.path.splitext(__file__)[0], "../pipeline.yml",
    "pipeline.yml"
],
                 defaults={'annotations_dir': ""})

PARAMS = P.PARAMS

PARAMS_ANNOTATIONS = P.peek_parameters(PARAMS["annotations_dir"], "genesets")

###################################################################
###################################################################
###################################################################
# Helper functions mapping tracks to conditions, etc
###################################################################
# load all tracks - exclude input/control tracks
Sample = tracks.Sample

TRACKS = tracks.Tracks(Sample).loadFromDirectory(glob.glob("*.bed.gz"),
                                                 "(\S+).bed.gz")

TRACKS_BEDFILES = ["%s.bed.gz" % x for x in TRACKS]

Exemplo n.º 2
0
###################################################################
###################################################################
# Load options and annotations
###################################################################

# load options from the config file
PARAMS = P.get_parameters(
    ["%s/pipeline.yml" % os.path.splitext(__file__)[0],
     "../pipeline.yml",
     "pipeline.yml"])

# add configuration values from associated pipelines
PARAMS = P.PARAMS
PARAMS.update(P.peek_parameters(
    PARAMS["annotations_dir"],
    "genesets",
    prefix="annotations_",
    update_interface=True,
    restrict_interface=True))  # add config values from associated pipelines

# The DEXSeq R directory contains important python helper functions
PYTHONSCRIPTSDIR = R('''system.file("python_scripts", package="DEXSeq")''')[0]


###################################################################
###################################################################
###################################################################
# Utility functions
###################################################################

def connect():
    '''Connect to database (sqlite by default)
Exemplo n.º 3
0
###################################################################
# Load options and annotations
###################################################################

# load options from the config file
PARAMS = P.get_parameters([
    "%s/pipeline.yml" % os.path.splitext(__file__)[0], "../pipeline.yml",
    "pipeline.yml"
])

# add configuration values from associated pipelines
PARAMS = P.PARAMS
PARAMS.update(
    P.peek_parameters(PARAMS["annotations_dir"],
                      "genesets",
                      prefix="annotations_",
                      update_interface=True,
                      restrict_interface=True)
)  # add config values from associated pipelines

# The DEXSeq R directory contains important python helper functions
PYTHONSCRIPTSDIR = R('''system.file("python_scripts", package="DEXSeq")''')[0]

###################################################################
###################################################################
###################################################################
# Utility functions
###################################################################


def connect():
Exemplo n.º 4
0
# load options from the config file
PARAMS = P.get_parameters([
    "%s/pipeline.yml" % os.path.splitext(__file__)[0], "../pipeline.yml",
    "pipeline.yml"
])

# add configuration values from associated pipelines
#
# 1. pipeline_genesets: any parameters will be added with the
#    prefix "annotations_". The interface will be updated with
#    "annotations_dir" to point to the absolute path names.
PARAMS.update(
    P.peek_parameters(PARAMS["annotations_dir"],
                      "pipeline_genesets.py",
                      "genesets",
                      on_error_raise=__name__ == "__main__",
                      prefix="annotations_",
                      update_interface=True))


# ---------------------------------------------------
# Specific pipeline tasks
@transform(("pipeline.yml", ), regex("(.*)\.(.*)"), r"\1.counts")
def count_words(infile, outfile):
    '''count the number of words in the pipeline configuration files.'''

    # the command line statement we want to execute
    statement = '''awk 'BEGIN { printf("word\\tfreq\\n"); } 
    {for (i = 1; i <= NF; i++) freq[$i]++}
    END { for (word in freq) printf "%%s\\t%%d\\n", word, freq[word] }'
    < %(infile)s > %(outfile)s'''