Skip to content

Commit

Permalink
Add features for featurecounts
Browse files Browse the repository at this point in the history
  • Loading branch information
upendrak committed Apr 26, 2019
1 parent 47a2309 commit da3a62d
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions rmta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ cat <<'EOF'
-t Type of reads (Single end or Paired end)
-u Feature type (Default is exon)
-a Gene attribute (Default is gene_id)
-n Strandedness (Default is 0 (unstranded), 1 (stranded), 2 (reversely stranded))
EOF
exit 0
}
Expand All @@ -66,7 +72,7 @@ hisat=0
bowtie=0
duplicates=0

while getopts ":hg:i:A:l:1:2:U:O:s:p:5:3:f:Qedtbm:M:k:y:" opt; do
while getopts ":hg:i:A:l:1:2:U:O:s:p:5:3:f:Qedtbm:M:k:y:u:a:n:" opt; do
case $opt in
g)
referencegenome=$OPTARG # Reference genome file
Expand Down Expand Up @@ -134,6 +140,15 @@ while getopts ":hg:i:A:l:1:2:U:O:s:p:5:3:f:Qedtbm:M:k:y:" opt; do
y)
seq_type=$OPTARG # Type of Sequence data
;;
u)
feature_type=$OPTARG # Feature type (Default is exon)
;;
a)
gene_attribute=$OPTARG # (Default is gene_id)
;;
n)
strandedness=$OPTARG # (Default is 0 (unstranded), 1 (stranded), 2 (reversely stranded))
;;
h)
usage
exit 1
Expand Down Expand Up @@ -668,9 +683,11 @@ success_message()
featurecounts()
{
if [ "$seq_type" == "SE" ]; then
featureCounts -T $num_threads -t exon -g gene_id -a $referenceannotation -o feature_counts.txt "$bam_out"/*.sorted.bam
echo "featureCounts -T $num_threads -t $feature_type -g $gene_attribute -s $strandedness -a $referenceannotation -o feature_counts.txt "$bam_out"/*.sorted.bam"
featureCounts -T $num_threads -t $feature_type -g $gene_attribute -s $strandedness -a $referenceannotation -o feature_counts.txt "$bam_out"/*.sorted.bam
elif [ "$seq_type" == "PE" ]; then
featureCounts -p -T $num_threads -t exon -g gene_id -a $referenceannotation -o feature_counts.txt "$bam_out"/*.sorted.bam
echo "featureCounts -p -T $num_threads -t $feature_type -g $gene_attribute -s $strandedness -a $referenceannotation -o feature_counts.txt "$bam_out"/*.sorted.bam"
featureCounts -p -T $num_threads -t $feature_type -g $gene_attribute -s $strandedness -a $referenceannotation -o feature_counts.txt "$bam_out"/*.sorted.bam
fi
awk '{$2=$3=$4=$5=$6=""; print $0}' OFS='\t' feature_counts.txt | grep -v "#" | sed 's/\t\+/\t/g;s/^\t//' > temp.txt && mv temp.txt feature_counts.txt
}
Expand Down

0 comments on commit da3a62d

Please sign in to comment.