예제 #1
0
def main():
    # Parse the command line inputs
    parser = argparse.ArgumentParser(description="map_reads")
    parser.add_argument("-settings",
                        dest="settings",
                        required=True,
                        help="settings.txt",
                        metavar="string")
    parser.add_argument("-samples",
                        dest="samples",
                        required=True,
                        help="1,2",
                        metavar="string")
    parser.add_argument("-cores",
                        dest="cores",
                        required=True,
                        help="# cores",
                        metavar="int")
    args = parser.parse_args()

    # Run the command
    samples = args.samples.split(',')
    settings = ga.load_settings(args.settings)
    cores = args.cores
    for s in samples:
        status = ga.map_reads(settings, s, cores)
    return status
def main():
    # Parse the command line inputs
    parser = argparse.ArgumentParser(description="transcription_profile")
    parser.add_argument("-settings",
                        dest="settings",
                        required=True,
                        help="settings.txt",
                        metavar="string")
    parser.add_argument("-samples",
                        dest="samples",
                        required=True,
                        help="1,2",
                        metavar="string")
    parser.add_argument("-chroms",
                        dest="chroms",
                        required=True,
                        help="1,2",
                        metavar="string")
    args = parser.parse_args()
    # Run the command
    samples = args.samples.split(',')
    chroms = args.chroms.split(',')
    settings = ga.load_settings(args.settings)
    for s in samples:
        ga.create_profiles(settings, s, chroms, scale=10e-5)
예제 #3
0
def main():
    # Parse the command line inputs
    parser = argparse.ArgumentParser(description="count_reads")
    parser.add_argument("-settings",
                        dest="settings",
                        required=True,
                        help="settings.txt",
                        metavar="string")
    parser.add_argument("-samples",
                        dest="samples",
                        required=True,
                        help="1,2",
                        metavar="string")
    parser.add_argument("-attribute",
                        dest="attribute",
                        required=False,
                        metavar="string",
                        default='name')
    parser.add_argument("-strand_opt",
                        dest="strand_opt",
                        required=False,
                        help="If stranded protocol was used",
                        metavar="string",
                        default='reverse')
    parser.add_argument("-cores",
                        dest="cores",
                        required=True,
                        help="# cores",
                        metavar="int")
    args = parser.parse_args()
    # Run the command
    cores = args.cores
    samples = args.samples.split(',')
    settings = ga.load_settings(args.settings)
    attribute = args.attribute
    s_opt = args.strand_opt
    for s in samples:
        features = ga.load_features(settings, s)
        status1 = ga.mapped_reads(settings, s, cores)
        status2 = ga.gene_lengths(settings, s)
        for f in features:
            status3 = ga.count_reads(settings,
                                     s,
                                     feature=f,
                                     attribute=attribute,
                                     strand_opt=s_opt)
            if status3 == 0:
                continue
            else:
                return "Count reads failed"
    return (status1 + status2)
예제 #4
0
def main():
    # Parse the command line inputs
    parser = argparse.ArgumentParser(description="part_profile_analysis")
    parser.add_argument("-settings",
                        dest="settings",
                        required=True,
                        help="settings.txt",
                        metavar="string")
    args = parser.parse_args()
    settings = ga.load_settings(args.settings)
    samples = []
    for s in settings.keys():
        if s != 'None':
            samples.append(s)
            chr_promoters = ga.characterize_promoter_units(
                settings,
                s,
                upstream_bp=10,
                downstream_skip_bp=0,
                downstream_bp=10,
                normed=True)
            ga.save_characterization_data(settings,
                                          s,
                                          chr_promoters,
                                          part_type='promoter')
            chr_terminators = ga.characterize_terminators(settings,
                                                          s,
                                                          upstream_bp=10,
                                                          upstream_skip_bp=0,
                                                          downstream_bp=10,
                                                          normed=True)
            ga.save_characterization_data(settings,
                                          s,
                                          chr_terminators,
                                          part_type='terminator')
            chr_ribozymes = ga.characterize_ribozymes(settings,
                                                      s,
                                                      upstream_promoter_bp=10,
                                                      upstream_bp=10,
                                                      downstream_skip_bp=0,
                                                      downstream_bp=10,
                                                      normed=True)
            ga.save_characterization_data(settings,
                                          s,
                                          chr_ribozymes,
                                          part_type='ribozyme')
    ga.combine_promoter_characterizations(settings, samples)
    ga.combine_terminator_characterizations(settings, samples)
    ga.combine_ribozyme_characterizations(settings, samples)
def main():
    # Parse the command line inputs
    parser = argparse.ArgumentParser(description="profile_normalization")
    parser.add_argument("-settings",
                        dest="settings",
                        required=True,
                        help="settings.txt",
                        metavar="string")
    parser.add_argument("-samples",
                        dest="samples",
                        required=True,
                        help="1,2",
                        metavar="string")
    args = parser.parse_args()
    # Run the command
    samples = args.samples.split(',')
    settings = ga.load_settings(args.settings)
    for s in samples:
        ga.normalise_profiles(settings, s, correction=False, baseline_us_bp=10)
