mirror of https://github.com/stijndcl/didier
Compare commits
4 Commits
82671896b6
...
97d533e04f
| Author | SHA1 | Date |
|---|---|---|
|
|
97d533e04f | |
|
|
8e050f9ab3 | |
|
|
0151913e61 | |
|
|
b156f90ea0 |
|
|
@ -6,6 +6,7 @@ files/lost.json
|
||||||
files/locked.json
|
files/locked.json
|
||||||
files/ufora_notifications.json
|
files/ufora_notifications.json
|
||||||
files/compbio_benchmarks_2.json
|
files/compbio_benchmarks_2.json
|
||||||
|
files/compbio_benchmarks_4.json
|
||||||
.idea/
|
.idea/
|
||||||
__pycache__
|
__pycache__
|
||||||
.env
|
.env
|
||||||
|
|
|
||||||
11
cogs/help.py
11
cogs/help.py
|
|
@ -50,7 +50,16 @@ class HelpCommand(commands.MinimalHelpCommand):
|
||||||
return await self.send_bot_help(self.get_bot_mapping())
|
return await self.send_bot_help(self.get_bot_mapping())
|
||||||
|
|
||||||
# Turn dic to lowercase to allow proper name searching
|
# Turn dic to lowercase to allow proper name searching
|
||||||
all_commands = dict((k.lower(), v) for k, v in bot.all_commands.items() if not isinstance(v, SlashCommand))
|
all_commands = {}
|
||||||
|
|
||||||
|
for k, v in bot.all_commands.items():
|
||||||
|
if k is None or v is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if isinstance(v, SlashCommand):
|
||||||
|
continue
|
||||||
|
|
||||||
|
all_commands[k.lower()] = v
|
||||||
|
|
||||||
if spl[0].lower() not in all_commands:
|
if spl[0].lower() not in all_commands:
|
||||||
return await self.send_error_message(await self.command_not_found(spl[0]))
|
return await self.send_error_message(await self.command_not_found(spl[0]))
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,10 @@ class SchoolSlash(commands.Cog):
|
||||||
|
|
||||||
@_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)):
|
benchmark: Option(str, "De specifieke benchmark om op te halen (default 10000-10)", choices=["100-10", "100-100", "1000-100", "10000-10"], default="10000-10")):
|
||||||
await ctx.response.defer()
|
await ctx.response.defer()
|
||||||
lb = leaderboards.CompbioLeaderboard(ctx, kmer=benchmark)
|
size, amount = benchmark.split("-")
|
||||||
|
lb = leaderboards.CompbioLeaderboard(ctx, size=size, amount=amount)
|
||||||
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")
|
||||||
|
|
@ -101,7 +102,7 @@ class SchoolSlash(commands.Cog):
|
||||||
submission: Option(int, description="Id van je Dodona indiening.", required=True)):
|
submission: Option(int, description="Id van je Dodona indiening.", required=True)):
|
||||||
await ctx.response.defer(ephemeral=True)
|
await ctx.response.defer(ephemeral=True)
|
||||||
|
|
||||||
with open("files/compbio_benchmarks_2.json", "r") as fp:
|
with open("files/compbio_benchmarks_4.json", "r") as fp:
|
||||||
file = json.load(fp)
|
file = json.load(fp)
|
||||||
|
|
||||||
submission = str(submission)
|
submission = str(submission)
|
||||||
|
|
@ -109,7 +110,7 @@ class SchoolSlash(commands.Cog):
|
||||||
if submission in file:
|
if submission in file:
|
||||||
return await ctx.send_followup("❌ Deze submission is al aan iemand gelinkt.")
|
return await ctx.send_followup("❌ Deze submission is al aan iemand gelinkt.")
|
||||||
|
|
||||||
with open("files/compbio_benchmarks_2.json", "w") as fp:
|
with open("files/compbio_benchmarks_4.json", "w") as fp:
|
||||||
file[submission] = ctx.user.id
|
file[submission] = ctx.user.id
|
||||||
json.dump(file, fp)
|
json.dump(file, fp)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,16 +123,17 @@ class BitcoinLeaderboard(Leaderboard):
|
||||||
@dataclass
|
@dataclass
|
||||||
class CompbioLeaderboard(Leaderboard):
|
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 #4")
|
||||||
reverse: bool = False
|
reverse: bool = False
|
||||||
kmer: int = 600
|
size: int = 10000
|
||||||
|
amount: int = 10
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
self.title += f" (k = {self.kmer})"
|
self.title += f" ({self.size}-{self.amount})"
|
||||||
super().__post_init__()
|
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_4.json", "r") as fp:
|
||||||
file = json.load(fp)
|
file = json.load(fp)
|
||||||
|
|
||||||
if submission_id in file:
|
if submission_id in file:
|
||||||
|
|
@ -142,14 +143,7 @@ class CompbioLeaderboard(Leaderboard):
|
||||||
return f"[# {submission_id}]"
|
return f"[# {submission_id}]"
|
||||||
|
|
||||||
def get_data(self) -> list[tuple]:
|
def get_data(self) -> list[tuple]:
|
||||||
files = {
|
url = f"https://github.ugent.be/raw/computationele-biologie/benchmarks-2022/main/profile_hmm/size{self.size}-amount{self.amount}.md"
|
||||||
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(url, headers=headers).text
|
result = requests.get(url, headers=headers).text
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue