Skip to content

Commit

Permalink
Update v0.12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryuichiro Nakato committed Mar 5, 2024
1 parent a4226c0 commit f31e34e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 23 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.12.2 (2024-3-5)
- Fixed a bug in `churros` that did not output the mapping statistics file properly.

## 0.12.1 (2024-3-3)
- Fixed a bug in `download_genomedata.sh` that did not download the genome data correctly.
- Install MS core fonts (ttf-mscorefonts-installer)
Expand Down
25 changes: 4 additions & 21 deletions Dockerfiles/Churros/churros
Original file line number Diff line number Diff line change
Expand Up @@ -105,36 +105,19 @@ def do_fastqc(chdir, build, samplelist):

def do_mapping(args, samplelist, post, build, chdir):
if args.nompbl:
# param_churros_mapping = "-D " + chdir + " -k " + str(args.k) + " -p " + str(args.threads) + " -n"
param_churros_mapping = f"-D {chdir} -k {args.k} -p {args.threads} -n"
else:
# param_churros_mapping = "-D " + chdir + " -k " + str(args.k) + " -p " + str(args.threads)
param_churros_mapping = f"-D {chdir} -k {args.k} -p {args.threads}"

# print_and_exec_shell('churros_mapping ' + param_churros_mapping + ' exec ' + str(samplelist) + ' ' + build + ' ' + args.Ddir)
print_and_exec_shell(f'churros_mapping {param_churros_mapping} exec {samplelist} {build} {args.Ddir}')

# stats
qcstatsfile = '{chdir}/{build}/churros.QCstats.tsv'
# os.system('churros_mapping ' + param_churros_mapping + ' header > ' + chdir + '/' + build + '/churros.QCstats.tsv')
qcstatsfile = f'{chdir}/{build}/churros.QCstats.tsv'
os.system(f'churros_mapping {param_churros_mapping} header > {qcstatsfile}')
# os.system('churros_mapping ' + param_churros_mapping + ' stats ' + str(samplelist) + ' ' + build + ' ' + args.Ddir + ' >> ' + chdir + '/' + build + '/churros.QCstats.tsv')
os.system(f'churros_mapping {param_churros_mapping} stats {samplelist} {build} {args.Ddir} >> {qcstatsfile}')


def old_do_mapping(args, samplelist, post, build, chdir):
if args.nompbl:
param_churros_mapping = "-D " + chdir + " -k " + str(args.k) + " -p " + str(args.threads) + " -n"
else:
param_churros_mapping = "-D " + chdir + " -k " + str(args.k) + " -p " + str(args.threads)

print_and_exec_shell('churros_mapping ' + param_churros_mapping + ' exec ' + str(samplelist) + ' ' + build + ' ' + args.Ddir)

# header
os.system('churros_mapping ' + param_churros_mapping + ' header > ' + chdir + '/' + build + '/churros.QCstats.tsv')

# stats
os.system('churros_mapping ' + param_churros_mapping + ' stats ' + str(samplelist) + ' ' + build + ' ' + args.Ddir + ' >> ' + chdir + '/' + build + '/churros.QCstats.tsv')
# convert to xlsx
os.system(f'churros_mapping {param_churros_mapping} stats {samplelist} {build} {args.Ddir} >> {qcstatsfile}')
os.system(f'csv2xlsx.pl -i {qcstatsfile} -o {chdir}/{build}/churros.QCstats.xlsx')


def make_samplepairlist_withflen(samplepairlist, post, build, chdir):
Expand Down
49 changes: 49 additions & 0 deletions Dockerfiles/Churros/csv2xlsx.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env perl

use strict;
use warnings;
use Path::Class;
use Excel::Writer::XLSX;
use Getopt::Long qw/:config posix_default no_ignore_case bundling auto_help/;

my @input = ();
my $output = "";
my $delim = "\t";
my @name = ();
GetOptions('input|i=s' => \@input, 'output|o=s' => \$output, 'delim|d=s' => \$delim, 'name|n=s' => \@name);

if($#input ==-1 || $output eq ""){
print " csv2xlsx.pl: merge csv file(s) to xlsx.\n\n";
print " Usage: csv2xlsx.pl -i <input.csv> [-i <input.csv> ...] -o output.xlsx\n\n";
print " Options:\n\t-d --delim = <str>: delimiter of csv (default:\\t)\n\n";
exit;
}

my $workbook = Excel::Writer::XLSX->new($output);

my %hash;
for(my $i=0; $i<=$#input; $i++) {
my $tabname;
if($#name ==-1) {
my $tabname_full=(split /\//,$input[$i])[-1];
$tabname = substr($tabname_full, 0, 27);
while(exists($hash{$tabname})) {
$tabname = $tabname . "2";
}
$hash{$tabname}=1;
}else {
$tabname = $name[$i];
}
my $worksheet = $workbook->add_worksheet($tabname);

my $file = file($input[$i]);
my $fh = $file->open('r') or die "Error: $input[$i] does not exist.\n";
my $nrow=0;
while(<$fh>){
chomp;
my @clm = split(/$delim/, $_);
for(my $j=0; $j<=$#clm; $j++) { $worksheet->write( $nrow, $j, $clm[$j]);}
$nrow++;
}
$fh->close;
}
File renamed without changes.
4 changes: 2 additions & 2 deletions Dockerfiles/build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
tag=0.12.1
tag=0.12.2
docker build -f Dockerfile.$tag -t rnakato/churros:$tag . #--no-cache
#docker save -o churros-$tag.tar rnakato/churros:$tag
#singularity build -F /work3/SingularityImages/churros.$tag.sif docker-archive://churros-$tag.tar

#exit
docker push rnakato/churros:$tag
docker tag rnakato/churros:$tag rnakato/churros:latest
docker push rnakato/churros

0 comments on commit f31e34e

Please sign in to comment.