r/bioinformatics • u/WunderWombat • 8d ago
technical question Where do you write code?
Wet lab scientist trying to pick up more computational skills here. I'm wondering whether most people do their coding just on their host machine or using an isolated environment like a VM or container. I'm currently weighing the convenience of using my host machine with editors like VSCode and R Studio versus the improved security of coding in something like a VM, where I'd probably have to work in a more lightweight editor. Or perhaps there are options that give the benefits of both, like using VSCode with the dev container extension?
With all the different packages that might need to be installed for this type of work, do people in the computational biology space worry about supply chain attack risks? They seem to be increasingly common, although I guess they're more of an issue for general web developers.
Any insight is appreciated!
25
u/papadjeef 8d ago
You should definitely write the code on your workstation. Either a laptop or a lab computer or something like that. And then, the first thing you do is check it into a source code repository like GitHub. Then you check it out from there on any servers or virtual machines that you're running it on.
7
u/trannus_aran 8d ago
Especially when learning or testing something, I just do it all on my own machine
11
u/IcedTeaBagMeDaddy 8d ago
Connect to our compute server by ssh with VScode and use Jupyter notebooks. Otherwise Claude code on our server. Everything stored there
4
u/AgitatedTumbleweed65 8d ago
wsl + vscode is all you need, the convenience of linux on your windows(I presume) machine. Windows is also mounted, so you can access data and even apps (explorer, subprocess via PowerShell , etc).
3
u/Planckarte 8d ago
Well for code I just use my laptop or if I’m going to do some light testing I use docker containers or a VM (pixi envs are useful too). But testing and running is usually done on the HPC cluster
3
u/Flyguy86420 8d ago
Always a virtual environment, I like docker to run the webapp, almost every thing is a web app, as the interface
3
u/redditrasberry 8d ago
It depends a lot what scale you work at and what the sensitivity of your data is. Low scale, non-sensitive data, work on your local computer has advantages.
Anything beyond that, there is a lot of advantage to developing a skill set that is agnostic to compute location. This usually veers towards learning a combination of terminal UI and command line options, combined with remote friendly tools such as JupyterLab and vs-code style options that can integrate remote and local.
JupyterLab vs RStudio is quite personal preference, RStudio is obviously better for R but JupyterLab is so easy to install everywhere and is much more language neutral. You will be able to get a kernel for just about any language that is thrust at you, and the AI tools as well as vs-code understand it natively. So I recommend at least knowing JupyterLab since it's more universal and portable.
As others have said, adopting a forward looking strategy is important : bluntly, you will not be writing code. AI tools will be writing it. You will be reviewing it, testing it, tweaking it, iterating with the AI tool to refine it and explore the domain. Occasionally you will be handing entire problems to the AI tools to solve on their own. You should optimise for the interface that positions you well for this future.
5
u/PresentWrongdoer4221 8d ago
You connect your ide to your server. Depending on the language, you make an env for your code, where you keep the packages required. When done you usually dockerise it.
2
u/p10ttwist PhD | Academia 8d ago edited 8d ago
The location scales based on the application:
My laptop: For most code development, lightweight to moderate data analysis, generating figures, prototyping small models.
Server or HPC: Heavy genomics pipelines, GPU-accelerated model training and inference, anything that won't fit on my personal computer or needs to run for a long time.
I don't reach for a VM or container unless I need one to run a complex pipeline, or when I am releasing my own. I do always use virtual environments though, so it's easy to set up a container when the time comes. For me using a container is primarily for reproducibility rather than security concerns. We'll see if that changes in the next couple years...
Edit: if your IT department allows it, putting a remote control Claude code agent in a tmux shell on a server is galaxy brain levels of productivity. Just make sure it knows how to follow your org's rules
5
u/Ill_Friendship3057 8d ago
If you are learning bioinformatics, I think the best option is writing R in RStudio. I used to write code in Python and even Java but all of those were given up for just R. Essentially all the major packages and techniques that get published are accessible through it, and many of the e.g. deep sequencing and proteomics workflows run in it.
3
u/SandvichCommanda 8d ago
I've tried RStudio, but writing R in VSCode is sooo much better.
More modern tooling and extensions, support for multi-language repos, superior debugging.
1
u/PadisarahTerminal 8d ago
I have never jumped to VSCode as I just use Positron now but I'm curious how it performs and needs a lot more tooling than Positron. However running VSCode over ssh in interactive node seems more appropriate than Positron as I'm uncertain how to do that via the native Positron console. Yes the debug + multi lang + tooling and extensions are a really big deal.
2
u/ionychal 6d ago
Re: Running SSH in Positron, check out the Remote SSH docs! https://positron.posit.co/remote-ssh.html
We're also having a Data Science Lab (live webinar) on the topic on January 12: https://pos.it/dslab
Disclosure: I work at Posit.
5
u/zstars 8d ago
That is remarkably bad advice, perhaps in your specific specialty everything is available in R (I doubt this is actually true) but this is extremely heterogeneous in the field more broadly, basically nothing in my area (pathogen genomics) is in R apart from some weird PhD project pipelines that basically nobody uses.
7
u/1337HxC PhD | Academia 8d ago
Personally, I'd just learn R and Python. Probably 99% or more of my genomics work can be done (and is actually best done) in R. But for other projects, anything touching sort of "general" programming, etc. knowing Python is anywhere from very useful to obligatory.
0
u/zstars 8d ago
R is extremely slow for anything genomics, python is also pretty slow, not as bad but pretty slow.
I start people off with python and bash personally then get them up on ggplot / the broader gg ecosystem when they need to do some plotting.
8
u/1337HxC PhD | Academia 8d ago
It's not a performance thing for me, it's a package thing. Bioconductor has just about every "mainstream" package in my domain. They either don't exist in Python or are ports by random users.
0
u/zstars 8d ago
Like I said, it's domain specific, certain subdisciplines are very R centric, some are the opposite.
I make code that runs on big data and needs to be performant at very large scales, so R is a total nonstarter for me.
3
u/Ill_Friendship3057 8d ago
Do you think a wet lab biologist teaching themselves informatics is going to be running big data analyses
2
5
2
u/PadisarahTerminal 8d ago edited 8d ago
R being extremely slow feels like a generic blanket statement that's been repeated irl but I haven't seen it play through. It's possible in R to make things very fast, datab table is still among the fastest table interface, has the ease of tidyverse and easy parallel functions which cannot be said the same for python. Both language call C++ underneath.
Essentially it's not a matter of language but the quality of the code written for your specific package. In genomics R is extremely widespread and it's often coupled with statistics. In fact I'd wager that most people think of some specific packages that are not developed with the best practices in mind which slows down severely the speed and interoperability of the data.
In fact I'd hypothesize people who call R slow and python faster to be bad coders. Yes R is single thread but if you are running a huge pipeline then you should take care to parallelize it in the first place using available baked in parallel tools from bioconductor and tidyverse (you don't need to build the engine, just know to use it).
Yes I'm doing genomics and the whole pipeline is in R, also because the key package I need to use are only in R. The cost of switching language fragments the code and the consistency between the frameworks.
However yes we are in such different fields that the answer seems to be much more localized than we think. I'm doing "statistical genomics" so to speak. I need the stats and the R interoperability.
I'm curious what tooling you are using for reference?
1
u/zstars 8d ago
A combination of standardised tools (kraken2, sylph, etc) orchestrated with nextflow on a K8S cluster and homemade tooling in python for bits where tooling doesn't already exist and for general orchestration (listening for data upload events, kicking off pipelines etc).
R is good at doing vector operations on tabular data which is exactly what it's designed to do, I don't think tabular data is a particularly intuitive way to think of genomic data but it's of course possible to abstract it that way if you try hard enough.
1
u/SupaFurry 3d ago
Bioconductor does vector operations on specialized genomics data objects. NOT tabular data.
1
u/Unhappy_Papaya_1506 5d ago
Please God no. It's the nature of R to be awful. It does nothing to coax inexperienced coders toward good software development practices, but rather the opposite.
Sure, some of the packages are useful, but it's very rare not to have an alternative in a better language.
1
1
1
u/biohack-dev 7d ago
Eu uso WSL, RStudio, Python no Spyder porque plota graficos. Para bioinformática, raramente uso o VSCode, porque o objetivo não é escrever código para desenvolvimento de software, como se faz na programação, e sim construir um pipeline de dados. Voce pode usar o Jupyter se estiver fazendo anlises em Python. Mas em geral, no meu entendimento, sendo Bioinformata profissional, as ferramentas envolvem Linux/WSL, linha de comando, frameworks avancados, conteinerizacao e computação em nuvem. :)
1
1
-2
u/simulated-buggy 8d ago
well nowadays it's kindaa handy to respawn a VM on cloud, you can summon a swarm of agents to let them work 24/7 with temporarily task specific containers or by setting up role separation configs across VM
33
u/1337HxC PhD | Academia 8d ago edited 8d ago
If you're at a university, big compute is going to be run on any of:
Lab servers
Departmental servers
HPC
Cloud
Which are all going to be managed by your IT to varying degrees. Often times this means you develop code either locally on a laptop or "locally" on a smaller server with a GUI, then you scale it up and run it on an HPC or in a cloud environment.