コード例 #1
0
def combine_express(samples, combined):
    """Combine tpm, effective counts and fpkm from express results"""
    if not combined:
        return None
    to_combine = [
        dd.get_express_counts(x) for x in dd.sample_data_iterator(samples)
        if dd.get_express_counts(x)
    ]
    gtf_file = dd.get_gtf_file(samples[0][0])
    isoform_to_gene_file = os.path.join(os.path.dirname(combined),
                                        "isoform_to_gene.txt")
    isoform_to_gene_file = express.isoform_to_gene_name(
        gtf_file, isoform_to_gene_file,
        dd.sample_data_iterator(samples).next())
    if len(to_combine) > 0:
        eff_counts_combined_file = os.path.splitext(
            combined)[0] + ".isoform.express_counts"
        eff_counts_combined = count.combine_count_files(
            to_combine, eff_counts_combined_file, ext=".counts")
        to_combine = [
            dd.get_express_tpm(x) for x in dd.sample_data_iterator(samples)
            if dd.get_express_tpm(x)
        ]
        tpm_counts_combined_file = os.path.splitext(
            combined)[0] + ".isoform.express_tpm"
        tpm_counts_combined = count.combine_count_files(
            to_combine, tpm_counts_combined_file)
        to_combine = [
            dd.get_express_fpkm(x) for x in dd.sample_data_iterator(samples)
            if dd.get_express_fpkm(x)
        ]
        fpkm_counts_combined_file = os.path.splitext(
            combined)[0] + ".isoform.express_fpkm"
        fpkm_counts_combined = count.combine_count_files(
            to_combine, fpkm_counts_combined_file, ext=".fpkm")
        return {
            'counts': eff_counts_combined,
            'tpm': tpm_counts_combined,
            'fpkm': fpkm_counts_combined,
            'isoform_to_gene': isoform_to_gene_file
        }
    return {}
コード例 #2
0
ファイル: rnaseq.py プロジェクト: dh10/bcbio-nextgen
def combine_express(samples, combined):
    """Combine tpm, effective counts and fpkm from express results"""
    to_combine = [dd.get_express_counts(x) for x in
                  dd.sample_data_iterator(samples) if dd.get_express_counts(x)]
    gtf_file = dd.get_gtf_file(samples[0][0])
    isoform_to_gene_file = os.path.join(os.path.dirname(combined), "isoform_to_gene.txt")
    isoform_to_gene_file = express.isoform_to_gene_name(gtf_file, isoform_to_gene_file)
    if len(to_combine) > 0:
        eff_counts_combined_file = os.path.splitext(combined)[0] + ".isoform.express_counts"
        eff_counts_combined = count.combine_count_files(to_combine, eff_counts_combined_file)
        to_combine = [dd.get_express_tpm(x) for x in
                      dd.sample_data_iterator(samples) if dd.get_express_tpm(x)]
        tpm_counts_combined_file = os.path.splitext(combined)[0] + ".isoform.express_tpm"
        tpm_counts_combined = count.combine_count_files(to_combine, tpm_counts_combined_file)
        to_combine = [dd.get_express_fpkm(x) for x in dd.sample_data_iterator(samples)
                      if dd.get_express_fpkm(x)]
        fpkm_counts_combined_file = os.path.splitext(combined)[0] + ".isoform.express_fpkm"
        fpkm_counts_combined = count.combine_count_files(to_combine, fpkm_counts_combined_file)
        return {'counts': eff_counts_combined, 'tpm': tpm_counts_combined,
                'fpkm': fpkm_counts_combined, 'isoform_to_gene': isoform_to_gene_file}
    return {}