My doctoral project required me to learn a whole new method from zero. My advisor had another student who mastered the technique since his BA studies, and so was much more advanced than me. I asked this student several times to share his code with me, but he claimed that his research was "classified" (No, it was not), so he is not allowed to share it. Now his papers are published in open access journals under the statement

Scripts using the R and MATLAB programming language are provided to produce figures and extract data from external databases. Additional code and related files are available from the corresponding author (him) upon request.

Only that now he is ignoring my emails.

Is there anything I can do? The truth is I want to use his codes simply because I want to learn from him.

  • 1
    You should discuss this with your advisor and have them determine the best approach. Feb 13, 2022 at 14:40
  • Yes, I've considered doing this. I'll try to write to him once again and, if still no reply, I'll ask our advisor
    – Uri
    Feb 13, 2022 at 16:50
  • 2
    I wouldn't share my code if I expect you to learn the basics, or that giving you my code means I now have to spend time teaching you. I had students asking me for source code so that they can complete their assignment. I suggest that you learn to code the method yourself, and only ask for specific advice or missing steps or tips when you are truly stuck. Do not ask for the whole source code. Feb 13, 2022 at 22:00
  • 1
    @Prof.SantaClaus some people including myself can learn by reading code. Feb 13, 2022 at 22:49
  • @FranckDernoncourt sure. Many students prefer to do that because that's what they are familiar with. For example, in my area, most concepts are described mathematically, and students prefer to read source code as opposed to mathematics. However, from my perspective, they cannot run away from mathematics. Feb 13, 2022 at 23:15

2 Answers 2


Here are the typical steps to follow until you got the code:

  1. Email the student who has the code. Send a reminder after a few days.
  2. Email the student who has the code and CC the student's advisor and/or co-authors. Send a reminder after a few days.
  3. If you can meet either student or better the student's advisor face-to-face, try it.
  4. If none of the co-authors is your advisor or close to you, email the journal to raise a formal complaint that the author didn't send you the code. Attach your previous emails to the student who has the code as a proof. If one of the co-authors is your advisor or close to you, explain the situation and get them to put pressure on the student who has the code, to comply with the open access requirement of the journal.

That should resolve the issue in most cases.


His papers are published in open access journals.

Note that "open access journal" doesn't entail open source code. Neither the journal nor the student who has the code has any legal obligation to share their code (unless some special cases, e.g. if the student's funding agency forces them to do so in their funding clauses).

  • 1
    Step 4 is interesting; would a journal be obligated to intervene in such a case? Especially because the complainant can't attach proof of not having received the code (only of having asked). This would mean that the journal needs to arbitrate and spend resources on ascertaining if the code has been shared in full etc. Feb 13, 2022 at 22:18
  • 1
    @AppliedAcademic no legal obligation, but it's rather fast for them to email the authors with complainant in CC asking for the code. At the end of the day, the student who has the code has no legal obligation to share their code (unless some special cases eg if their funding forces them to do so). Feb 13, 2022 at 22:29
  • 4
    +1 for open access journal doesn't entail open source code
    – enthu
    Feb 13, 2022 at 22:46
  • Makes sense. This would not be grounds for the journal to issue a retraction, IMO. Feb 13, 2022 at 22:59
  • Thanks a lot! Indeed, I prefer not to write to the journals, and also not to get our advisor involved. Pay attention that he is signed on "Additional code and related files are available from the corresponding author (him) upon request.". That means he is suppose to share it if requested
    – Uri
    Feb 14, 2022 at 8:03

I interpret the question as "I need code to do stuff, how?".

  • The classic option, the one that you are doomed to use if everything fails, and the way things were before open code repositories, is: just hire / take a BSc student. They would need to implement that thing from scratch using papers / books on the topic as a part of their job / BSc thesis.
  • Ask the PI on the project / the corresponding author of the paper, if they would share the code with you. They might not agree. I am sure, other answers will detail on the open access and availability bit, I suspect some internal shenanigans.

Basically asking for code is not the best way to do it in my opinion. You do not want to study the code, you want to do stuff, right? Then ask about it. There are multiple options.

  • "I need your code, because I want to understand how it works / reproduce the results in the paper." That's what the availability thing is for, officially.
  • "I want to build upon your code to produce new research results." This is the most favourable version. Mostly implied with it (but it does not hurt to state it explicitly) is: "you get to be a coauthor on the new paper".
  • "I want to apply your method to my data and to use the results in my paper." It is a milder version of the above. Some authors are not inclined / not allowed to give the code to anyone. (This behaviour becomes less frequent, for good, but is still present.) Still, they might be interested in a collaboration. A possibility is to give them your data (if you, on your end, are comfortable with it), let them process it, obtain the results. Again, it implies "you get to be a coauthor", as they do work for your new paper.
  • "I want to compare your method to mine." It is a valid concern, in most of the cases it produces just a citation of the others' paper.
  • "I want to do some statistics / automatic code analysis on your code." That's a citation, I'd say.

I'd say that people are in generic more inclined to provide data or to collaborate on one of the above terms that are more exact and clear than just "let me see your code".

I would assume that the most frequent "fears" that lead to not giving code to other people are: "they might 'steal' it" – i.e., an idea that someone would build upon your code and not acknowledge you; and "legal" limitations, ranging from "I have transferred the copyright to my research unit and they don't share" to "my supervisor said 'no'". (Again, I am not discussing here, how the data availability statement of the publication agrees with those.)

  • 1
    Thanks a lot for your detailed answer. The actual email I recently sent him said "I actually try to learn from you, and this could be a huge help". He is just not willing to share. During all these years I made it very clear that all I want is to learn from him.
    – Uri
    Feb 13, 2022 at 13:00
  • 1
    You are welcome. Well, you'd get code from me with such a mail, but it's little you can do, if they do not agree. The big gun of the availability statement might help, but it is not the focus of my answer. Feb 13, 2022 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .