def deploy_track_files(in_files, out_header): """Copy UCSC tracks to public url""" remote = cfg.get('visualization', 'remote_ssh_dir') remote_host = remote.split(':')[0] remote_dir = remote.split(':')[1] for in_track in in_files: sys_call('ssh %s mkdir -p %s' % (remote_host, remote_dir)) sys_call('scp %s %s' % (in_track, remote)) touch(out_header)
def deploy_track_files(in_files, out_header): """Copy UCSC tracks to public url""" remote = cfg.get("visualization", "remote_ssh_dir") remote_host = remote.split(":")[0] remote_dir = remote.split(":")[1] for in_track in in_files: sys_call("ssh %s mkdir -p %s" % (remote_host, remote_dir)) sys_call("scp %s %s" % (in_track, remote)) touch(out_header)
def gene_ontology(in_peaks, out_files): """Calculate the significance of the peaks near genes using BioConductor""" out_genes, out_go, out_raw = out_files cmd = """echo ' peaks = read.table("%s", header=FALSE, sep="\t"); peaks = data.frame(chr=as.factor(peaks[,1]), start=as.numeric(peaks[,2]), end=as.numeric(peaks[,3])); peaks = RangedData(IRanges(start=peaks[,2], end=peaks[,3]), space=peaks[,1]) source("http://bioconductor.org/biocLite.R"); biocLite("ChIPpeakAnno"); library(ChIPpeakAnno); mart<-useMart(biomart="ensembl",dataset="%s"); tss = getAnnotation(mart, featureType="TSS"); annopeaks = annotatePeakInBatch(peaks[, ], AnnotationData=tss); write.table(annopeaks, file="%s", sep="\t"); ' | R --vanilla --slave > %s""" % (in_peaks, cfg.get( 'DEFAULT', 'R_mart'), out_genes, out_go, out_raw) print cmd touch(out_raw)
def gene_ontology(in_peaks, out_files): """Calculate the significance of the peaks near genes using BioConductor""" out_genes, out_go, out_raw = out_files cmd = """echo ' peaks = read.table("%s", header=FALSE, sep="\t"); peaks = data.frame(chr=as.factor(peaks[,1]), start=as.numeric(peaks[,2]), end=as.numeric(peaks[,3])); peaks = RangedData(IRanges(start=peaks[,2], end=peaks[,3]), space=peaks[,1]) source("http://bioconductor.org/biocLite.R"); biocLite("ChIPpeakAnno"); library(ChIPpeakAnno); mart<-useMart(biomart="ensembl",dataset="%s"); tss = getAnnotation(mart, featureType="TSS"); annopeaks = annotatePeakInBatch(peaks[, ], AnnotationData=tss); write.table(annopeaks, file="%s", sep="\t"); ' | R --vanilla --slave > %s""" % (in_peaks, cfg.get('DEFAULT', 'R_mart'), out_genes, out_go, out_raw) print cmd touch(out_raw)
def all_complete(_, out_sentinel): """HTS workflow complete""" touch(out_sentinel)
def get_genome(_, out_genome_path, touch_file=True): 'download the worldbase genome' genome = worldbase(cfg.get('DEFAULT', 'worldbase_genome'), download=True) if touch_file: touch(out_genome_path) return genome