A R function creating 96 well plate sample assignment

Most recently I had to add forgotten data to a SQL server database that was in use only until 2010. Script language was Cold Fusion at that time creating a visual interface to 96 well plates where proband IDs are assigned to plate positions by drop down fields.

R doesn’t have any good way for formatted data entry. Some shiny apps would be helpful but a bit overkill here. Data export into a javascript framework would be also a more professional solution while I just needed only a quick way to modify my database.

So I came up with some R code producing html code embedding javascript functions that can export the result as SQL code, so a 4 language mixup.

96 well plate assignment
dataentry <- function(plate_id,city) {
# get orig IDs from database first

# position identifier A01, A02...
pos = NULL
for (i in 1:8) {
  pos = c(pos, paste0( rep( LETTERS[i], 12), str_pad( 1:12 ,2,pad="0" ) ) )
HTML <- paste('<html>
function download(filename, text) {
  var element = document.createElement("a");
  element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text));
  element.setAttribute("download", filename);
  element.style.display = "none";
function saveValues() {
  var frm = document.getElementById("f");
  var params = "";
  var sample_id = ',sample_id,';
  for( var i=0; i<frm.length; i++ ) {
    var fieldId = frm.elements[i].id;
    var fieldValue = frm.elements[i].value;
    if (fieldValue) params += "INSERT INTO samples (plate_id,plate_position,patient_id) VALUES (',plate_id,'," + fieldId + "," + fieldValue + ")\\n";
<form id="f">')
# dropdowns
sel ='<option value=""></option>'
for (i in 1:dim(patients)[1]) {
  sel <- paste0(sel,'<option value=',patients[i,"patient_id"],'>',patients[i,"Orig_ID"],'</option>\n')
for (i in pos) {
  if (substr(i,2,3) == "01") HTML <- paste0(HTML,'<BR>')
  HTML <- paste(HTML,'<select id=',i,'>',sel,'</select>')
HTML <- paste(HTML,'</form>
<br><input name="save" type="button" value="SQL" onclick="saveValues(); return false"/>
sink( paste('plate.html') )

Une grenouille vit un Bœuf

Jean de la Fontaine

Ein Frosch sah einen Ochsen gehen.
Une grenouille vit un Bœuf

Wie stattlich war der anzusehen!
Qui lui sembla de belle taille.

Er, der nicht größer als ein Ei, war neidisch drauf,
Elle qui n’était pas grosse en tout comme un œuf,

Er spreizt sich, bläht mit Macht sich auf,
Envieuse s’étend, et s’enfle, et se travaille

Um gleich zu sein dem großen Tier,
Pour égaler l’animal en grosseur,

Und rief: »Ihr Brüder achtet und vergleicht!
Disant : « Regardez bien, ma sœur,

Wie, bin ich nun so weit? Ach, sagt es mir!« –
Est-ce assez ? dites-moi : n’y suis-je point encore ?

»Nein!« – »Aber jetzt?« – »Was denkst du dir!« –
— Nenni. — M’y voici donc ? — Point du tout. — M’y voilà ?

»Und jetzt?« – »Noch lange nicht erreicht!« –
— Vous n’en approchez point. » La chétive pécore »

Das Fröschlein hat sich furchtbar aufgeblasen,
Es platzte und verschied im grünen Rasen.
S’enfla si bien qu’elle creva.

Le monde est plein de gens qui ne sont pas plus sages :
Tout Bourgeois veut bâtir comme les grands Seigneurs,
Tout petit Prince a des Ambassadeurs,
Tout Marquis veut avoir des Pages.



Why lines of code is a bad metric for a programmer

There  is a long explanation over at medium

committing code is a small part of what software engineers do. There are many ways in which you can contribute technically without writing much code. In fact, the best senior engineers I know are great at prioritization, delegation, and simplifying. Their pull requests are tiny because they’ve made the code modular and straightforward. … Writing negative code is a point of pride! If you refactored a complex piece of logic, picked a good library to solve a problem, or eliminated unnecessary features, then you’ll have a negative commit history. ..  fine-tune configs, research arcane issues, and dive deep into underlying architecture. Working on these jobs can mean days of research just to make a few-line change.

The same applies to amount of funding received by a scientist (although frequently used for calculation of salariy). If I can achieve the same impact at a fraction of the costs, isn’t that much better than producing more costs?

At least one positive advice?

Is there at least one positive advice of all that Musk utterance?

  1.  Avoid large meetings
    Large meetings waste valuable time and energy – They discourage debate – People are more guarded than open – There’s not enough time for everyone to contribute. Don’t schedule large meetings unless you’re certain they provide value to everyone.
  2. Leave a meeting if you’re not contributing
    If a meeting doesn’t require your: – Input – Value – Decisions Your presence is useless. It’s not rude to leave a meeting. But it’s rude to waste people’s time.
  3. Forget the chain of command
    Communicate with colleagues directly. Not through supervisors or managers. Fast communicators make fast decisions. Fast decisions = competitive advantage.
  4.  Be clear, not clever
    Avoid nonsense words and technical jargon. It slows down communication. Choose words that are: – Concise – To the point – Easy to understand Don’t sound smart. Be efficient.
  5. Ditch frequent meetings
    There’s no better way to waste everyone’s time. Use meetings to: – Collaborate – Attack issues head-on – Solve urgent problems But once you resolve the issue, frequent meetings are no longer necessary. You can resolve most issues without a meeting. Instead of meetings: – Send a text – Send an email – Communicate on a discord or slack channel Don’t interrupt your team’s workflow if it’s unnecessary.
  6. Use common sense if a company rule doesn’t make sense
    Contribute to progress – Apply to your specific situation Avoid following the rule with your eyes closed. Don’t follow rules. Follow principles.

Warning : 2) and even other x) only suitable for slightly autistic, self obsessed and excellent scientists.



No irony allowed

Ronagh & Souder in “The ethics of ironic science

We adopt the concept of irony from the fields of literary and rhetorical criticism to detect, characterize, and analyze the interpretations in the more than 60 published research papers that cite an instance of ironic science. We find a variety of interpretations: some citing authors interpret the research as valid and accept it, some contradict or reject it, and some acknowledge its ironic nature.

bonus example 61 “Effect on human longevity of added dietary chocolate

Does identification of misconduct in studies affect medical guidelines?

This question has been answered by an earlier study of Avenell et al.

By 2016 the affected trial reports were cited in 1158 publications, including 68 systematic reviews, meta-analyses, narrative reviews, guidelines and clinical trials. We judged that 13 guidelines, systematic or other reviews would likely change their findings if the affected trial reports were removed, and in another eight it was unclear if findings would change. By 2018, only one of the 68 citing publications, a systematic review, appeared to have undertaken a reassessment, which led to a correction.
We found evidence that this group of affected trial reports distorted the evidence base. Correction of these distortions is slow, uncoordinated and inconsistent. Unless there is a rapid, systematic, coordinated approach by bibliographic databases, authors, journals and publishers to mitigate the impact of known cases of research misconduct, patients, other researchers and their funders may continue to be adversely affected.

Unsent tweets, fake tweets, true facts

A legendary tale of the dying Twitter imperium


And well, parody everywhere…



Es gibt bisher wenig gute Erklärungen der Querdenken Bewegung.

Warum verfallen Menschen auf bestimmte  Meinungen? Und was unterscheidet sie zum Beispiel von den wahnhaften Störungen in der Psychiatrie oder aber auch von Fehlschlüssen in der Wissenschaft? Irgendwie scheint sich doch alles auf einem Kontinuum zu bewegen?

Bei dem Versuch einer Antwort folge ich dabei mehr oder weniger dem Psychiater Manfred Lütz, der auch nicht viel auf unsere psychiatrischen Diagnosen gibt, da sie nur Hilfskonstruktionen sind die nur einem Zweck dienen, nämlich Menschen medizinisch zu helfen (S.32ff)

Manfred Lütz. Irre! – Wir behandeln die Falschen: Unser Problem sind die Normalen. Goldmann 2019.

Unbestrittenes Kennzeichen des Wahns ist jedenfalls die Unfähigkeit, die Perspektive zu wechseln.  Mit dieser Definition gelingen nun auch die Unterscheidungen: So sind Psychotiker und Querdenker beide unfähig, die Perspektive zu wechseln, während das den meisten Wissenschaftlern aber möglich sein sollte.

Psychotiker leiden unter dieser Unfähigkeit (zumindest im symptomfreien Intervall) während Querdenker darüber in ihrer Gemeinschaftserfahrung Bestätigung erfahren. Die “self enforcing loops” bei der Psychose sind wohl hirnorganisch  bedingt, während sie bei Querdenker eher sekundär und erlebnisreaktiv sind. Die Ideenwelt der Psychose ist kreativ, während Querdenker kaum zu neuen oder innovative Ideen in der Lage sind.

Dennoch: Querdenken sollte  nicht pathologisiert werden – Labels helfen nicht, sie verstärken nur eher den Zusammenhalt der Gruppe. Mit Wegfall von Youtube und Telegram würde die Bewegung wohl in sich zusammen fallen. Da dies nicht passierte, sucht sie sich neue Ziele etwa Russland.

Im selbst gewählten Asyl ist es dann aber mit dem Gemeinschaftserlebnis vorbei, so auch bei den zwei prominentesten Ärzteaccounts diese Woche zu sehen.

Bodo Schiffmann https://twitter.com/Tzerberus1/status/1589185591127977984
Carola Javid Kistel https://twitter.com/Alemanniel/status/1589318971769196551























Katzenjammer II

Seltsam, was gerade auf Twitter los ist wenn wir CT Bergstrom glauben, der eine Team Email von Musk geteilt hat.

putative chief twit email as distributed by CT Bergstrom https://archive.ph/ZNWIN

Es sieht so aus als sei Twitter nun in der Gewalt von einem reichen Mann, der einem pseudoreligiösen Mars Kult angehört – nachzulesen in dem aufschlussreichen Artikel von Dave Troy

This is a reference to “longtermism” the heavily marketed philosophy being promoted by Musk and his friend William MacAskill that asserts the only thing that matters is humanity’s future in space, and that the only goal of the living is to maximize the number of future humans alive, as well as the number of artificial intelligence instances that could possibly exist in the future. This mandate is most often used to brush aside calls for improving conditions and alleviating suffering among the living here on Earth now. Because, the theory goes, giving a poor person a blanket isn’t likely to be as useful for the future of humanity as building a rocket to Mars. Longtermism is heavily influenced by “Russian Cosmism” and is also directly adjacent to “Effective Altruism.” Musk’s stated mission, which he intends to fulfill in his lifetime, is to “make humanity a multiplanetary species.” The anti-democratic urge in longtermism is rooted in the belief that “mob rule” will lead to nuclear annihilation; we should, Musk thinks, be guided by “wiser” minds.




Pharma (and often also academic) research doesn’t match public health needs


There is also a review in the BMJ “Can medical product development be better aligned with global needs?

Typically, market analyses are performed by pharmaceutical companies. These analyses lead to value propositions and business cases for developing new products based on technologies those companies have either developed, or for which they have licensed intellectual property. These analyses—together with assessments of “end-user” (patient) preferences, and assessments of regulatory pathways—drive research and development (R&D) investments. In traditional for-profit product R&D, the unmet medical need is factored in only partially, including through the end-user preferences and the company’s assessment of likely regulatory authority perspectives. In some cases, governments or multilateral agencies can be large scale procurers (i.e., they will purchase the product), and in this situation their preferences may be given more weight.
However, at present, only a small proportion of global health R&D spending (around 2%) is on the compelling medical problems faced by LMICs.