@multimeric@genomic.social avatar

multimeric

@multimeric@genomic.social

Research Computing Engineer at the Walter and Eliza Hall Institute of Medical Research. Posts about #Rstats, #Python, #Rustlang, #javascript and #Bioinformatics. He/him. https://genomic.social/@multimeric on Twitter.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

4.4.0 now includes "%||%" in base

I've always called it the "null operator", but I'm happy to learn of a better name.

multimeric,
@multimeric@genomic.social avatar

@Mehrad Don't you mean it will return the LHS unless it's null?

multimeric, to random
@multimeric@genomic.social avatar

If you are an Australian researcher, you might have migrated to AARNet's FileSender after the decommission of CloudStor.

I wrote a user friendly CLI and Python API for interacting with FileSender servers such as the AARNet one: https://wehi-researchcomputing.github.io/FileSenderCli/

Hopefully someone finds this useful! I'd love some more users to test it out and provide feedback.

multimeric, to python
@multimeric@genomic.social avatar

Shiny for Python has you pass in functions to App() rather than grouping them into a class or using decorators. It seems a bit unpythonic to me. You even nest function definitions for some reason?

multimeric,
@multimeric@genomic.social avatar

@meejah It just seems like they copy-pasted the R API into Python. It works in R because it's a very functional language, but idiomatic/user-friendly Python uses classes in my opinion. Especially because a Shiny app is so cleanly modelled as a class that implements an interface.

I'd rather see it look something like this

multimeric,
@multimeric@genomic.social avatar

@meejah Touche, I think that's an accurate observation. But really it's not that I prefer inheritance, I just think that Python has better tools to create rich APIs using it, via metaclasses and class hooks.

multimeric, to python
@multimeric@genomic.social avatar

It occurred to me today that None has a class like everything else in Python.

multimeric, to random
@multimeric@genomic.social avatar

Does anyone know how you are supposed to create slides with The Carpentries?

The Carpentries Workbench spits out documents that aren't well suited to actually presenting. I was kind of hoping it could work like Quarto and output a content PDF and also a slideshow, but it doesn't seem to. The alternative of making a separate slideshow in addition to your Workbench project seems a bit redundant.

multimeric, to bioinformatics
@multimeric@genomic.social avatar
multimeric, to python
@multimeric@genomic.social avatar

My Python typing hot take is that Optional[str] was pretty neat actually, and str | None just doesn't read as well or as intuitively.

It affects nothing, and no one is stopping me from using Optional so it's all very low stakes.

multimeric, to bioinformatics
@multimeric@genomic.social avatar

I can see a lot of crossover potential here

multimeric, to programming
@multimeric@genomic.social avatar

Reading about factors in programming language learning:

> To our surprise, we found that languages using a more traditional C-style syntax (both Perl and Java) did not afford accuracy rates significantly higher than a language with randomly generated keywords, but that languages which deviate (Quorum, Python, and Ruby) did.

https://dl.acm.org/doi/10.1145/2534973

This paper is 10 years old, but I still found that sentence fairly mind blowing.

#c

multimeric, to bioinformatics
@multimeric@genomic.social avatar

University of Melbourne has posted a (bioinformatics-related) cloud developer role if anyone is interested: https://jobs.unimelb.edu.au/en/job/913794/cloud-application-developer

,

freemo, to ruby
@freemo@qoto.org avatar

Ya know the more I reflect on the languages I know the more I realize that outside of functional languages none of them really handle immutability well.

Consider that you want most of your objects to be immutable most of the time. Thats all well and good till you realize you want to be able to edit the objects in such a way that it creates duplicates that have some data changed but are likewise immutable.

This tends to stop working, almost entierly, once you get into subclassing. If you parent class has a method that returns a copy of itself with some data modified, this will break in children classes, since you want children classes to return instances of itself, not its parent.

Its not that you cant fix that, but the code gets very ugly very quickly. Generally you are forced to let the code handling the classes do the copying and editing itself, but that is pretty ugly too.

I have had this pattern problem in almost every OO language i messed with, Java, Ruby, Python, etc.

#Ruby #Python #Java #Programming #CS

multimeric,
@multimeric@genomic.social avatar

