diff options
Diffstat (limited to 'gn3')
-rw-r--r-- | gn3/api/correlation.py | 12 | ||||
-rw-r--r-- | gn3/api/datasets.py | 8 | ||||
-rw-r--r-- | gn3/api/traits.py | 7 | ||||
-rw-r--r-- | gn3/computations/correlations.py | 15 |
4 files changed, 20 insertions, 22 deletions
diff --git a/gn3/api/correlation.py b/gn3/api/correlation.py index 53ea6a7..e023cbe 100644 --- a/gn3/api/correlation.py +++ b/gn3/api/correlation.py @@ -15,9 +15,10 @@ correlation = Blueprint("correlation", __name__) @correlation.route("/sample_r/<string:corr_method>", methods=["POST"]) def compute_sample_r(corr_method="pearson"): - """correlation endpoint for computing sample r correlations\ + """Correlation endpoint for computing sample r correlations\ api expects the trait data with has the trait and also the\ - target_dataset data""" + target_dataset data + """ correlation_input = request.get_json() # xtodo move code below to compute_all_sampl correlation @@ -35,9 +36,10 @@ def compute_sample_r(corr_method="pearson"): @correlation.route("/lit_corr/<string:species>/<int:gene_id>", methods=["POST"]) def compute_lit_corr(species=None, gene_id=None): - """api endpoint for doing lit correlation.results for lit correlation\ + """Api endpoint for doing lit correlation.results for lit correlation\ are fetched from the database this is the only case where the db\ - might be needed for actual computing of the correlation results""" + might be needed for actual computing of the correlation results + """ database_instance = mock.Mock() target_traits_gene_ids = request.get_json() @@ -51,7 +53,7 @@ def compute_lit_corr(species=None, gene_id=None): @correlation.route("/tissue_corr/<string:corr_method>", methods=["POST"]) def compute_tissue_corr(corr_method="pearson"): - """api endpoint fr doing tissue correlation""" + """Api endpoint fr doing tissue correlation""" tissue_input_data = request.get_json() primary_tissue_dict = tissue_input_data["primary_tissue"] target_tissues_dict_list = tissue_input_data["target_tissues"] diff --git a/gn3/api/datasets.py b/gn3/api/datasets.py index a6951fb..7f08de5 100644 --- a/gn3/api/datasets.py +++ b/gn3/api/datasets.py @@ -10,11 +10,10 @@ from gn3.experimental_db import database_connector dataset = Blueprint("dataset", __name__) - @dataset.route("/create/<dataset_name>/") @dataset.route("/create/<dataset_name>/<dataset_type>") def create_dataset_api(dataset_name, dataset_type=None): - """Test api/create/dataset/<dataset_name>/<dataset_type>""" + """Endpoint of creating dataset""" new_dataset = create_dataset( dataset_type=dataset_type, dataset_name=dataset_name) @@ -27,9 +26,8 @@ def create_dataset_api(dataset_name, dataset_type=None): @dataset.route("/fetch_traits_data/<dataset_name>/<dataset_type>") def fetch_traits_data(dataset_name, dataset_type): - """test fetch_traits_data/dataset_name/dataset_type""" - # what actually brings speed issues in correlation - # should fetch this + """Endpoint for fetching Trait data""" + # should fetch this(temp) trait_sample_ids = [4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 29, 30, 31, 35, 36, 37, 39, 98, 99, 100, 103, 487, 105, 106, 110, 115, diff --git a/gn3/api/traits.py b/gn3/api/traits.py index cf445e1..0ac437d 100644 --- a/gn3/api/traits.py +++ b/gn3/api/traits.py @@ -12,11 +12,10 @@ from gn3.experimental_db import database_connector trait = Blueprint("trait", __name__) - @trait.route("/<string:trait_name>/<string:dataset_name>") def create_trait(trait_name, dataset_name): - """/test:trait_name/dataset_name/type :retrieve sample\ - data for trait""" + """Endpoint for creating trait and fetching strain\ + values""" # xtodo replace the object at most this endpoint # requires dataset_type,dataset_name ,dataset_id @@ -38,7 +37,7 @@ def create_trait(trait_name, dataset_name): @trait.route("/trait_info/<string:trait_name>", methods=["POST"]) def fetch_trait_info(trait_name): - """api endpoint for fetching the trait info \ + """Api endpoint for fetching the trait info \ expects the trait and trait dataset to have\ been created """ data = request.get_json() diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py index dc2f8d3..7a6ff11 100644 --- a/gn3/computations/correlations.py +++ b/gn3/computations/correlations.py @@ -89,10 +89,9 @@ package :not packaged in guix def filter_shared_sample_keys(this_samplelist, target_samplelist) -> Tuple[List, List]: - """Given primary and target samplelist for two base and target trait select -filter the values using the shared keys - - """ + """Given primary and target samplelist\ + for two base and target trait select\ + filter the values using the shared keys""" this_vals = [] target_vals = [] for key, value in target_samplelist.items(): @@ -105,8 +104,9 @@ filter the values using the shared keys def compute_all_sample_correlation(this_trait, target_dataset, corr_method="pearson") -> List: - """Given a trait data samplelist and target__datasets compute all sample -correlation""" + """Given a trait data samplelist and\ + target__datasets compute all sample correlation + """ this_trait_samples = this_trait["trait_sample_data"] @@ -269,7 +269,7 @@ def query_formatter(query_string: str, *query_values): def map_to_mouse_gene_id(database, species: Optional[str], gene_id: Optional[str]) -> Optional[str]: - """given a species which is not mouse map the gene_id\ + """Given a species which is not mouse map the gene_id\ to respective mouse gene id""" # AK:xtodo move the code for checking nullity out of thing functions bug # while method for string @@ -296,7 +296,6 @@ def compute_all_lit_correlation(database_instance, trait_lists: List, species: str, gene_id): """Function that acts as an abstraction for lit_correlation_for_trait_list""" - # xtodo to be refactored lit_results = lit_correlation_for_trait_list( database=database_instance, |