Exemple #1
0
 def has_trait(self, trait):
     h5files = fsutils.get_h5files_in_dir(self.search_path, self.trait_dir)
     for h5file in h5files:
         service = trait_service.TraitService(h5file=h5file)
         if service.has_trait(trait):
             return True
     raise NotFoundError("Trait " + trait)
 def has_gene(self, gene):
     service = trait_service.TraitService(self.trait_file)
     #search = cr.search_all_assocs(gene=gene, start=0, size=0, properties=self.properties)
     #if search[-1] > 0:
     #    return True
     if service.has_gene(gene):
         return True
     raise NotFoundError("Gene " + gene)
 def has_trait(self, trait):
     service = trait_service.TraitService(self.trait_file)
     #search = cr.search_all_assocs(trait=trait, start=0, size=0, properties=self.properties)
     #if search[-1] > 0:
     #    return True
     if service.has_trait(trait):
         return True
     raise NotFoundError("Trait " + trait)
Exemple #4
0
 def _get_traversed_size(self, retrieved_index, trait):
     if retrieved_index == 0:
         h5file = fsutils.create_h5file_path(self.search_path, dir_name=self.trait_dir, file_name=trait)
         service = trait_service.TraitService(h5file)
         trait_size = service.get_trait_size(trait)
         service.close_file()
         return trait_size
     return retrieved_index
Exemple #5
0
    def get_list_of_traits(self):
        traits = []
        h5files = fsutils.get_h5files_in_dir(self.search_path, self.trait_dir)
        for h5file in h5files:
            service = trait_service.TraitService(h5file=h5file)
            traits.extend(service.list_traits())
            service.close_file()

        return sorted(traits)
 def chrom_for_trait(self):
     #h5file = fsutils.create_h5file_path(self.search_path, self.trait_dir, self.trait_file)
     trait_service = ts.TraitService(self.trait_file)
     chroms = trait_service.chrom_from_trait(self.trait)
     if len(chroms) == 1:
         self.chromosome = chroms[0]
     elif len(chroms) > 1:
         logger.debug("more than one chrom for this trait?"
                      )  # need to handle this error
     else:
         logger.debug(
             "No chrom for this trait?")  # need to handle this error
Exemple #7
0
    def __init__(self, trait, start, size, config_properties=None):
        self.trait = trait
        self.start = start
        self.size = size

        self.properties = properties_handler.get_properties(config_properties)
        self.search_path = properties_handler.get_search_path(self.properties)
        self.trait_dir = self.properties.trait_dir

        self.datasets = utils.create_dictionary_of_empty_dsets(TO_QUERY_DSETS)
        # index marker will be returned along with the datasets
        # it is the number that when added to the 'start' value that we started the query with
        # will pinpoint where the next search needs to continue from
        self.index_marker = 0
        self.h5file = fsutils.create_h5file_path(self.search_path,
                                                 dir_name=self.trait_dir,
                                                 file_name=trait)
        if not os.path.isfile(self.h5file):
            raise NotFoundError("Trait " + trait)
        self.service = trait_service.TraitService(self.h5file)
        self.max_size_of_trait = self.service.get_trait_size(self.trait)
 def get_list_of_genes(self):
     service = trait_service.TraitService(self.trait_file)
     genes = service.list_genes()
     return genes
 def get_list_of_traits(self):
     service = trait_service.TraitService(self.trait_file)
     traits = service.list_traits()
     return traits