mirror of https://github.com/stijndcl/didier
Add optional benchmark to compbio lb
parent
3f2f9cd8f3
commit
0f973efe29
|
@ -90,9 +90,10 @@ class SchoolSlash(commands.Cog):
|
||||||
_compbio_group = SlashCommandGroup("compbio", "Commands voor compbio opdrachten")
|
_compbio_group = SlashCommandGroup("compbio", "Commands voor compbio opdrachten")
|
||||||
|
|
||||||
@_compbio_group.command(name="leaderboard", description="Gesorteerd en ingevuld leaderboard")
|
@_compbio_group.command(name="leaderboard", description="Gesorteerd en ingevuld leaderboard")
|
||||||
async def _compbio_lb_slash(self, ctx: ApplicationContext):
|
async def _compbio_lb_slash(self, ctx: ApplicationContext,
|
||||||
|
benchmark: Option(int, "De specifieke benchmark om op te halen (default k=600)", choices=[6, 10, 50, 600], default=600)):
|
||||||
await ctx.response.defer()
|
await ctx.response.defer()
|
||||||
lb = leaderboards.CompbioLeaderboard(ctx)
|
lb = leaderboards.CompbioLeaderboard(ctx, kmer=benchmark)
|
||||||
await lb.respond()
|
await lb.respond()
|
||||||
|
|
||||||
@_compbio_group.command(name="submit", description="Link een Dodona-submission aan jouw username")
|
@_compbio_group.command(name="submit", description="Link een Dodona-submission aan jouw username")
|
||||||
|
|
|
@ -125,6 +125,11 @@ class CompbioLeaderboard(Leaderboard):
|
||||||
colour: discord.Colour = field(default=discord.Colour.green())
|
colour: discord.Colour = field(default=discord.Colour.green())
|
||||||
title: str = field(default="Leaderboard Computationele Biologie #2")
|
title: str = field(default="Leaderboard Computationele Biologie #2")
|
||||||
reverse: bool = False
|
reverse: bool = False
|
||||||
|
kmer: int = 600
|
||||||
|
|
||||||
|
def __post_init__(self):
|
||||||
|
self.title += f" (k = {self.kmer})"
|
||||||
|
super().__post_init__()
|
||||||
|
|
||||||
def get_submission_user(self, submission_id: str) -> str:
|
def get_submission_user(self, submission_id: str) -> str:
|
||||||
with open("files/compbio_benchmarks_2.json", "r") as fp:
|
with open("files/compbio_benchmarks_2.json", "r") as fp:
|
||||||
|
@ -137,8 +142,17 @@ class CompbioLeaderboard(Leaderboard):
|
||||||
return f"[# {submission_id}]"
|
return f"[# {submission_id}]"
|
||||||
|
|
||||||
def get_data(self) -> list[tuple]:
|
def get_data(self) -> list[tuple]:
|
||||||
|
files = {
|
||||||
|
6: "J02459.1",
|
||||||
|
10: "J02459.1",
|
||||||
|
50: "J02459.1",
|
||||||
|
600: "AF033819.3"
|
||||||
|
}
|
||||||
|
|
||||||
|
url = f"https://github.ugent.be/raw/computationele-biologie/benchmarks-2022/main/reconstruction/{files[self.kmer]}.{self.kmer}mers.md"
|
||||||
headers = {"Authorization": f"token {settings.UGENT_GH_TOKEN}"}
|
headers = {"Authorization": f"token {settings.UGENT_GH_TOKEN}"}
|
||||||
result = requests.get(f"https://github.ugent.be/raw/computationele-biologie/benchmarks-2022/main/reconstruction/J02459.1.50mers.md", headers=headers).text
|
result = requests.get(url, headers=headers).text
|
||||||
|
|
||||||
# Remove table headers
|
# Remove table headers
|
||||||
result = result.split("\n")[2:]
|
result = result.split("\n")[2:]
|
||||||
data = []
|
data = []
|
||||||
|
|
Loading…
Reference in New Issue