@active_if("assemblers" in PARAMS and "idba" in PARAMS["assemblers"])
@follows(mkdir("lengths.dir"))
@merge(glob.glob(os.path.join(
    PARAMS.get("results_resultsdir", ""),
    "idba.dir/*lengths.tsv")),
    "lengths.dir/idba_length_comparison.stats")
def IdbaLengthDistributionStats(infiles, outfile):
    l100 = [inf for inf in infiles if inf.find("100BP") != -1][0]
    l150 = [inf for inf in infiles if inf.find("150BP") != -1][0]
    l250 = [inf for inf in infiles if inf.find("250BP") != -1][0]

    R('''l100 <- read.csv("%s", stringsAsFactors = F, sep = "\t", header = T)''' %
      l100)
    R('''l150 <- read.csv("%s", stringsAsFactors = F, sep = "\t", header = T)''' %
      l150)
    R('''l250 <- read.csv("%s", stringsAsFactors = F, sep = "\t", header = T)''' %
      l250)
    # one sided test on 150 being less than 100 Alternative hypothesis
    R('''ks.100.150 <- ks.test(l100$length, l150$length, alternative = "greater")''')
    R('''ks.100.250 <- ks.test(l100$length, l250$length, alternative = "greater")''')
    R('''ks.150.250 <- ks.test(l150$length, l250$length, alternative = "greater")''')

    R('''pvals <- c(ks.100.150$p.value, ks.100.250$p.value, ks.150.250$p.value)''')
    R('''ds <- c(ks.100.150$statistic, ks.100.250$statistic, ks.150.250$statistic)''')

    R('''dat <- as.data.frame(cbind(pvals, ds))''')
    R('''colnames(dat) <- c("pvalue", "D+")''')
    R('''dat$track <- c("100-150", "100-250", "150-250")''')
    R('''write.table(dat, file = "%s", sep = "\t", row.names = F)''' % outfile)

###################################################
###################################################
###################################################
Converts an .rc windows resource source file into a python source file
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_metagenomebenchmark.py/IdbaLengthDistributionStats--crossover with--dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/site-packages/win32/lib/win32rcparser.py/GenerateFrozenResource