Ejemplo n.º 1
0
            os.path.dirname(__file__), out_name,
            '{}/conditions.csv'.format(base_path))
        os.system(cmd)
    else:
        print 'Generating sample correlation heatmap...'
        cmd = 'Rscript {}/sample_correlation.R {}'.format(
            os.path.dirname(__file__), out_name)
        os.system(cmd)
        print 'DONE!\n'
        print 'Generating PCA...'
        cmd = 'Rscript {}/pca.R {}'.format(os.path.dirname(__file__), out_name)
        os.system(cmd)


if __name__ == '__main__':
    f_utils.check_for_input(sys.argv, usage)
    parser = argparse.ArgumentParser(
        description='Calculates the RPMM across samples')
    parser.add_argument('sp',
                        action='store',
                        help='Species used in this study')
    parser.add_argument('outPath',
                        action='store',
                        help='Path to where the output file will be located')
    parser.add_argument('base_path',
                        action='store',
                        help='Path to where the output file will be located')
    parser.add_argument(
        'samples',
        action='store',
        nargs='+',
Ejemplo n.º 2
0
def main():
    f_utils.check_for_input(sys.argv, usage)
    mapping_stats(sys.argv[1])
    length_distribution(sys.argv[1])
    RPMMandRPMMM(sys.argv[1], sys.argv[2])
    sample_correlation('RPMM_mirs_over_100.csv')
def write_mapping_file(out_di, out_dir, line_head_li):
    """
    Writes the output dictionary to a file, called MappingInfoTable.csv
    """
    with open("{}/Mapping_Statistics.csv".format(out_dir), "w") as f:
        f.write("Sample_name,{}\n".format(",".join(sorted(out_di))))
        for item in line_head_li:
            f.write("{}".format(item[1]))
            for sample in sorted(out_di):
                f.write(",{}".format(out_di[sample][item[0]]))
            f.write("\n")


def main(outPath, samples):
    samples = f_utils.set_path_to_files_glob(samples, "stats")
    out_di = mapping_stats_dict(samples)
    out_di = calculate_additional_stats(out_di)
    line_head_li = output_line_headers()
    write_mapping_file(out_di, outPath, line_head_li)


if __name__ == "__main__":
    f_utils.check_for_input(sys.argv, usage)
    parser = argparse.ArgumentParser(description=usage)
    parser.add_argument("outPath", action="store", help="Path to where the output file will be located")
    parser.add_argument(
        "samples", nargs="+", action="store", help="Path to where the sample output folders are located"
    )
    arg = parser.parse_args()
    main(arg.outPath, arg.samples)
Ejemplo n.º 4
0
def main():
    f_utils.check_for_input(sys.argv, usage)
    mapping_stats(sys.argv[1])
    length_distribution(sys.argv[1])
    RPMMandRPMMM(sys.argv[1], sys.argv[2])
    sample_correlation('RPMM_mirs_over_100.csv')