Commit 26f20f38 authored by nchernia's avatar nchernia
Browse files

rollback encode changes in add user branch

parent 91dbb878
Loading
Loading
Loading
Loading

CPU/common/bamtotxt.sh

deleted100755 → 0
+0 −32
Changes for CPU/common/bamtotxt.sh: 0 added lines, 32 removed lines.
Original line number Diff line number Diff line
#!/bin/bash
# Converts bam file to merged_nodups.txt file
# Calls samtools to filter duplicates then 
# chimeric_blacklist to associate read pair group
# Then assigns fragment and sorts
# Sorting should be optional
# Usage: bamtotxt.sh <bam_file> <site_file> <output_file> [sort]
set -e

if [ $# -lt 3 ] || [ $# -gt 4 ]
then
    echo "Usage: $0 <bam_file> <site_file> <output_file> [sort]"
    exit 1
else
    bamfile=$1
    sitefile=$2 
    outputfile=$3
fi
if [ $# -eq 4 ]
then
    sort=1
fi

samtools view -F 1024 "$bamfile" | awk -v fname=$bamfile -f "$( dirname "${BASH_SOURCE[0]}" )"/chimeric_blacklist.awk
"$( dirname "${BASH_SOURCE[0]}" )"/fragment.pl "${bamfile}_norm.txt" "${bamfile}.frag.txt" "$sitefile"
if [ -n $sort ]
then
    sort -k2,2d -k6,6d -k4,4n -k8,8n -k1,1n -k5,5n -k3,3n "${bamfile}.frag.txt" > "$outputfile"
else
    mv "${bamfile}.frag.txt" "$outputfile"
fi
rm "${bamfile}_norm.txt" "${bamfile}.frag.txt"
+1 −1
Changes for CPU/common/check.sh: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@

# Start by checking the statistics to see if they add up 
res1=`cat ${splitdir}/*norm*res*`
check1=`cat ${splitdir}/*norm*res* | awk '{s2+=$2; s3+=$3; s4+=$4; s5+=$5; s6+=$6; s7+=$7; s8+=$8}END{if (s2 != s3+s4+s5+s6+s7+s8){print 0}else{print 1}}'`
check1=`cat ${splitdir}/*norm*res* | awk '{s2+=$2; s3+=$3; s4+=$4; s5+=$5; s6+=$6}END{if (s2 != s3+s4+s5+s6){print 0}else{print 1}}'`
if [ $check1 -eq 0 ] || [ -z "$res1" ]
then
    echo "***! Error! The statistics do not add up. Alignment likely failed to complete on one or more files. Run relaunch_prep.sh"
+236 −497

File changed.

Preview size limit exceeded, changes collapsed.

+5 −5
Changes for CPU/common/cleanup.sh: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -25,22 +25,22 @@
# Script to clean up big repetitive files and zip fastqs. Run after you are 
# sure the pipeline ran successfully.  Run from top directory (HIC001 e.g.).
# Juicer version 1.5
total=`ls -l aligned/merged_sort.txt | awk '{print $5}'`
total2=`ls -l aligned/merged_nodups.txt aligned/dups.txt aligned/opt_dups.txt | awk '{sum = sum + $5}END{print sum}'`
if [ $total -eq $total2 ] 
then 
    rm aligned/merged_sort.txt 
    rm -rf splits 
    testname=$(ls -l fastq | awk 'NR==1{print $9}')
    if [ "${testname: -5}" == ".fastq" ]
    then
    rm -r splits 
    for i in fastq/*.fastq
    do
        gzip $i
    done
    fi
    gzip aligned/merged_nodups.txt
    gzip aligned/dups.txt
    gzip aligned/opt_dups.txt
    gzip aligned/abnormal.sam
    gzip aligned/collisions.txt
    gzip aligned/unmapped.sam
else 
    echo "Problem: The sum of merged_nodups and the dups files is not the same size as merged_sort.txt"
    echo "Did NOT clean up";
+6 −6
Changes for CPU/common/countligations.sh: 6 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -27,11 +27,11 @@
# Juicer version 1.5
if [ "$usegzip" -eq 1 ]
then 
    num1=$(paste <(gunzip -c $file1) <(gunzip -c $file2) | grep -cE $ligation)
    num2=$(gunzip -c $file1 | wc -l | awk '{print $1}')
    num1=$(paste <(gunzip -c $name1$ext) <(gunzip -c $name2$ext) | grep -cE $ligation)
    num2=$(gunzip -c ${name1}${ext} | wc -l | awk '{print $1}')
else
    num1=$(paste $file1 $file2 | grep -cE $ligation)
    num2=$(wc -l $file1 | awk '{print $1}')
    num1=$(paste $name1$ext $name2$ext | grep -cE $ligation)
    num2=$(wc -l ${name1}${ext} | awk '{print $1}')
fi
echo -ne "$num1 " > ${curr_ostem}_norm.txt.res.txt
echo "$num2" > ${curr_ostem}_linecount.txt
echo -ne "$num1 " > ${name}${ext}_norm.txt.res.txt
echo "$num2" > ${name}${ext}_linecount.txt
Loading