---
author: Sam White
toc-title: Contents
toc-depth: 5
toc-location: left
layout: post
title: Data Wrangling - Splitting BAM by Size for Upload to OSF
date: '2019-10-31 06:25'
tags:
  - BAM
  - split
  - bash
  - Panopea generosa
  - geoduck
categories:
  - 2019
  - Geoduck Genome Sequencing
---
We're in the process of organizing files for a manuscript dealing with the geoduck genome assembly/annotation we've done. As part of that, we need the [Stringtie BAM file that was used with GenSAS for Pgenerosa_v074 annotation](https://robertslab.github.io/sams-notebook/posts/2019/2019-07-23-Genome-Annotation---Pgenerosa_v074-Transcript-Isoform-ID-with-Stringtie-on-Mox/) to upload to the [Open Science Foundation repository for this project](https://osf.io/yem8n/). Unfortunately, at 73GB, the file far exceeds the individual file size limit for OSF (5GB). So, I split it into 5GB chunks. See the following notebook for deets:

Jupyter Notebook (GitHub):

 - [20191031_swoose_pgen_v074_stringtie_BAM_splitting.ipynb](https://github.com/RobertsLab/code/blob/master/notebooks/sam/20191031_swoose_pgen_v074_stringtie_BAM_splitting.ipynb)

 TL;DR:

 1. Use Bash command `split` to split the file into desired chunk sizes

 2. Reassemble chunks into full size BAM using the Bash `cat` command.

 3. Run `md5sum` on original BAM and reassembled BAM to confirm the two files are the same.


---

# RESULTS

Output folder:

- [20191031_pgen_v074_stringtie_BAM_splitting/](https://gannet.fish.washington.edu/Atumefaciens/20191031_pgen_v074_stringtie_BAM_splitting/)


Will upload split files to [OSF repository](https://osf.io/yem8n/).
