<p>I'm a bit late to answer this question, but we've developed pretty much exactly the system you describe, based on Git and git-annex.
Its called DataLad, free and open source software, and currently mostly known within the neurosciences.</p>
<p>DataLad's core data structure are DataLad datasets: Git repositories with an optional annex for large or private data. Within a dataset, code and data can be version controlled in conjunction.
You can stick to Git and git-annex commands for handling the dataset, but DataLad also offers a core API that aims to harmonize and simplify version control operations. For example, in a dataset configured according to your preferences, a <code>datalad save</code> commits a file based on name (glob), file type, size, or location into either Git or git-annex (instead of <code>git add</code>, <code>git annex add</code>, and <code>git commit</code>). And likewise, a <code>datalad push</code> can push Git history and annexed data to your clones (instead of <code>git push</code> and <code>git-annex sync</code>). Everything is completely decentral, and DataLad integrates via git-annex special remote mechanism with a variety of hosting providers (S3, OSF, DropBox, ...), where you could store data if you like. A high level overview is here: <a href="http://handbook.datalad.org/r.html?about" rel="nofollow noreferrer">handbook.datalad.org/r.html?about</a></p>
<blockquote>
<p>Unfortunately it seems it does not work well with the large number of files. Often I have more that 10k small files in my analysis. There are some tricks to improve indexing, but it doesn't solve the issue. What I need is one symlink representing the full contents of directory.</p>
</blockquote>
<p>DataLad overcomes this issue by using Git's submodule mechanishm. Datasets can nested, and operated on recursively (to preserver a monorepo-like feel). With this mechanism, we've for example exposed the human connectome project dataset (80TB, 15 million files) to GitHub: <a href="https://github.com/datalad-datasets/human-connectome-project-openaccess" rel="nofollow noreferrer">github.com/datalad-datasets/human-connectome-project-openaccess</a></p>

CC BY-SA 4.0
2021-06-26T15:03:02.943Z
Wow, this sounds awesome! Is there some kind of a cleanup mechanism available? E.g., the intermediate data is not needed anymore is it possible to delete it permanently?
Iakov Davydov
CC BY-SA 4.0
2021-06-30T10:03:02.650Z
You could use the `git-annex dropunused` command for this to automatically remove data that isn't referenced anymore: https://git-annex.branchable.com/git-annex-dropunused/. Or, use `datalad drop` / `git annex drop` on any annexed files of your choice to remove them permanently.
adswa
CC BY-SA 4.0
2021-06-25T13:18:25.937Z
2021-06-25T13:18:25.937Z
adswa
<p>There is a couple of points to consider here, which I outline below. The goal here should be to find a workflow that is minimally intrusive on top of already using <code>git</code>.</p>

<p>As of yet, there is no ideal workflow that covers all use cases, but what I outline below is the closest I could come to it.</p>

<h3>Reproducibility is not just keeping all your data</h3>

<p>You have got your raw data that you start your project with.</p>

<p>All other data in your project directory should never just "be there", but have some record of where it comes from. Data processing scripts are great for this, because they <em>already document how</em> you went from your raw to your analytical data, and then the files needed for your analyses.</p>

<p>And those scripts can be versioned, with an appropriate single entry point of processing (e.g. a <code>Makefile</code> that describes how to run your scripts).</p>

