diff --git a/Changes b/Changes index 8ebb55a..f8a5110 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +1.5.4 + bam_stats C + * Reference file parameter is now optional to replicate bam_stats.pl functionality. + * Warnings in help, and when a cram file is given as reference from header may not be found, and bam stats will fail. 1.5.3 bam_stats C - changed array for khash in insert size calculations in order to make code more robust. Header RG line reading now reads anything not a tab or newline as it should when determining what the values of tags are. diff --git a/MYMETA.json b/MYMETA.json index bf5bcc6..c658124 100644 --- a/MYMETA.json +++ b/MYMETA.json @@ -4,7 +4,7 @@ "unknown" ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 6.68, CPAN::Meta::Converter version 2.131560", + "generated_by" : "ExtUtils::MakeMaker version 6.68, CPAN::Meta::Converter version 2.143240", "license" : [ "gpl_2" ], @@ -55,5 +55,5 @@ } }, "release_status" : "stable", - "version" : "v1.5.3" + "version" : "v1.5.4" } diff --git a/MYMETA.yml b/MYMETA.yml index 135704f..f60d14b 100644 --- a/MYMETA.yml +++ b/MYMETA.yml @@ -3,38 +3,38 @@ abstract: unknown author: - unknown build_requires: - ExtUtils::MakeMaker: 0 + ExtUtils::MakeMaker: '0' configure_requires: - ExtUtils::MakeMaker: 0 + ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 6.68, CPAN::Meta::Converter version 2.131560' +generated_by: 'ExtUtils::MakeMaker version 6.68, CPAN::Meta::Converter version 2.143240' license: gpl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + version: '1.4' name: PCAP no_index: directory: - t - inc requires: - Bio::DB::Sam: 1.39 - Bio::Root::Version: 1.006923 - Capture::Tiny: 0.24 - Const::Fast: 0.014 - Data::UUID: 1.219 - Devel::Cover: 1.09 - File::Which: 0.05 - GD: 2.52 - IPC::System::Simple: 1.25 - List::Util: 1.38 - Math::Gradient: 0.04 - Module::Build: 0.42 - Pod::Coverage: 0.23 - Proc::ProcessTable: 0.5 - Sub::Exporter::Progressive: 0.001011 - Term::UI: 0.42 - Test::Fatal: 0.013 - Try::Tiny: 0.19 - XML::Simple: 2.2 -version: v1.5.3 + Bio::DB::Sam: '1.39' + Bio::Root::Version: '1.006923' + Capture::Tiny: '0.24' + Const::Fast: '0.014' + Data::UUID: '1.219' + Devel::Cover: '1.09' + File::Which: '0.05' + GD: '2.52' + IPC::System::Simple: '1.25' + List::Util: '1.38' + Math::Gradient: '0.04' + Module::Build: '0.42' + Pod::Coverage: '0.23' + Proc::ProcessTable: '0.5' + Sub::Exporter::Progressive: '0.001011' + Term::UI: '0.42' + Test::Fatal: '0.013' + Try::Tiny: '0.19' + XML::Simple: '2.2' +version: v1.5.4 diff --git a/c/Makefile b/c/Makefile index 6c45385..a2c1348 100644 --- a/c/Makefile +++ b/c/Makefile @@ -1,4 +1,4 @@ -VERSION=1.5.3 +VERSION=1.5.4 #Compiler CC = gcc -O3 -DVERSION='"$(VERSION)"' -g diff --git a/c/bam_stats.c b/c/bam_stats.c index 3ddb4ca..257c7cc 100644 --- a/c/bam_stats.c +++ b/c/bam_stats.c @@ -56,11 +56,12 @@ void print_version (int exit_code){ void print_usage (int exit_code){ - printf ("Usage: bam_stats [-i file] [-o file] [-p plots] [-r reference.fa.fai] [-h] [-v]\n\n"); + printf ("Usage: bam_stats -i file -o file [-p plots] [-r reference.fa.fai] [-h] [-v]\n\n"); printf ("-i --input File path to read in.\n"); - printf ("-r --ref-file File path to reference index (.fai) file.\n"); printf ("-o --output File path to output.\n\n"); printf ("Optional:\n"); + printf ("-r --ref-file File path to reference index (.fai) file.\n"); + printf (" NB. If cram format is supplied via -b and the reference listed in the cram header can't be found bam_stats may fail to work correctly.\n"); printf ("-p --plots Folder to contain quality score plots.\n\n"); printf ("Other:\n"); printf ("-h --help Display this usage information.\n"); @@ -69,6 +70,9 @@ void print_usage (int exit_code){ } void options(int argc, char *argv[]){ + + ref_file = NULL; + const struct option long_opts[] = { {"version", no_argument, 0, 'v'}, @@ -128,9 +132,11 @@ void options(int argc, char *argv[]){ printf("Input file (-i) %s does not exist.\n",input_file); print_usage(1); } - if(check_exist(ref_file) != 1){ - printf("Reference fasta index file (-r) %s does not exist.\n",ref_file); - print_usage(1); + if(ref_file){ + if(check_exist(ref_file) != 1){ + printf("Reference fasta index file (-r) %s does not exist.\n",ref_file); + print_usage(1); + } } return; @@ -338,7 +344,12 @@ int main(int argc, char *argv[]){ //Open bam file as object input = hts_open(input_file,"r"); //Set reference index file - hts_set_fai_filename(input, ref_file); + if(ref_file){ + hts_set_fai_filename(input, ref_file); + }else{ + if(input->format.format == cram) log_warn("No reference file provided for a cram input file, if the reference described in the cram header can't be located bam_stats may fail."); + } + //Read header from bam file head = sam_hdr_read(input); rg_info_t **grps = parse_header(head, &grps_size, &grp_stats); diff --git a/docs.tar.gz b/docs.tar.gz index be400e0..27c2b67 100644 Binary files a/docs.tar.gz and b/docs.tar.gz differ diff --git a/lib/PCAP.pm b/lib/PCAP.pm index 012bac8..21599fb 100644 --- a/lib/PCAP.pm +++ b/lib/PCAP.pm @@ -24,7 +24,7 @@ use strict; use Const::Fast qw(const); use base 'Exporter'; -our $VERSION = '1.5.3'; +our $VERSION = '1.5.4'; our @EXPORT = qw($VERSION); const my $LICENSE => @@ -58,6 +58,7 @@ const my %UPGRADE_PATH => ( '0.1.0' => 'biobambam,bwa,samtools', '1.5.1' => '', '1.5.2' => '', '1.5.3' => '', + '1.5.4' => '', ); sub license { diff --git a/setup.sh b/setup.sh index b80d9d4..39f98c6 100755 --- a/setup.sh +++ b/setup.sh @@ -5,7 +5,7 @@ SOURCE_BWA="https://github.com/lh3/bwa/archive/0.7.10.tar.gz" SOURCE_SAMTOOLS="https://github.com/samtools/samtools/archive/0.1.20.tar.gz" # for bamstats -SOURCE_HTSLIB="https://github.com/samtools/htslib/archive/1.1.tar.gz" +SOURCE_HTSLIB="https://github.com/samtools/htslib/archive/1.2.1.tar.gz" # for bigwig SOURCE_JKENT_BIN="https://github.com/ENCODE-DCC/kentUtils/raw/master/bin/linux.x86_64"