Skip to content

Commit

Permalink
Merge pull request #68 from databio/dev
Browse files Browse the repository at this point in the history
v0.1.2
  • Loading branch information
xuebingjie1990 authored Feb 7, 2023
2 parents 95a0e3c + d5922bc commit f6848ca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
18 changes: 12 additions & 6 deletions bedhost/routers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
example=ex_chr,
)


class BEDLIST(BaseModel):
md5sums: list


# misc endpoints
@router.get("/versions", response_model=Dict[str, str])
async def get_version_info():
Expand Down Expand Up @@ -783,9 +788,9 @@ async def create_new_bedset(
return Response(m.hexdigest(), media_type="text/plain")


@router.get("/bedset/my_bedset/file_paths/{bedfiles}", include_in_schema=False)
@router.post("/bedset/my_bedset/file_paths", include_in_schema=True)
async def get_mybedset_file_path(
bedfiles: str = Path(..., description="BED file indexs"),
md5sums: BEDLIST,
remoteClass: RemoteClassEnum = Query(
"http", description="Remote data provider class"
),
Expand All @@ -794,12 +799,13 @@ async def get_mybedset_file_path(
return list of file path for user defined bed
"""

bfs = list(bedfiles.split(","))
# idxs = list(bedfiles.split(","))

paths = ""
for bed in bfs:
for bed in md5sums.md5sums:
print(bed)
hit = bbc.bed.select(
filter_conditions=[("id", "eq", bed)],
filter_conditions=[("md5sum", "eq", bed)],
columns=[file_map_bed["bed"]],
)[0]
file = getattr(hit, file_map_bed["bed"])
Expand All @@ -822,7 +828,7 @@ async def get_mybedset_file_path(
response = StreamingResponse(
stream,
media_type="text/csv",
headers={"Content-Disposition": f"attachment; filename={filename}.txt"},
)
response.headers["Content-Disposition"] = f"attachment; filename={filename}"

return response
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.1.2] -- 2023-2-6
### change
- change `/bedset/my_bedset/file_paths`endpoint from GET to POST

## [0.1.1] -- 2021-10-30
### change
- `/bed/genomes` and `bedset/genomes`: impove speed
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pipestat_reader
python-multipart
pyyaml
requests
starlette==0.16.0
starlette==0.22.0
uvicorn
yacman>=0.7.1
setuptools
Expand Down

0 comments on commit f6848ca

Please sign in to comment.