@freemo Off the top of my head, I think this would work pretty well if you use a frozen data class. Then in your manipulation methods you can use .replace (https://docs.python.org/3/library/dataclasses.html#dataclasses.replace) to do the manipulations without modifying the current instance. I think it would work well with subclasses as well because it will always be calling the current class constructor.

multimeric,
@multimeric@genomic.social avatar

@freemo I don't follow. Isn't your entire state made up of fields? What else needs to be changed? If you define all of your methods in terms of .replace instead of modifying self, it seems like it should work.

multimeric,
@multimeric@genomic.social avatar

@freemo If you consistently use the pattern of returning .replace() for each of your manipulations, you can still use abstractions and don't have to modify everything in one place. You can also modify associated objects via this mechanism:

@dataclass(frozen=True)
class Car(Vehicle):
def service(self) -> Self:
return self.replace(
wheels = self.wheels.service(),
battery = self.battery.service()
)

multimeric, to python
@multimeric@genomic.social avatar

Python's assert is in a very awkward position.

It's a concise keyword for a very common type of validation, but it gets ignored if Python is run in optimised mode. However no one really runs Python in optimised mode so there are arguments on both sides about whether or not you should use assert.

Personally I also dislike that it always throws an AssertionError, so you can't use custom error types for the sake of user friendliness.

More info: https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement

multimeric,
@multimeric@genomic.social avatar

@orsinium All exceptions "must not happen" because they indicate exceptional circumstances. So I don't see the value in a special type of even more exceptional exception. In any case you can very easily suppress them using python -O.

multimeric, to python
@multimeric@genomic.social avatar

Day 3,406 of wishing Python's tempfile module returned pathlib.Path objects instead of str.

multimeric, to Bash
@multimeric@genomic.social avatar

Today I learned that Ctrl+\ (backslash) in your Linux shell sends SIGQUIT, which is more powerful than Ctrl+C (SIGINT), so it's worth trying if a process is ignoring your attempts to kill it!

(there is apparently no shortcut for SIGKILL, the most powerful signal)

Nour, to random
@Nour@fosstodon.org avatar

People really thought toots was awkward when Bluesky and Threads are out here with fucking skeets and throots

multimeric,
@multimeric@genomic.social avatar
Elendol, to random
@Elendol@hachyderm.io avatar

Such a pain to setup Nextflow with AWS batch. I guess there is a use case for it, but for what I am doing it is so much easier to pop a big EC2 instance and do the work there.

multimeric,
@multimeric@genomic.social avatar

@emiller @Elendol I found the AGC (https://github.com/aws/amazon-genomics-cli) super easy when I tried it. I'm surprised the Nextflow docs never linked to it.

xgranade, to random
@xgranade@wandering.shop avatar

I don't know who needs to know this, but if you want to reset stdin for a Windows console process back to interactive console input even when your process has had its stdin redirected, there is a way to do it. Basically, you ask for the parent processes' console, use it to open a special file called CONIN$ and then redirect your own stdin to that special file.

multimeric,
@multimeric@genomic.social avatar

@xgranade Might be worth publishing a GitHub gist so people can easily find it?

multimeric, to rstats
@multimeric@genomic.social avatar

Did you know that the result of c(1L, 2L, 3L) and 1:3 are not actually the same in R?

1:3 is an ALTREP vector, which altrepr, my new R package, explores in detail: https://multimeric.github.io/altrepr/.

altrepr lets you explore and edit the internal fields used by ALTREP, and includes some detailed vignettes on R's four built-in ALTREP classes, which you might not realise R secretly uses in a few different places.

@rstats

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • GTA5RPClips
  • thenastyranch
  • tacticalgear
  • ethstaker
  • InstantRegret
  • DreamBathrooms
  • ngwrru68w68
  • magazineikmin
  • Youngstown
  • mdbf
  • khanakhh
  • slotface
  • rosin
  • provamag3
  • kavyap
  • everett
  • cisconetworking
  • Durango
  • modclub
  • osvaldo12
  • tester
  • Leos
  • cubers
  • normalnudes
  • megavids
  • anitta
  • lostlight
  • All magazines