<p>This way, the state of all your project files is defined by the raw data, and the version of your processing scripts (and versions of external software, but that's a whole different kind of problem).</p>

<h3>What data/code should and should not be versioned</h3>

<p>Just as you would not version generated code files, you should not want to version 10k intermediary data files that you produced when performing your analyses. The data that <em>should be</em> versioned is your <em>raw data</em> (at the start of your pipeline), not automatically generated files.</p>

<p>You might want to take snapshots of your project directory, but not keep every version of every file ever produced. This already cuts down your problem by a fair margin.</p>

<h3>Approach 1: Actual versioning of data</h3>

<p>For your <strong>raw or analytical data</strong>, <a href="https://git-lfs.github.com/" rel="noreferrer">Git LFS</a> (and alternatively <a href="https://git-annex.branchable.com/" rel="noreferrer">Git Annex</a>, that you already mention) is designed to solve exactly this problem: add tracking information of files in your Git tree, but do not store the content of those files in the repository (because otherwise it would add the size of a non-diffable file with every change you make).</p>

<p>For your <strong>intermediate files</strong>, you do the same as you would do with intermediate code files: add them to your <code>.gitignore</code> and do not version them.</p>

<p>This begs a couple of considerations:</p>

<ul>
<li>Git LFS is a paid service from Github (the free tier is limited to 1 GB of storage/bandwidth per month, which is very little), and it is more expensive than other comparable cloud storage solutions. You could consider paying for the storage at Github or running your own LFS server (there is a reference implementation, but I assume this would still be a substantial effort)</li>
<li>Git Annex is free, but it replaces files by links and hence changes time stamps, which is a problem for e.g. GNU Make based workflows (major drawback for me). Also, fetching of files needs to be done manually or via a commit hook</li>
</ul>

<h3>Approach 2: Versioning code only, syncing data</h3>

<p>If your analytical data stays the same for most of your analyses, so the actual need to version it (as opposed to back up and document data provenance, which is essential) may be limited.</p>

<p>The key to get this this working is to put all <strong>data files</strong> in your <code>.gitignore</code> and ignore all your <strong>code files</strong> in <code>rsync</code>, with a script in your project root (extensions and directories are an example only):</p>

<pre><code>#!/bin/bash
cd $(dirname $0)
rsync -auvr \
    --exclude "*.r" \
    --include "*.RData" \
    --exclude "dir with huge files that you don't need locally" \
    yourhost:/your/project/path/* .
</code></pre>

<p>The advantage here is that you don't need to remember the <code>rsync</code> command you are running. The script itself goes into version control.</p>

<p>This is especially useful if you do your heavy processing on a computing cluster but want to make plots from your result files on your local machine. I argue that you <em>generally don't need</em> bidirectional sync.</p>

CC BY-SA 3.0
2017-05-18T17:11:45.237Z
By the way you can use file hash instead of timestamp at least in biomake (doi: 10.1093/bioinformatics/btx306).
Iakov Davydov
CC BY-SA 3.0
2017-05-18T18:12:33.017Z
@IakovDavydov I'm aware of this, but I haven't actually tried if it works
Michael Schubert
CC BY-SA 3.0
2017-05-19T12:33:52.360Z
+1 for all the modification on the raw data should be documented +1 for the file hash. I am a big fan of literate programming myself and I also took advantage of that approach to document the version of my tools/packages I used for the analysis and the hash of the raw data. Hence, when I see a result or a plot I also have its context of production.
Mitra
CC BY-SA 3.0
2017-05-18T16:57:57.520Z
2017-05-18T16:57:57.520Z
Michael Schubert
<p>Your question is somewhat open, but I think it could prove an interesting discussion. I don't believe in many cases it is worth storing the data you have created in <code>git</code>. As you've noted, it isn't designed for large files (although we have <code>git-lfs</code>) and it's definitely not designed for binary formats such as <code>BAM</code>.</p>

<p>I'm of the opinion that <code>how</code> a file was created and <code>what</code> has been done to it since is key. Large files that took much effort to create should be mirrored somewhere (but not necessarily in a version control system). Other less-important (or less difficult to create) files that have been lost, clobbered or otherwise tainted can be regenerated as long as you know how they came to be.</p>

<p>For what it's worth, I've been working on <a href="https://github.com/SamStudio8/chitin/" rel="noreferrer">a piece of software called <code>chitin</code></a> (self described as a shell for disorganised bioinformaticians). I also wrote <a href="https://samnicholls.net/2016/11/16/disorganised-disaster/" rel="noreferrer">a long blog post</a> on why I thought this was a necessary project for me, but the main reason was that despite my attempts to organise my filesystem and make good archives of my experiments, over time I forget what my shorthand directory names meant, or exactly what program generated which data.</p>

<p><code>chitin</code>'s goal is to automatically capture changes made to the file system during the execution of a command. It knows what commands to run to re-create a particular file, what commands have used that file and can tell you when and why that file was changed (and by who ;) too).</p>

<p>It's not finished (nothing ever is), but I feel that you might be going down the wrong road by wanting to store all your data and its versions when really, I think most people just want to know the commands that instigated changes. If the data history is important (and your code is well versioned), then you can simply check out any commit and execute your analysis to re-generate data.</p>

CC BY-SA 3.0
2017-05-18T17:01:53.710Z
I'm sorry but I'm downvoting this. Interesting discussion point, but not answering the OP's question.
Michael Schubert
CC BY-SA 3.0
2017-05-18T09:51:51.780Z
2017-05-18T09:51:51.780Z
Sam Nicholls
<p>The Open Science Framework uses versioning for all files and is free to use: <a href="https://osf.io" rel="noreferrer">https://osf.io</a></p>

<p>You can integrate data or code from various sources such as github, dropbox, google drive, figshare or amazon cloud</p>

<p>You can also store files on their server using OSF data storage, but I do not know exactly what the file size limit is.</p>

CC BY-SA 3.0
2017-05-18T12:46:12.660Z
2017-05-18T12:46:12.660Z
H. Gourlé
<p>The way we deal with this is:</p>

<ul>
<li>All work is done in a single filesystem mounted on the cluster</li>
<li>This file system is mounted on local machines via sshfs/samba (depending on the location of the current "local" machine on the network).</li>
<li>Code is versioned with git hub</li>
<li>All computation is carried out via light-weight automated pipelines. We use ruffus in combination with an in-house utility layer. The system doesn't really matter as long is it no more work to add another step to the pipeline than it would be to execute it manually. </li>
<li>All questionably design decisions are encoded in configuration files. These configuration files, along with a very detailed log output by the pipeline (what was run, what was the git commit of the code run, what was the time stamp of the files it was run on, etc) and the initial input files are version controlled.</li>
<li>The benefit of this is that code + configuration + time = output. It is not expected that the whole pipeline will be rerun everytime anything is changed, but the pipeline will tell you if something is out of date (it can use timestamps or file hashes), and it can all be run in one go before publication.</li>
<li>Any other analysis is carried out in juptyer notebooks. These are version controlled.</li>
</ul>

<p>To summarise, we don't synchronise because we only ever work from one disk location even if we use multiple CPU locations. We version control:</p>

<ul>
<li>Code</li>
<li>Inputs, configuration, logs</li>
<li>Juptyer notebooks</li>
</ul>

<p>Log records the git commits used to produce the current outputs. </p>

CC BY-SA 3.0
2017-05-19T17:54:21.807Z
Interesting Ian, this is the sort of design I aspire to, but don't really follow into practice. I'm intrigued by this in-house layer on top of ruffus, what is it?
Chris_Rands
CC BY-SA 3.0
2017-05-20T00:07:13.163Z
The trick is to make writing a pipeline task easier than a cluster job submission script. The utilitiy layer is provided by CGATPipelines (www.github.com/CGATOxford/CGATPipelines)
Ian Sudbery
CC BY-SA 3.0
2017-05-19T09:33:58.507Z
2017-05-19T09:33:58.507Z
Ian Sudbery
<p>Using Git for version-controlling code is a good practice, but it does not lend itself well to versioning large data files.  Manually syncing data across multiple nodes is asking for trouble, you want this syncing to either be handled automatically in a managed environment, or just keep the files on a single network-attached storage device.</p>

<p>One tool you might want to look into is <a href="https://arvados.org/" rel="nofollow noreferrer">Arvados</a>, which is designed for syncing bioinformatics data and workflows across multiple machines.  From the project website:</p>

<blockquote>
  <p>Arvados is a platform for storing, organizing, processing, and sharing genomic and other big data. The platform is designed to make it easier for data scientists to develop analyses, developers to create genomic web applications and IT administers to manage large-scale compute and storage genomic resources. The platform is designed to run in the cloud or on your own hardware.</p>
</blockquote>

CC BY-SA 3.0
2017-05-18T21:42:50.367Z
I would only use Arvados if it really got much better than it was before.
nuin
CC BY-SA 3.0
2017-05-19T13:15:56.053Z
@nuin: What specifically do you think was lacking and/or would make it not appropriate as a solution to OP's problem?
woemler
CC BY-SA 3.0
2017-05-19T14:58:39.450Z
@woemier I haven't tried it lately, and I if I remember correctly it was a PITA to setup and run simple things. But as I said, don't know if got better.
nuin
CC BY-SA 3.0
2017-05-18T13:44:31.117Z
2017-05-18T13:44:31.117Z
woemler
<p>This answer will sort of only cover the big data parts, i.e. things > 100MB ish, and only if your analysis pipeline ties in with the Python ecosystem. It will require a bit of learning</p>

<p>Try using <a href="https://quiltdata.com/" rel="nofollow noreferrer">quilt</a> which is sort of like 'docker for data' (<a href="https://github.com/quiltdata/quilt" rel="nofollow noreferrer">Github page</a>).</p>

<pre><code>$ pip install quilt
$ quilt install uciml/iris -x da2b6f5  #note the short hash
$ python
&gt;&gt;&gt; from quilt.data.uciml import iris
# you've got data
</code></pre>

<p>Pros:</p>

<ul>
<li>There doesn't seem to be a filesize limit for public packages (haven't stress tested this though)</li>
<li>Hashes your data to ensure reproducibility</li>
<li>Support for versioning and tags</li>
</ul>

<p>Cons:</p>

<ul>
<li>Storing private data starts from $7 per user / month up to 1TB of data</li>
<li>Pretty much Python only at this point, with some community <a href="https://github.com/stillmatic/quiltr" rel="nofollow noreferrer">support for R</a></li>
</ul>

<p>More information <a href="https://blog.jupyter.org/reproducible-data-dependencies-for-python-guest-post-d0f68293a99" rel="nofollow noreferrer">here</a>.</p>

CC BY-SA 3.0
2018-03-27T03:17:13.147Z
2018-03-27T07:43:04.027Z
2018-03-27T07:43:04.027Z
weiji14
<p>First of all, kudos to you for taking versioning seriously. The fact that you're mindful of this issue is a good sign that you want to do responsible research!</p>

<p>For many bioinformatics projects, data files are so large that versioning the data directly with a tool like git is impractical. But your question is really getting at a couple of different issues.</p>

<ul>
<li><em>How do I do my research reproducibly, and show full provenance for each data point and result I produce?</em></li>
<li><em>How do I manage and synchronize my research work across multiple machines?</em></li>
</ul>

<p><strong>The short answer</strong>:</p>

<ul>
<li>Archive the primary data.</li>
<li>Place your workflow under version control.</li>
<li>Version checksums of large data files.</li>
<li>Use GitHub to synchronize your workflow between machines.</li>
</ul>

<hr>

<p><strong>The long answer</strong>:</p>

<h2>Archive the primary data</h2>

<p>As far as reproducibility is concerned, what matters most is the primary data: the raw, unprocessed data you collect from the instrument. If you are analyzing data that has been published by others, then write a script that will automate the task of downloading the data from its primary official source, and place that script under version control.</p>

<p>If you or a lab mate or a colleague produced the data and it is not yet published, then you should already have plans for submitting it to an archive. Indeed, most journals and funding agencies now require this prior to publication. I'd even go so far as to say the data should be submitted as soon as it's collected. Scientists worry a lot about having their data stolen and their ideas scooped, but statistically speaking, getting scooped is much less likely than nobody ever touching your data or reading your paper. But if you or an advisor insists, most data archives allow you to keep data private for an extended period of time until a supporting manuscript is published.</p>

<p>Putting (for example) Fastq files in a git repository is a bad idea for a lot of reasons. No hosting service will support files that big, git will be very slow with files that big, but most importantly git/GitHub is not archival! Use a proper data archive!</p>

<h2>Place your workflow under version control</h2>

<p>Treat your raw data as read-only. Only process the raw data using scripts, and keep these scripts under version control. Vince Buffalo describes this well in his book <a href="http://shop.oreilly.com/product/0636920030157.do" rel="noreferrer">Bioinformatics Data Skills</a>. Check it out!</p>

<h2>Version checksums of large data files</h2>

<p>If there are any data files that you want to track but are too big to place under version control, compute checksums and place <em>these</em> under version control. Checksums are very small alphanumeric strings that are, for all practical purposes, unique for each data file. So instead of putting that 5GB trimmed Fastq file or the 7GB BAM file under version control, compute their checksums and put the <em>checksums</em> under version control. The checksums won't tell you the contents of your files, but they can tell you when the file contents change.</p>

<p>This should give full disclosure and complete provenance for every data point in your analysis. The workflow has a scripts/command for downloading the primary data, scripts/commands for processing the data, and checksums that serve as a signature to validate intermediate and final output files. With this, anyone should be able to reproduce you analysis!</p>

<h2>Use GitHub to synchronize your workflow between machines</h2>

<p>If your workflow is already under version control with git, it's trivial to push this to a hosting service like GitHub, GitLab, or BitBucket. Then it's just a matter of using <code>git push</code> and <code>git pull</code> to keep your code up-to-date on your various machines.</p>

CC BY-SA 3.0
2017-05-21T07:27:58.337Z
2017-05-21T07:27:58.337Z
Daniel Standage
<p>I am currently looking for a system which will allow me to version both the code and the data in my research.</p>

<p>I think my way of analyzing data is not uncommon, and this will be useful for many people doing bioinformatics and aiming for the reproducibility.</p>

<p>Here are the requrements:</p>

<ul>
<li>Analysis is performed on multiple machines (local, cluster, server).</li>
<li>All the code is transparently synchronized between the machines.</li>
<li>Source code versioning.</li>
<li>Generated data versioning.</li>
<li>Support for large number of small generated files (>10k). These also could be deleted.</li>
<li>Support for large files (>1Gb). At some point old generated files can  permanently deleted. It would be insane to have <em>transparent</em> synchronization of those, but being able to synchronize them on demand would be nice.</li>
</ul>

<p>So far I am using <strong>git</strong> + rsync/scp. But there are several downsides to it.</p>

<ul>
<li>Synchronization between multiple machines is a bit tedious, i.e. you have to git pull before you start working and git push after each update. I can live with that.</li>
<li>You are not supposed to store large generated data files or large number of files inside your repository.</li>
<li>Therefore I have to synchronize data files manually using rsync, which is error prone.</li>
</ul>

<p>There is something called <a href="https://git-annex.branchable.com/" rel="noreferrer">git annex</a>. It seems really close to what I need. But:</p>

<ul>
<li>A bit more work than git, but that's ok.</li>
<li>Unfortunately it seems it does not work well with the large number of files. Often I have more that 10k small files in my analysis. There are some tricks to <a href="http://git-annex.branchable.com/tips/Repositories_with_large_number_of_files/" rel="noreferrer">improve indexing</a>, but it doesn't solve the issue. What I need is one symlink representing the full contents of directory.</li>
</ul>

<p>One potential solution is to use Dropbox or something similar (like <a href="https://syncthing.net/" rel="noreferrer">syncthing</a>) in combination with git. But the downside is there will be no connection between the source code version and the data version.</p>

<p>Is there any versioning system for the code and the data meeting the requirements you can recommend?</p>

<reproducibility><data-management><git>
How to version the code and the data during the analysis?
# How to version the code and the data during the analysis?

(Asked by: username_0 on 2017-05-18)

I am currently looking for a system which will allow me to version both the code and the data in my research.

I think my way of analyzing data is not uncommon, and this will be useful for many people doing bioinformatics and aiming for the reproducibility.

Here are the requrements:

* Analysis is performed on multiple machines (local, cluster, server).
* All the code is transparently synchronized between the machines.
* Source code versioning.
* Generated data versioning.
* Support for large number of small generated files (>10k). These also could be deleted.
* Support for large files (>1Gb). At some point old generated files can permanently deleted. It would be insane to have *transparent* synchronization of those, but being able to synchronize them on demand would be nice.

So far I am using **git** + rsync/scp. But there are several downsides to it.

* Synchronization between multiple machines is a bit tedious, i.e. you have to git pull before you start working and git push after each update. I can live with that.
* You are not supposed to store large generated data files or large number of files inside your repository.
* Therefore I have to synchronize data files manually using rsync, which is error prone.

There is something called [git annex](https://git-annex.branchable.com/). It seems really close to what I need. But:

* A bit more work than git, but that's ok.
* Unfortunately it seems it does not work well with the large number of files. Often I have more that 10k small files in my analysis. There are some tricks to [improve indexing](http://git-annex.branchable.com/tips/Repositories_with_large_number_of_files/), but it doesn't solve the issue. What I need is one symlink representing the full contents of directory.

One potential solution is to use Dropbox or something similar (like [syncthing](https://syncthing.net/)) in combination with git. But the downside is there will be no connection between the source code version and the data version.

Is there any versioning system for the code and the data meeting the requirements you can recommend?

**Tags:** reproducibility, data-management, git

---

## 8 answers

### Answer by username_1 on 2021-06-25. Score: 2 | Accepted answer

I'm a bit late to answer this question, but we've developed pretty much exactly the system you describe, based on Git and git-annex.
Its called DataLad, free and open source software, and currently mostly known within the neurosciences.

DataLad's core data structure are DataLad datasets: Git repositories with an optional annex for large or private data. Within a dataset, code and data can be version controlled in conjunction.
You can stick to Git and git-annex commands for handling the dataset, but DataLad also offers a core API that aims to harmonize and simplify version control operations. For example, in a dataset configured according to your preferences, a `datalad save` commits a file based on name (glob), file type, size, or location into either Git or git-annex (instead of `git add`, `git annex add`, and `git commit`). And likewise, a `datalad push` can push Git history and annexed data to your clones (instead of `git push` and `git-annex sync`). Everything is completely decentral, and DataLad integrates via git-annex special remote mechanism with a variety of hosting providers (S3, OSF, DropBox, ...), where you could store data if you like. A high level overview is here: [handbook.datalad.org/r.html?about](http://handbook.datalad.org/r.html?about)

> Unfortunately it seems it does not work well with the large number of files. Often I have more that 10k small files in my analysis. There are some tricks to improve indexing, but it doesn't solve the issue. What I need is one symlink representing the full contents of directory.

DataLad overcomes this issue by using Git's submodule mechanishm. Datasets can nested, and operated on recursively (to preserver a monorepo-like feel). With this mechanism, we've for example exposed the human connectome project dataset (80TB, 15 million files) to GitHub: [github.com/datalad-datasets/human-connectome-project-openaccess](https://github.com/datalad-datasets/human-connectome-project-openaccess)

> **Comments:**
> **username_0**: Wow, this sounds awesome! Is there some kind of a cleanup mechanism available? E.g., the intermediate data is not needed anymore is it possible to delete it permanently?  
> **username_1**: You could use the `git-annex dropunused` command for this to automatically remove data that isn't referenced anymore: https://git-annex.branchable.com/git-annex-dropunused/. Or, use `datalad drop` / `git annex drop` on any annexed files of your choice to remove them permanently.  

---

### Answer by username_2 on 2017-05-18. Score: 15

There is a couple of points to consider here, which I outline below. The goal here should be to find a workflow that is minimally intrusive on top of already using git.
As of yet, there is no ideal workflow that covers all use cases, but what I outline below is the closest I could come to it.
Reproducibility is not just keeping all your data
You have got your raw data that you start your project with.
All other data in your project directory should never just "be there", but have some record of where it comes from. Data processing scripts are great for this, because they already document how you went from your raw to your analytical data, and then the files needed for your analyses.
And those scripts can be versioned, with an appropriate single entry point of processing (e.g. a Makefile that describes how to run your scripts).
This way, the state of all your project files is defined by the raw data, and the version of your processing scripts (and versions of external software, but that's a whole different kind of problem).
What data/code should and should not be versioned
Just as you would not version generated code files, you should not want to version 10k intermediary data files that you produced when performing your analyses. The data that should be versioned is your raw data (at the start of your pipeline), not automatically generated files.
You might want to take snapshots of your project directory, but not keep every version of every file ever produced. This already cuts down your problem by a fair margin.
Approach 1: Actual versioning of data
For your raw or analytical data, Git LFS (and alternatively Git Annex, that you already mention) is designed to solve exactly this problem: add tracking information of files in your Git tree, but do not store the content of those files in the repository (because otherwise it would add the size of a non-diffable file with every change you make).
For your intermediate files, you do the same as you would do with intermediate code files: add them to your .gitignore and do not version them.
This begs a couple of considerations:

Git LFS is a paid service from Github (the free tier is limited to 1 GB of storage/bandwidth per month, which is very little), and it is more expensive than other comparable cloud storage solutions. You could consider paying for the storage at Github or running your own LFS server (there is a reference implementation, but I assume this would still be a substantial effort)
Git Annex is free, but it replaces files by links and hence changes time stamps, which is a problem for e.g. GNU Make based workflows (major drawback for me). Also, fetching of files needs to be done manually or via a commit hook

Approach 2: Versioning code only, syncing data
If your analytical data stays the same for most of your analyses, so the actual need to version it (as opposed to back up and document data provenance, which is essential) may be limited.
The key to get this this working is to put all data files in your .gitignore and ignore all your code files in rsync, with a script in your project root (extensions and directories are an example only):
#!/bin/bash
cd $(dirname $0)
rsync -auvr \
    --exclude "*.r" \
    --include "*.RData" \
    --exclude "dir with huge files that you don't need locally" \
    yourhost:/your/project/path/* .

The advantage here is that you don't need to remember the rsync command you are running. The script itself goes into version control.
This is especially useful if you do your heavy processing on a computing cluster but want to make plots from your result files on your local machine. I argue that you generally don't need bidirectional sync.

> **Comments:**
> **username_0**: By the way you can use file hash instead of timestamp at least in biomake (doi: 10.1093/bioinformatics/btx306).  
> **username_2**: @IakovDavydov I'm aware of this, but I haven't actually tried if it works  
> **username_3**: +1 for all the modification on the raw data should be documented +1 for the file hash. I am a big fan of literate programming myself and I also took advantage of that approach to document the version of my tools/packages I used for the analysis and the hash of the raw data. Hence, when I see a result or a plot I also have its context of production.  

---

### Answer by username_4 on 2017-05-18. Score: 10

Your question is somewhat open, but I think it could prove an interesting discussion. I don't believe in many cases it is worth storing the data you have created in `git`. As you've noted, it isn't designed for large files (although we have `git-lfs`) and it's definitely not designed for binary formats such as `BAM`.

I'm of the opinion that `how` a file was created and `what` has been done to it since is key. Large files that took much effort to create should be mirrored somewhere (but not necessarily in a version control system). Other less-important (or less difficult to create) files that have been lost, clobbered or otherwise tainted can be regenerated as long as you know how they came to be.

For what it's worth, I've been working on [a piece of software called `chitin`](https://github.com/SamStudio8/chitin/) (self described as a shell for disorganised bioinformaticians). I also wrote [a long blog post](https://samnicholls.net/2016/11/16/disorganised-disaster/) on why I thought this was a necessary project for me, but the main reason was that despite my attempts to organise my filesystem and make good archives of my experiments, over time I forget what my shorthand directory names meant, or exactly what program generated which data.

`chitin`'s goal is to automatically capture changes made to the file system during the execution of a command. It knows what commands to run to re-create a particular file, what commands have used that file and can tell you when and why that file was changed (and by who ;) too).

It's not finished (nothing ever is), but I feel that you might be going down the wrong road by wanting to store all your data and its versions when really, I think most people just want to know the commands that instigated changes. If the data history is important (and your code is well versioned), then you can simply check out any commit and execute your analysis to re-generate data.

> **Comments:**
> **username_2**: I'm sorry but I'm downvoting this. Interesting discussion point, but not answering the OP's question.  

---

### Answer by username_11 on 2017-05-21. Score: 6

First of all, kudos to you for taking versioning seriously. The fact that you're mindful of this issue is a good sign that you want to do responsible research!

For many bioinformatics projects, data files are so large that versioning the data directly with a tool like git is impractical. But your question is really getting at a couple of different issues.

* *How do I do my research reproducibly, and show full provenance for each data point and result I produce?*
* *How do I manage and synchronize my research work across multiple machines?*

**The short answer**:

* Archive the primary data.
* Place your workflow under version control.
* Version checksums of large data files.
* Use GitHub to synchronize your workflow between machines.

---

**The long answer**:

## Archive the primary data

As far as reproducibility is concerned, what matters most is the primary data: the raw, unprocessed data you collect from the instrument. If you are analyzing data that has been published by others, then write a script that will automate the task of downloading the data from its primary official source, and place that script under version control.

If you or a lab mate or a colleague produced the data and it is not yet published, then you should already have plans for submitting it to an archive. Indeed, most journals and funding agencies now require this prior to publication. I'd even go so far as to say the data should be submitted as soon as it's collected. Scientists worry a lot about having their data stolen and their ideas scooped, but statistically speaking, getting scooped is much less likely than nobody ever touching your data or reading your paper. But if you or an advisor insists, most data archives allow you to keep data private for an extended period of time until a supporting manuscript is published.

Putting (for example) Fastq files in a git repository is a bad idea for a lot of reasons. No hosting service will support files that big, git will be very slow with files that big, but most importantly git/GitHub is not archival! Use a proper data archive!

## Place your workflow under version control

Treat your raw data as read-only. Only process the raw data using scripts, and keep these scripts under version control. Vince Buffalo describes this well in his book [Bioinformatics Data Skills](http://shop.oreilly.com/product/0636920030157.do). Check it out!

## Version checksums of large data files

If there are any data files that you want to track but are too big to place under version control, compute checksums and place *these* under version control. Checksums are very small alphanumeric strings that are, for all practical purposes, unique for each data file. So instead of putting that 5GB trimmed Fastq file or the 7GB BAM file under version control, compute their checksums and put the *checksums* under version control. The checksums won't tell you the contents of your files, but they can tell you when the file contents change.

This should give full disclosure and complete provenance for every data point in your analysis. The workflow has a scripts/command for downloading the primary data, scripts/commands for processing the data, and checksums that serve as a signature to validate intermediate and final output files. With this, anyone should be able to reproduce you analysis!

## Use GitHub to synchronize your workflow between machines

If your workflow is already under version control with git, it's trivial to push this to a hosting service like GitHub, GitLab, or BitBucket. Then it's just a matter of using `git push` and `git pull` to keep your code up-to-date on your various machines.


---

### Answer by username_5 on 2017-05-18. Score: 5

The Open Science Framework uses versioning for all files and is free to use: <https://osf.io>

You can integrate data or code from various sources such as github, dropbox, google drive, figshare or amazon cloud

You can also store files on their server using OSF data storage, but I do not know exactly what the file size limit is.


---

### Answer by username_6 on 2017-05-19. Score: 4

The way we deal with this is:

* All work is done in a single filesystem mounted on the cluster
* This file system is mounted on local machines via sshfs/samba (depending on the location of the current "local" machine on the network).
* Code is versioned with git hub
* All computation is carried out via light-weight automated pipelines. We use ruffus in combination with an in-house utility layer. The system doesn't really matter as long is it no more work to add another step to the pipeline than it would be to execute it manually.
* All questionably design decisions are encoded in configuration files. These configuration files, along with a very detailed log output by the pipeline (what was run, what was the git commit of the code run, what was the time stamp of the files it was run on, etc) and the initial input files are version controlled.
* The benefit of this is that code + configuration + time = output. It is not expected that the whole pipeline will be rerun everytime anything is changed, but the pipeline will tell you if something is out of date (it can use timestamps or file hashes), and it can all be run in one go before publication.
* Any other analysis is carried out in juptyer notebooks. These are version controlled.

To summarise, we don't synchronise because we only ever work from one disk location even if we use multiple CPU locations. We version control:

* Code
* Inputs, configuration, logs
* Juptyer notebooks

Log records the git commits used to produce the current outputs.

> **Comments:**
> **username_7**: Interesting Ian, this is the sort of design I aspire to, but don't really follow into practice. I'm intrigued by this in-house layer on top of ruffus, what is it?  
> **username_6**: The trick is to make writing a pipeline task easier than a cluster job submission script. The utilitiy layer is provided by CGATPipelines (www.github.com/CGATOxford/CGATPipelines)  

---

### Answer by username_8 on 2017-05-18. Score: 3

Using Git for version-controlling code is a good practice, but it does not lend itself well to versioning large data files. Manually syncing data across multiple nodes is asking for trouble, you want this syncing to either be handled automatically in a managed environment, or just keep the files on a single network-attached storage device.

One tool you might want to look into is [Arvados](https://arvados.org/), which is designed for syncing bioinformatics data and workflows across multiple machines. From the project website:

> Arvados is a platform for storing, organizing, processing, and sharing genomic and other big data. The platform is designed to make it easier for data scientists to develop analyses, developers to create genomic web applications and IT administers to manage large-scale compute and storage genomic resources. The platform is designed to run in the cloud or on your own hardware.

> **Comments:**
> **username_9**: I would only use Arvados if it really got much better than it was before.  
> **username_8**: @nuin: What specifically do you think was lacking and/or would make it not appropriate as a solution to OP's problem?  
> **username_9**: @woemier I haven't tried it lately, and I if I remember correctly it was a PITA to setup and run simple things. But as I said, don't know if got better.  

---

### Answer by username_10 on 2018-03-27. Score: 3

This answer will sort of only cover the big data parts, i.e. things > 100MB ish, and only if your analysis pipeline ties in with the Python ecosystem. It will require a bit of learning
Try using quilt which is sort of like 'docker for data' (Github page).
$ pip install quilt
$ quilt install uciml/iris -x da2b6f5  #note the short hash
$ python
>>> from quilt.data.uciml import iris
# you've got data

Pros:

There doesn't seem to be a filesize limit for public packages (haven't stress tested this though)
Hashes your data to ensure reproducibility
Support for versioning and tags

Cons:

Storing private data starts from $7 per user / month up to 1TB of data
Pretty much Python only at this point, with some community support for R

More information here.


---

