# HG changeset patch
# User geert-vandeweyer
# Date 1392715088 18000
# Node ID afa51021226cbe475869807fd1fd172c5158a5aa
Uploaded
diff -r 000000000000 -r afa51021226c SplitOnRg.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SplitOnRg.pl Tue Feb 18 04:18:08 2014 -0500
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+use Getopt::Std;
+getopts('i:o:O:k:p:', \%opts) ;
+
+
+# split
+$prefix = "primary_$opts{'O'}"."_";
+$command = "cd $opts{'p'} && bamtools split -in $opts{'i'} -tag RG -tagPrefix '$prefix' -stub $opts{'p'}/data" ;
+#print $command ."\n";
+system($command);
+chdir($opts{'p'});
+# rename to correct format.
+my @ls = `ls data.primary_$opts{'O'}_RG_*`;
+open OUT, ">$opts{'o'}";
+$idx = 0;
+foreach(@ls) {
+ chomp();
+ my $from = $_;
+ $from =~ m/(.*_RG_)(.*)(\.bam)/;
+ my $rg = $2;
+ # remove data_
+ my $to = substr($from,5,-4);
+ $to .= "_visible_bam_$opts{'k'}";
+ $to =~ s/RG_//;
+ $to =~ m/primary_(\d+)_(.*)_visible.*/;
+ $rgreplace = $2;
+ $rgreplace =~ s/\.|-|_//g;
+ $to =~ s/(primary_\d+_)(.*)(_visible.*)/$1$rgreplace$3/;
+ system("mv $from $to");
+ $idx++;
+ print OUT "File $idx : $to : ReadGroup: $rg\n";
+}
+close OUT;
+exit;
+
+
diff -r 000000000000 -r afa51021226c SplitOnRg.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SplitOnRg.xml Tue Feb 18 04:18:08 2014 -0500
@@ -0,0 +1,18 @@
+
+
+
+ bamtools
+
+
+SplitOnRG.pl -i '$input1' -o $output1 -O $output1.id -k $dbkey -p $__new_file_path__
+
+
+
+
+
+
+
+
+**What it does** This tools splits a bam file by RG-ids. ------- *bamtools split* is part of the `BAMTools package` by Derek Barnett. : https://github.com/pezmaster31/bamtools
+
+
diff -r 000000000000 -r afa51021226c bamToFastX.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bamToFastX.xml Tue Feb 18 04:18:08 2014 -0500
@@ -0,0 +1,26 @@
+
+
+
+ bamtools
+
+
+bamtools convert -in '$input1' -out '$output' -format $format
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+**What it does** This tools converts a BAM file to a FASTQ or FASTA file. ------- *bamtools convert* is part of the `BAMTools package`__ by Derek Barnett. .. __: https://github.com/pezmaster31/bamtools ------- This wrapper was originally created by A. Gordon.
+
+
diff -r 000000000000 -r afa51021226c tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml Tue Feb 18 04:18:08 2014 -0500
@@ -0,0 +1,6 @@
+
+
+
+
+
+