Skip to content

Commit

Permalink
Merge branch 'hotfix/2.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
David Jones committed May 24, 2016
2 parents 9c528be + 5af5f10 commit 5b9262e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 2.4.1
* Modified reheadSQ to be more robust.

### 2.1.0
* Adds `xam_coverage_bins.pl` which calculates fraction of targets covered at various depths (BAM/CRAM), using BED/GFF3 as target bait file.

Expand Down
22 changes: 15 additions & 7 deletions c/reheadSQ.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <errno.h>
#include <string.h>

#define BUF_SIZE 4096
#define BUF_SIZE 8192

char *dict = NULL;
char **dict_name;
Expand Down Expand Up @@ -161,26 +161,34 @@ int main (int argc, char* argv[]){

read_dict_file(dict);

char *line = malloc(BUF_SIZE * sizeof(char));
while(gets(line)){
//Read from stdin and write to stdout
char *line = NULL;
ssize_t read;
size_t linelen = 0;

while((read = getline(&line,&linelen,stdin)) != -1){
if(strncmp(line, "@", 1) == 0){//If we're matching a header
if(strncmp(line, "@SQ" ,3)==0){//Code to replace/append to SQ lines here @SQ
char *nom = get_contig_name_fromSQ_line(line);
char *new = get_dict_sq_line_by_name(nom);
fprintf(stdout,"%s",new);
fflush(stdout);
free(nom);
}else{//Not a SQ header
puts(line);
fprintf(stdout,"%s",line);
}
}else{ // We're no longer matching a header
puts(line);
fprintf(stdout,"%s",line);
break;
}//End of checking for a header
}
while(gets(line)){
puts(line);
//Another loop, this time we know we're past the SQ headers so it goes straight to stdout.
while((read = getline(&line,&linelen,stdin)) != -1){
fprintf(stdout,"%s",line);
}
fflush(stdout);
free(line);

int j=0;
for(j=0;j<dict_entries;j++){
free(dict_name[j]);
Expand Down
2 changes: 1 addition & 1 deletion lib/PCAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use base 'Exporter';
use FindBin qw($Bin);
use File::Which qw(which);

our $VERSION = '2.4.0';
our $VERSION = '2.4.1';
our @EXPORT = qw($VERSION _which);

const my $LICENSE =>
Expand Down

0 comments on commit 5b9262e

Please sign in to comment.