-
Notifications
You must be signed in to change notification settings - Fork 0
corrected the wrong stats output of number of footprints after filter #75
Conversation
wrong file was chosen. filtered_flagged.bed is the corresct one instead of filtered.bed
Please set the target branch to dev. We do not merge directly into the master branch. |
I tested the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment.
If you write a header to the temp-files depending on parameters or other factors, please check if the header exists before subtracting 1.
bin/1.2_filter_motifs/compareBed.sh
Outdated
@@ -279,7 +279,7 @@ then | |||
# add some final values to the log file | |||
fp_initial=`cat $data | wc -l` | |||
fp_initial=`expr $fp_initial - 1` | |||
fp_final=`cat "$workdir"/filtered.bed | wc -l` | |||
fp_final=`cat "$workdir"/filtered_flagged.bed | wc -l` | |||
fp_final=`expr $fp_final - 1` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the -1 from line 283. Since you are not writing a header to this temp-file you do not need to subtract 1.
I think what you are doing is not quite correct. # check if header existed. If so, final output also has a header.
first_line=`sed -n 1p $data | sed "s/$/\tcontains_maxpos\tsequence/"`
if [[ ${first_line:0:1} == "#" ]]
then
echo "$first_line" > $output
# add some final values to the log file
fp_initial=`cat $data | wc -l`
fp_initial=`expr $fp_initial - 1`
fp_final=`cat "$workdir"/filtered_flagged.bed | wc -l`
fp_final=`expr $fp_final - 1`
echo $fp_initial | sed 's/^/initial number of footprints: /g' >> "$workdir"/compareBed.stats
echo $fp_final | sed 's/^/number of footprints after subtract: /g' >> "$workdir"/compareBed.stats
else
# output will be overwritten if it exists
rm -f $output
# add some final values to the log file
cat $data | wc -l | sed 's/^/initial number of footprints: /g' >> "$workdir"/compareBed.stats
cat "$workdir"/filtered_flagged.bed | wc -l | sed 's/^/number of footprints after subtract: /g' >> "$workdir"/compareBed.stats
fi do this: # check if header existed. If so, final output also has a header.
first_line=`sed -n 1p $data | sed "s/$/\tcontains_maxpos\tsequence/"`
if [[ ${first_line:0:1} == "#" ]]
then
echo "$first_line" > $output
fi
# output will be overwritten if it exists
rm -f $output
# add some final values to the log file
cat $data | wc -l | sed 's/^/initial number of footprints: /g' >> "$workdir"/compareBed.stats
cat "$workdir"/filtered_flagged.bed | wc -l | sed 's/^/number of footprints after subtract: /g' >> "$workdir"/compareBed.stats |
The input file $data might still have or have not the header, thus it is checked. The file "filtered_flagged.bed" however has no header, thus no check needs to be made.
I changed the script. Thanks for finding this little bug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, the numbers match now.
wrong file was chosen. filtered_flagged.bed is the corresct one instead of filtered.bed