Skip to content

Commit

Permalink
Fix bugs with spaces in files
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Mar 27, 2023
1 parent f1c6b04 commit 7f55463
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions shm_csr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
</requirements>
<command interpreter="bash">
<![CDATA[
#set $input=$in_file.name
#import os
#set $input=os.path.basename($in_file.name)
ln -s "$in_file" "$input" &&
#if str ( $filter_unique.filter_unique_select ) == "remove":
$__tool_directory__/wrapper.sh "$input"
custom $out_file $out_file.files_path
"${in_file.name}" "-" $functionality $unique
"$input" "-" $functionality $unique
$naive_output_cond.naive_output $naive_output_ca $naive_output_cg
$naive_output_cm $naive_output_ce $naive_output_all $naive_output_igm_naive
$naive_output_igm_naive_memory
Expand Down
16 changes: 8 additions & 8 deletions wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ filter_unique_count=${18}
class_filter=${19}
empty_region_filter=${20}
fast=${21}

BASENAME=$(basename $input)
# Cut off .txz or .tgz suffix
BASENAME=$(basename "$input")
# Cut off .txz or .tgz suffix and also replace spaces with underscores.
NEW_IMGT_PREFIX="new_IMGT_${BASENAME%.*}"
NEW_IMGT_PREFIX=${NEW_IMGT_PREFIX// /_}

#exec 5> debug_output.txt
#BASH_XTRACEFD="5"
Expand All @@ -44,16 +44,16 @@ echo "---------------- read parameters ----------------<br />" > $log

echo "unpacking IMGT file"

type="`file -L $input`"
type="$(file -L "$input")"
if [[ "$type" == *"Zip archive"* ]] ; then
echo "Zip archive"
echo "unzip $input -d $PWD/files/"
unzip $input -d $PWD/files/
unzip "$input" -d $PWD/files/
elif [[ "$type" == *"XZ compressed data"* ]] ; then
echo "ZX archive"
echo "tar -xJf $input -C $PWD/files/"
echo "tar -xJf "$input" -C $PWD/files/"
mkdir -p "$PWD/files/$title"
tar -xJf $input -C "$PWD/files/$title"
tar -xJf "$input" -C "$PWD/files/$title"
else
echo "Unrecognized format $type"
echo "Unrecognized format $type" > $log
Expand Down Expand Up @@ -112,7 +112,7 @@ Rscript $dir/merge_and_filter.r \
echo "---------------- creating new IMGT zips ----------------"
echo "---------------- creating new IMGT zips ----------------<br />" >> $log

python $dir/split_imgt_file.py --outdir $outdir $input $outdir/merged.txt \
python $dir/split_imgt_file.py --outdir $outdir "$input" $outdir/merged.txt \
--prefix "${NEW_IMGT_PREFIX}" \
- IGA IGA1 IGA2 IGG IGG1 IGG2 IGG3 IGG4 IGM IGE

Expand Down

0 comments on commit 7f55463

Please sign in to comment.