Skip to content

Commit

Permalink
Remove further instances of writing to /dev/stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
pinin4fjords committed Aug 14, 2018
1 parent d213be7 commit 5205e73
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 63 deletions.
6 changes: 3 additions & 3 deletions aux/sh/irap_fun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function get_param_value {
function get_cached_value {

if [ ! -e $name/cached_vars.mk ]; then
echo ERROR: File $name/cached_vars.mk not found > /dev/stderr
echo ERROR: File $name/cached_vars.mk not found 1>&2
exit 1
fi
val=`grep "^$1=" $name/cached_vars.mk|cut -f 2 -d=`
Expand Down Expand Up @@ -489,10 +489,10 @@ function submit_jobs4target {
}

function get_pe_libs {
#echo $cmd conf=$conf $IRAP_PARAMS print_pe_libs se= > /dev/stderr
#echo $cmd conf=$conf $IRAP_PARAMS print_pe_libs se= 1>&2
$cmd conf=$conf $IRAP_PARAMS print_pe_libs se= |tail -n 1
}
function get_se_libs {
#echo $cmd conf=$conf $IRAP_PARAMS print_se_libs pe= > /dev/stderr
#echo $cmd conf=$conf $IRAP_PARAMS print_se_libs pe= 1>&2
$cmd conf=$conf $IRAP_PARAMS print_se_libs pe= | tail -n 1
}
14 changes: 7 additions & 7 deletions aux/sh/irap_shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ function conf_get_species {
function conf_ok {
local conf=$1
local irap_options=$2
echo "irap conf=$conf $irap_options -n" > /dev/stderr
echo "irap conf=$conf $irap_options -n" 1>&2
set +e
irap conf=$conf $irap_options -n 2>/dev/null
if [ $? == 2 ]; then
irap conf=$conf $irap_options -n
echo "ERROR: error in iRAP options." > /dev/stderr
echo "ERROR: error in iRAP options." 1>&2
exit 2
fi
set -e
Expand All @@ -125,15 +125,15 @@ function conf_get_var_value {
local irap_options=$3
# lookup in the conf file
#
echo "irap conf=$conf $irap_options -n | grep $conf_var=" > /dev/stderr
echo "irap conf=$conf $irap_options -n | grep $conf_var=" 1>&2
d=`irap conf=$conf $irap_options pe= se= -n 2>/dev/null|grep -E "*\s*$conf_var\s*="|tail -n 1`
if [ "$d-" == "-" ]; then
echo "ERROR: unable to get $conf_var value" > /dev/stderr
echo "ERROR: unable to get $conf_var value" 1>&2
exit 1
else
d=`echo $d|cut -f 2 -d=`
fi
echo "debug:$conf_var=$d" > /dev/stderr
echo "debug:$conf_var=$d" 1>&2
echo $d
}

Expand Down Expand Up @@ -235,7 +235,7 @@ function run_AND_timeIt {
EXIT_STATUS=$?
# output stderr
#cat $sout >/dev/stdout
#cat $serr > /dev/stderr
#cat $serr 1>&2

if [ $EXIT_STATUS -ne 0 ]; then
classify_error $label $serr
Expand All @@ -252,7 +252,7 @@ function run_AND_timeIt {
function classify_error {
perror "LOG files: $2"
${1}_errors $2
#echo "!!!!!!!!!!!!!!$classified_error<<<<<<<<<<<<<<<<<<<<" > /dev/stderr
#echo "!!!!!!!!!!!!!!$classified_error<<<<<<<<<<<<<<<<<<<<" 1>&2
print_classified_error
}

Expand Down
6 changes: 3 additions & 3 deletions aux/sh/lsf_shared_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ function check_dependency {

function stop_job {
if [ "$DEBUG-" != "0-" ]; then
echo "stop/suspend job $1" > /dev/stderr
echo "stop/suspend job $1" 1>&2
else
bstop -J $1
fi
}

function resume_job {
if [ "$DEBUG-" != "0-" ]; then
echo "resume job $1" > /dev/stderr
echo "resume job $1" 1>&2
else
bresume -J $1
fi
Expand All @@ -100,7 +100,7 @@ function submit_job_status {
#p_info "WAITFOR (id)=$JOB_ID $jobname $WAITFOR"
# in spite of the checks, the job may have finished before launching the new one, hence catch the error and submit a new one if an error occurs
if [ "$DEBUG-" == "2-" ]; then
$ECHO $IRAP_PAR_CMD -n -q > /dev/stderr
$ECHO $IRAP_PAR_CMD -n -q 1>&2
ret=$?
else
$ECHO bsub $IRAP_LSF_PARAMS -M 1000 -R "select[mem>=1000] rusage[mem=1000]" -q $QUEUE -J "${jobname}n" $WAITFOR irap_lsf_job_status.sh $jobname $JOB_ID `get_maxmem $MEM` $LOG_DIR $IRAP_PAR_CMD
Expand Down
2 changes: 1 addition & 1 deletion pcawg/irap_install_pcawg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ do
done

if [ "$DIR-" = "-" ]; then
echo "You need to provide the instalation directory" > /dev/stderr
echo "You need to provide the instalation directory" 1>&2
exit 1
fi

Expand Down
4 changes: 2 additions & 2 deletions pcawg/irap_pcawg_align
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DATA_TOPLEVEL_DIR=test_data
metadata_file=$DATA_TOPLEVEL_DIR/metadata.tsv

if [ "$id-" == "-" ]; then
echo "Usage: irap_pcawg_align SOP tar.gz ID" > /dev/stderr
echo "Usage: irap_pcawg_align SOP tar.gz ID" 1>&2
exit 1
fi

Expand All @@ -26,7 +26,7 @@ if [ "$tarball-" == "-" ]; then
fi

if [ ! -e $tarball ]; then
echo "$tarball not found" > /dev/stderr
echo "$tarball not found" 1>&2
exit 1
fi

Expand Down
14 changes: 7 additions & 7 deletions pcawg/pcawg_sam_header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ meta_data_file=$3
SOP_VERSION=1

if [ "-$user_analysis_id" = "-" ]; then
echo "ERROR: analysis_id not given" > /dev/stderr
echo "ERROR: analysis_id not given" 1>&2
exit 1
fi
if [ "-$file_prefix" = "-" ]; then
echo "ERROR: file_prefix not given" > /dev/stderr
echo "ERROR: file_prefix not given" 1>&2
exit 1
fi
if [ ! -e "$meta_data_file" ]; then
echo "ERROR: $meta_data_file not found" > /dev/stderr
echo "ERROR: $meta_data_file not found" 1>&2
exit 1
fi

if [ "$file_prefix" == "icgc" ]; then
file_prefix=$user_analysis_id
fi
if [ ! -e $meta_data_file ]; then
echo "ERROR: file $meta_data_file not found" > /dev/stderr
echo "ERROR: file $meta_data_file not found" 1>&2
exit 1
fi

#
sample_metadata=`grep -F "$file_prefix" $meta_data_file|tr '\t' '|'`
if [ "-$sample_metadata" = "-" ]; then
echo "ERROR: Unable to find sample $file_prefix in $meta_data_file" > /dev/stderr
echo "ERROR: Unable to find sample $file_prefix in $meta_data_file" 1>&2
exit 1
fi

Expand Down Expand Up @@ -60,13 +60,13 @@ done
for var in analysis_id fastq_files center_name platform platform_model sample_id submitter_sample_id lib_id read_group_label fastq_files ; do
#echo $var=${!var}
if [ "${!var}-" == "-" ]; then
echo "ERROR: Unable to get value for $var" > /dev/stderr
echo "ERROR: Unable to get value for $var" 1>&2
exit 1
fi
done
# analysis id should match
if [ "$analysis_id" != "$user_analysis_id" ]; then
echo "ERROR: Analysis id mismatch - expected $user_analysis_id and got $analysis_id" > /dev/stderr
echo "ERROR: Analysis id mismatch - expected $user_analysis_id and got $analysis_id" 1>&2
exit 1
fi

Expand Down
4 changes: 2 additions & 2 deletions scripts/atlas_clean_html.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash

if [ "$1-" = "-" ] ; then
echo "atlas_clean_html.sh HTML file" > /dev/stderr
echo "atlas_clean_html.sh HTML file" 1>&2
exit 1
fi

if [ ! -e "$1" ] ; then
echo "ERROR: file not found $1" > /dev/stderr
echo "ERROR: file not found $1" 1>&2
exit 1
fi

Expand Down
8 changes: 4 additions & 4 deletions scripts/fastq_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
STDERR=/dev/stderr

if [ "$*-" == "-" ]; then
echo "fastq_info.sh .fastq [.fastq]" > $STDERR
echo "fastq_info.sh .fastq [.fastq]" > 1>&2
exit 1
fi

A="`fastq_info $* 2>/dev/stdout | tee $STDERR |tail -n 5`"
A="`fastq_info $* 2>&1 | tee $STDERR |tail -n 5`"
ret=$?
if [ $ret != 0 ]; then
echo "ERROR" > $STDERR
echo "ERROR" 1>&2
exit $ret
fi
if [ `echo "$A"|grep -c -i "Error" ` != 0 ]; then
Expand All @@ -35,7 +35,7 @@ qual=`echo $A| sed -E "s/.*Quality encoding: ([0-9]+|solexa).*/\1/" `


if [ "$qual-" == "solexa-" ]; then
echo "ERROR: Quality encoding not supported by iRAP - $qual" > /dev/stderr
echo "ERROR: Quality encoding not supported by iRAP - $qual" 1>&2
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/fastq_validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ "$ext-" == "bam-" ]; then
echo "Checking for unmapped reads"
UN=`samtools view -c -f 4 $f`
if [ "$UN-" == "0-" ]; then
echo "ERROR: No unaligned reads found in $f." > /dev/stderr
echo "ERROR: No unaligned reads found in $f." 1>&2
exit 1
fi
named_pipe=.`basename .$f`.pipe.fastq
Expand Down
4 changes: 2 additions & 2 deletions scripts/fastqc2tsv
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ zip=y
ifile=$1
cat_cmd="unzip -p $ifile"
if [ ! -e $ifile ] ; then
echo "$ifile not found" > /dev/stderr
echo "$ifile not found" 1>&2
zip=n
ifile=`echo $ifile|sed "s/.fastqc.zip/_fastqc/"`
if [ ! -e $ifile ] ; then
echo "$ifile not found" > /dev/stderr
echo "$ifile not found" 1>&2
exit 1
fi
cat_cmd=cat
Expand Down
4 changes: 2 additions & 2 deletions scripts/irapBAM2stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ set -e
set -o pipefail

if [ "$1-" = "-" ]; then
echo "Usage: irapBAM2stats2.sh bam_file_name" > /dev/stderr
echo "Usage: irapBAM2stats2.sh bam_file_name" 1>&2
exit 1
fi

if [ ! -e $1.ridx ]; then
echo "Index not found: $1.ridx" > /dev/stderr
echo "Index not found: $1.ridx" 1>&2
exit 1
fi

Expand Down
10 changes: 5 additions & 5 deletions scripts/irap_AE_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function pinfo {
}

function perror {
echo "ERROR: $*" > /dev/stderr
echo "ERROR: $*" 1>&2
}

## fix the filename by replacing some characters
Expand Down Expand Up @@ -343,7 +343,7 @@ if [ $skip_idf != "y" ]; then
irap_cmd=irap_sc
## expected number of clusters
if [ $(grep -c EAExpectedClusters $IDF_FILE_FP) -eq 0 ]; then
echo ERROR: EAExpectedClusters not found in IDF > /dev/stderr
echo ERROR: EAExpectedClusters not found in IDF 1>&2
exit 1
fi
expected_clusters=$(grep EAExpectedClusters $IDF_FILE_FP|cut -f 2)
Expand Down Expand Up @@ -533,7 +533,7 @@ function download {
set +e
DOWNLOAD_PUBLIC $file $fn $download_program
if [ $? -ne 0 ]; then
echo "Failed to download from ENA $file ..." > /dev/stderr
echo "Failed to download from ENA $file ..." 1>&2
dl_fun="DOWNLOAD_PRIVATE"
fi
set -e
Expand All @@ -544,11 +544,11 @@ function download {
set +e
DOWNLOAD_PRIVATE $file $fn $ID $SDRF_FILE_FP
if [ $? -ne 0 ]; then
echo "Failed to download from private location $file ..." > /dev/stderr
echo "Failed to download from private location $file ..." 1>&2
stdbuf -o0 echo -n
DOWNLOAD_PRIVATE2 $file $fn $ID $SDRF_FILE_FP
if [ $? -ne 0 ]; then
echo "Failed to download from private location2 $file ...given up" > /dev/stderr
echo "Failed to download from private location2 $file ...given up" 1>&2
exit 1
fi
fi
Expand Down
4 changes: 2 additions & 2 deletions scripts/irap_distrib_fastq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ data_dir=$3
species=test_species

if [ "$1-" == "-" ] ; then
echo "Usage: irap_distrib_fastq.sh irap_conf_file max_files_per_folder [data_dir]" > /dev/stderr
echo "Usage: irap_distrib_fastq.sh irap_conf_file max_files_per_folder [data_dir]" 1>&2
exit 1
fi

if [ "$CONF-" == "-" ] || [ ! -e $CONF ]; then
echo "Unable to open configuration file" > /dev/stderr
echo "Unable to open configuration file" 1>&2
exit 1
fi
if [ "$data_dir-" == "-" ]; then
Expand Down
6 changes: 3 additions & 3 deletions scripts/irap_fastqc2tsv
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ zip=y
ifile=$1
cat_cmd="unzip -p $ifile"
if [ ! -e $ifile ] ; then
echo "WARNING: $ifile not found" > /dev/stderr
echo "WARNING: $ifile not found" 1>&2
zip=n
ifile=`echo $ifile|sed "s/.fastqc.zip/_fastqc/"`
if [ ! -e $ifile ] ; then
echo "ERROR: $ifile not found" > /dev/stderr
echo "ERROR: $ifile not found" 1>&2
exit 1
fi
cat_cmd=cat
else
unzip -t $1 > /dev/stderr
unzip -t $1 1>&2
fi
pref=`basename $ifile|sed "s/.fastqc.zip//"|sed "s/_fastqc//"`
echo "FASTQC $pref" | tr " " "\t"
Expand Down
4 changes: 2 additions & 2 deletions scripts/irap_gen_version_mk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ echo "# Generated `date` " > $DEST_FILE
grep "VERSION=" $IRAP_DIR/scripts/irap_install.sh |sort -u | grep -v "^#"| sed -e "s/^ *//" >> $DEST_FILE
# R packages
if [ "`which R 2>/dev/null`-" = "-" ]; then
echo "R not found" > /dev/stderr
echo "R not found" 1>&2
else
irap_R_package_version.R edgeR Rsamtools limma baySeq limma DESeq2 piano DESeq DEXSeq SC3 Rtsne scater EBSeq baySeq Seurat >> $DEST_FILE
fi

#if [ -x $IRAP_DIR/scripts/R3 ]; then
# irap_R3_package_version.R DESeq DEXSeq limma DESeq2 piano >> $DEST_FILE
#else
# echo "R3 not found" > /dev/stderr
# echo "R3 not found" 1>&2
#fi
sed -i "s/VERSION=/version=/" $DEST_FILE
exit 0
Expand Down
6 changes: 3 additions & 3 deletions scripts/irap_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ function download2cache {
mkdir -p $SRC_DIR/download
pushd $SRC_DIR/download
PACKAGES2DOWNLOAD=`set | grep _URL=|sed "s/_URL.*//"|grep -v "PACKAGES"|uniq`
echo $PACKAGES2DOWNLOAD > /dev/stderr
echo $PACKAGES2DOWNLOAD 1>&2
for p in $PACKAGES2DOWNLOAD; do
URL=${p}_URL
FILE=${p}_FILE
pinfo "Downloading ($p) ${!URL}"
download_software $p

if [ ! -e ${!FILE} ]; then
echo "Failed downloading $p ${!URL}" > /dev/stderr
echo "Failed downloading $p ${!URL}" 1>&2
exit 1
else
ls -lh ${!FILE}
Expand Down Expand Up @@ -2187,7 +2187,7 @@ fi


if [ "$IRAP_DIR-" = "-" ]; then
echo ERROR: IRAP directory not defined. > /dev/stderr
echo ERROR: IRAP directory not defined. 1>&2
usage
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions scripts/irap_lsf_filter_logs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

if [ "$1-" == "-" ]; then
echo "Usage: irap_lsf_filter_logs log_dir" > /dev/stderr
echo "Usage: irap_lsf_filter_logs log_dir" 1>&2
exit 1
fi

Expand All @@ -18,7 +18,7 @@ function check_jobs_status {
out_files=`ls -1 $1/*.out 2>/dev/null`
for f in $out_files; do
OK=`grep -c -E "^Successfully completed." $f`
#echo "OK=$OK" > /dev/stderr
#echo "OK=$OK" 1>&2
if [ "$OK" == "1" ]; then
let success_jobs=$success_jobs+1
else
Expand Down
Loading

0 comments on commit 5205e73

Please sign in to comment.