def main(args): suffix = sys.argv[1] elms = sys.argv[2:] file_species_pairs = [] for g in global_settings.GENOMES: file_species_pairs.append(('results/elmdict_' + g + suffix, g)) plot_dir = 'plots/for_aydin/' species2elms = {} for file, species in file_species_pairs: species2elms[species] = utils.get_seq2count_dict(file, float(0)) for elm in elms: utils_plot.elm_host_barplot(species2elms, elm, os.path.join(plot_dir, elm + '.hosts' + suffix + '.png'))
def main(args): file_species_pairs = [] i = 1 while i < len(args)-2: file_species_pairs.append([args[i], args[i+1]]) i += 2 cutoff = float(sys.argv[-2]) plot_dir = sys.argv[-1] species2elms = {} for file, species in file_species_pairs: species2elms[species] = utils.get_seq2count_dict(file, cutoff) elms = {} for species in species2elms: for elm in species2elms[species]: elms[elm] = True for elm in elms: if utils.check_ones(species2elms, elm) and (elm in species2elms['swine'] or elm in species2elms['human'] or elm in species2elms['chicken']) and elm in species2elms['H_sapiens'] : utils_plot.elm_host_barplot(species2elms, elm, os.path.join(plot_dir, elm + '.hosts.png'))
def main(args): file_species_pairs = [] i = 1 while i < len(args)-2: file_species_pairs.append([args[i], args[i+1]]) i += 2 cutoff = float(sys.argv[-2]) plot_dir = sys.argv[-1] species2elms = {} virus2elms = {} # first grab virus ELMs for file, species in file_species_pairs: if file.find('flu') != -1: virus2elms[species] = utils.get_seq2count_dict(file, cutoff) else: species2elms[species] = True elms = {} for species in virus2elms: for elm in virus2elms[species]: elms[elm] = True for species in species2elms: species2elms[species] = utils.get_seq2count_dict_for_seqs(file, cutoff, virus2elms) for virus in virus2elms: species2elms[virus] = virus2elms[virus] for elm in elms: if utils.check_ones(species2elms, elm): if utils_distance.distance_elms(species2elms['Sus_scrofa'][elm], species2elms['H_sapiens'][elm]) > float(-1) or utils_distance.distance_elms(species2elms['Sus_scrofa'][elm], species2elms['Gallus_gallus'][elm]) > float(0): utils_plot.elm_host_barplot(species2elms, elm, os.path.join(plot_dir, elm + '.virus_hosts.png'))
dis[g] = utils_distance.distance_elms(species2dict[g][elm], virus2dict[v][elm]) is_less = True is_gtr = True for g in genomes: if g != v2h[v]: if dis[v2h[v]] > dis[g]:#it is not less than at least one is_less = False if is_less: right_count[v] += 1 new_d = {} for h in species2dict: new_d[h] = species2dict[h] for v in virus2dict: new_d[v] = virus2dict[v] utils_plot.elm_host_barplot(new_d, elm, elm + '.png') for v in right_count: print v, right_count[v] #for elm in use_elms: # utils_plot.elm_host_barplot(virus2dict, elm, elm + '.png') # v = 'human' # for elm in use_elms: # if elm in host_elms: # dis = {} # for g in genomes: # dis[g] = utils_distance.distance_elms(species2dict[g][elm],
import utils, utils_plot, utils_distance d = {'web':utils.get_seq2count_dict('results/human.website.elm.elmdict', float(.01)), 'regex':utils.get_seq2count_dict('results/hprd_new.regex.elms.elmdict', float(.01))} elms = utils_distance.get_elements(d['web'], d['regex']) for elm in elms: utils_plot.elm_host_barplot(d, elm, 'plots/hprd/' + elm + '.png')