예제 #6
0
def main():
    # Parse the command line inputs
    parser = argparse.ArgumentParser(description="fragment_distributions")
    parser.add_argument("-settings",
                        dest="settings",
                        required=True,
                        help="settings.txt",
                        metavar="string")
    parser.add_argument("-samples",
                        dest="samples",
                        required=True,
                        help="1,2",
                        metavar="string")
    args = parser.parse_args()
    # Run the command
    samples = args.samples.split(',')
    settings = ga.load_settings(args.settings)
    for s in samples:
        ga.fragment_length_dists(settings, s, reads_to_sample=1000000)
예제 #7
0
def main():
    # Parse the command line inputs
    parser = argparse.ArgumentParser(description="de_analysis")
    parser.add_argument("-settings",
                        dest="settings",
                        required=True,
                        help="settings.txt",
                        metavar="string")
    parser.add_argument("-group1",
                        dest="group1",
                        required=True,
                        help="1,2,6,7",
                        metavar="string")
    parser.add_argument("-group2",
                        dest="group2",
                        required=True,
                        help="3,4,8,9",
                        metavar="string")
    parser.add_argument("-output_prefix",
                        dest="output_prefix",
                        required=True,
                        help="WT_vs_Sample",
                        metavar="string")
    parser.add_argument("-bin_path",
                        dest="bin_path",
                        required=True,
                        help="/usr/bin/",
                        metavar="string")
    args = parser.parse_args()
    # Run the command
    settings = ga.load_settings(args.settings)
    cur_group1 = args.group1
    cur_group2 = args.group2
    cur_output_prefix = args.output_prefix
    cur_bin_path = args.bin_path
    # Run the DE analysis
    ga.de_analysis(settings,
                   cur_group1,
                   cur_group2,
                   cur_output_prefix,
                   bin_path=cur_bin_path)
예제 #8
0
def main():
    # Parse the command line inputs
    parser = argparse.ArgumentParser(description="count_reads")
    parser.add_argument("-settings",
                        dest="settings",
                        required=True,
                        help="settings.txt",
                        metavar="string")
    parser.add_argument("-samples",
                        dest="samples",
                        required=True,
                        help="1,2",
                        metavar="string")
    parser.add_argument("-feature",
                        dest="feature",
                        required=True,
                        help="gene",
                        metavar="string")
    parser.add_argument("-attribute",
                        dest="attribute",
                        required=True,
                        help="Name",
                        metavar="string")
    parser.add_argument("-strand_opt",
                        dest="strand_opt",
                        required=True,
                        help="no/yes/reverse",
                        metavar="string")
    args = parser.parse_args()
    # Run the command
    samples = args.samples.split(',')
    settings = ga.load_settings(args.settings)
    f = args.feature
    a = args.attribute
    s_opt = args.strand_opt
    for s in samples:
        ga.count_reads(settings, s, feature=f, attribute=a, strand_opt=s_opt)
        ga.gene_lengths(settings, s, feature=f, attribute=a)
        ga.mapped_reads(settings, s)
예제 #9
0
def main():
    # Parse the command line inputs
    parser = argparse.ArgumentParser(description="read_analysis")
    parser.add_argument("-settings",
                        dest="settings",
                        required=True,
                        help="settings.txt",
                        metavar="string")
    parser.add_argument("-bin_path",
                        dest="bin_path",
                        required=True,
                        help="/usr/bin/",
                        metavar="string")
    args = parser.parse_args()
    # Run the command
    settings = ga.load_settings(args.settings)
    cur_bin_path = args.bin_path
    # Collate read counts and mapped reads for all samples
    counts = {}
    mapped_reads = {}
    sample_names = []
    gene_lengths = {}
    for s in sorted(settings.keys()):
        if s != 'None':
            sample_names.append(s)
            counts[s] = ga.read_count_file(ga.count_filename(settings, s))
            mapped_reads[s] = ga.load_mapped_reads(settings, s)
            gene_lengths[s] = ga.load_gene_lengths(settings, s)
    count_matrix = ga.combine_counts(counts, sample_names)
    ga.save_count_matrix(count_matrix, sample_names,
                         ga.count_matrix_filename(settings))
    ga.save_mapped_reads_matrix(mapped_reads, sample_names,
                                ga.mapped_reads_matrix_filename(settings))
    ga.save_gene_length_matrix(gene_lengths,
                               ga.gene_length_matrix_filename(settings))
    # Generate normalisation factors (edgeR) and output RPKM/FPKM values
    ga.norm_fpkm(settings, bin_path=cur_bin_path)