-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from N-Hoffmann/stringtie
Add stringtie2 support
- Loading branch information
Showing
16 changed files
with
390 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
|
||
# Format a gtf file with only 12 fields if more (to be used by overlap) | ||
|
||
#!/bin/bash | ||
|
||
|
||
# Format a bed file to an tabulated bed | ||
|
||
# USAGE | ||
|
||
usage() { | ||
echo "#" >&2 | ||
echo "# Format a gtf 12+ in cleaned gtf 12 to be used by overlap...">&2 | ||
echo "# USAGE: `basename $0` <file.gtf>">&2 | ||
|
||
} | ||
################################################################################ | ||
infile=$1 | ||
|
||
if [ -p /dev/stdin ];then | ||
|
||
#from STDIN | ||
cat /dev/stdin | awk '{for (i=1;i<9;i++) {printf("%s\t",$i) }; for (i=9;i<=NF;i++) {printf("%s ",$i)}; print ""}' | ||
|
||
elif [ $# -eq 1 ];then | ||
|
||
awk '{for (i=1;i<9;i++) {printf("%s\t",$i) }; for (i=9;i<=NF;i++) {printf("%s ",$i)}; print ""}' $infile | ||
|
||
else | ||
echo "#Error! no argument file or file empty !" | ||
usage; | ||
exit 0; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
process GFFCOMPARE { | ||
conda (params.enable_conda ? "bioconda::gffcompare" : null) | ||
container "${ workflow.containerEngine == 'singularity' ? | ||
'https://depot.galaxyproject.org/singularity/gffcompare:0.12.6--h9f5acd7_0' : | ||
'biocontainers/gffcompare:0.12.6--h9f5acd7_0' }" | ||
publishDir "$params.outdir/stringtie2", mode: 'copy', pattern: 'extended_annotations.gtf' | ||
cpus params.maxCpu | ||
|
||
input: | ||
input: | ||
path reference_gtf | ||
path fasta | ||
path merged_gtf | ||
|
||
output: | ||
path("*.annotated.gtf"), emit: annotated_gtf | ||
path("*.loci") , emit: loci | ||
path("*.stats") , emit: stats | ||
path("*.tracking") , emit: tracking | ||
path("extended_annotations.gtf"), emit: stringtie_gtf | ||
|
||
shell: | ||
''' | ||
gffcompare \ | ||
-r !{reference_gtf} \ | ||
-s !{fasta} \ | ||
!{merged_gtf} | ||
#Reformat the output of gffcompare to correctly match novel isoforms to known genes | ||
awk 'BEGIN{ | ||
while(getline<"gffcmp.tracking">0){ | ||
if ($4 !="u" && $4 !="r"){ | ||
split($3,gn,"|"); | ||
split($5,tx,"|"); | ||
final["\\""tx[2]"\\";"]="\\""gn[1]"\\";" | ||
} | ||
} | ||
} { | ||
if ($12 in final){ | ||
$10=final[$12]; print $0} else {print $0} | ||
}' !{merged_gtf} | gtf2gtf_cleanall.sh > extended_annotations.gtf | ||
''' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
process MERGE_COUNTS { | ||
publishDir "$params.outdir/stringtie2", mode: 'copy', pattern: '*.txt' | ||
|
||
input: | ||
path gene_counts | ||
path tx_counts | ||
|
||
output: | ||
path "counts_gene.txt", emit: gene_counts | ||
path "counts_transcript.txt", emit: tx_counts | ||
path "empty.ndr", emit: ndr | ||
|
||
shell: | ||
''' | ||
# Merge the individual outputs of featurecount of each .bam into a single file | ||
paste !{gene_counts} \ | ||
| awk '{printf("%s ",$1); for (i=2;i<=NF;i+=2){printf("%s ",$i)}print "\\n"}' \ | ||
| grep -v -e "^$" \ | ||
| awk -v OFS='\\t' '{$1=$1}1' > counts_gene.txt | ||
paste !{tx_counts} \ | ||
| awk '{printf("\\n%s %s ",$1,$2); for (i=3;i<=NF;i+=3){printf("%s ",$i)}}' \ | ||
| grep -v -e "^$" \ | ||
| awk -v OFS='\\t' '{$1=$1}1' > counts_transcript.txt | ||
# Create empty NDR file for TFKMERS to have same workflow as bambu in filtering step | ||
# (placeholder, not used) | ||
touch empty.ndr | ||
''' | ||
} |
Oops, something went wrong.