Script for Mounting Multiple Files

GTFuse can be used to retrieve the same region from multiple BAM files. To do so, you'll use a special script (linked at the bottom of this article).

The version of the script attached below contains sample information for extracting regions associated with the P53 gene. You'll need to open the script and swap out some of the values with your own.

Once you have opened the script, begin by specifying the UUIDs of the files you want to mount. 

files= ( b4b7acc5-1fe4-4f88-bbae-61d99c99418a 12fdf8ac-2e6e-4000-a18c-1bc32832d2fb 3bc968c2-6478-4e07-872c-467fba37b9de)

Next, you will need to specify the directory where you want to mount the files, along with the directory where SAMtools is located. If you are not using SAMtools, you can just leave this space blank, or specify the location of a different tool.


Next, specify the region that you wish to extract.

$SAMTOOLS view -hu $FUSE_DIR/fusemnt/$i/$i/*.bam 17:300-400 > p53_$i.bam

If you wanted to extract more than one region, you would add additional regions separated by a space, like this:

$SAMTOOLS view -hu $FUSE_DIR/fusemnt/$i/$i/*.bam 17:300-400 17:500-600 17:700-750 18:800-900 > p53_$i.bam

Adding the ">" at the end of the last region will output the extracted regions to a file with the name you specify. In the example above, a single file will be created for each target BAM that contains all the desired regions. The script will place these extracts into the directory where you are running the script. 

The script mounts each file sequentially, then unmounts it once the target regions have been extracted. There is no need for you to manually unmount when using this script. 

MultiFile Download

Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk