apscale
Advanced tools
| Metadata-Version: 2.4 | ||
| Name: apscale | ||
| Version: 4.1.4 | ||
| Version: 4.1.5 | ||
| Summary: Advanced Pipeline for Simple yet Comprehensive AnaLysEs of DNA metabarcoding data | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/DominikBuchner/apscale |
@@ -1,2 +0,2 @@ | ||
| import duckdb, pyproj, time, requests | ||
| import duckdb, pyproj, time, requests, random | ||
| import pandas as pd | ||
@@ -12,2 +12,3 @@ import pathlib | ||
| from pygbif import occurrences as occ | ||
| from pygbif.gbifutils import NoResultException | ||
@@ -154,3 +155,3 @@ | ||
| while True: | ||
| data_chunk = distinct_sequences.fetch_df_chunk(1) | ||
| data_chunk = distinct_sequences.fetch_df_chunk() | ||
| if data_chunk.empty: | ||
@@ -282,2 +283,4 @@ break | ||
| def validation_api_request(species_name, wkt_string) -> str: | ||
| # define a backoff factor for each individual request | ||
| backoff = 1.0 | ||
| # perform the api call | ||
@@ -287,5 +290,8 @@ while True: | ||
| validation_result = occ.search( | ||
| scientificName=species_name, geometry=wkt_string, timeout=60 | ||
| scientificName=species_name, geometry=wkt_string, limit=1, timeout=60 | ||
| ) | ||
| break | ||
| print(validation_result) | ||
| return ( | ||
| "plausible" if validation_result.get("count", 0) > 0 else "implausible" | ||
| ) | ||
| except ( | ||
@@ -296,9 +302,10 @@ requests.exceptions.HTTPError, | ||
| if e.response.status_code == 429: | ||
| time.sleep(1) | ||
| continue | ||
| wait = backoff + random.uniform(0, 1) | ||
| time.sleep(wait) | ||
| backoff *= 2 | ||
| if validation_result["count"] > 0: | ||
| return "plausible" | ||
| else: | ||
| return "implausible" | ||
| except NoResultException: | ||
| wait = backoff + random.uniform(0, 1) | ||
| time.sleep(wait) | ||
| backoff *= 2 | ||
@@ -337,3 +344,3 @@ | ||
| ) | ||
| validation_status = Parallel(n_jobs=-2)( | ||
| validation_status = Parallel(n_jobs=1)( | ||
| delayed(validation_api_request)(species_name, wkt_string) | ||
@@ -340,0 +347,0 @@ for species_name, wkt_string in chunk_args |
+1
-1
| Metadata-Version: 2.4 | ||
| Name: apscale | ||
| Version: 4.1.4 | ||
| Version: 4.1.5 | ||
| Summary: Advanced Pipeline for Simple yet Comprehensive AnaLysEs of DNA metabarcoding data | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/DominikBuchner/apscale |
+1
-1
@@ -8,3 +8,3 @@ import setuptools | ||
| name="apscale", | ||
| version="4.1.4", | ||
| version="4.1.5", | ||
| author="Dominik Buchner", | ||
@@ -11,0 +11,0 @@ author_email="dominik.buchner524@googlemail.com", |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
259957
0.15%5606
0.13%