Skip to content

Commit

Permalink
Update_jabfeb2023
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswyatt1 committed Feb 3, 2023
1 parent c9ad9aa commit 762787c
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ work
trace*
results/*
Input_prot_gotits.txt
blastdb
2 changes: 1 addition & 1 deletion bin/blast2taxgenesummary.pl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

my $input = $ARGV[0];

my $OUT_file="Horizontal_assesment.tsv";
my $OUT_file="$input\_summary.tsv";

#initiaite groups from conversion file.
open(my $INPUT_IN, "<", $input) or die "Could not open $input \n";
Expand Down
48 changes: 48 additions & 0 deletions bin/tophitsonly.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/perl
#plot_event.pl
use strict;
use warnings;

die "Please specify (1) Blast hits\n" unless(@ARGV==1);


my $input = $ARGV[0];

my $OUT_file="tophitsonly.tsv";

#initiaite groups from conversion file.
open(my $INPUT_IN, "<", $input) or die "Could not open $input \n";
open(my $outhandle, ">", $OUT_file) or die "Could not open $OUT_file\n";

my %genes;

while (my $line=<$INPUT_IN>){
chomp $line;
my @split= split("\t", $line);

my $id= $split[0];
my $perc= $split[3];

if ($genes{$id}){
my $oldline=$genes{$id};
my @split2= split("\t", $oldline);

if ($perc > $split2[3]){
$genes{$id}="$line";
}
else{
#do nothing.
}

}
else{
$genes{$id}="$line";
}

}

foreach my $key ( sort keys %genes){

print $outhandle "$genes{$key}\n";

}
2 changes: 1 addition & 1 deletion conf/myriad.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ process {
penv = "smp"
cpus = 6
container = 'chriswyatt/diamond'
clusterOptions = '-l mem=40G -l h_rt=24:0:0 -l tmpfs=400G'
clusterOptions = '-l mem=20G -l h_rt=48:0:0 -l tmpfs=200G'
}
withLabel: "blastdb" {
penv = "smp"
Expand Down
9 changes: 6 additions & 3 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ params.predownloaded= false
params.outdir = "results"
params.names = false
params.nodes = false
params.numhits = null
params.tophits = null
params.level = "family"
params.sensitivity = "fast"
params.horizontal = false
Expand Down Expand Up @@ -88,11 +90,12 @@ workflow {


DIAMOND_BLAST ( input_target_proteins , input_database )

PLOT_PIE ( input_nodes , input_names , DIAMOND_BLAST.out.blast_hits )

if ( params.horizontal ){
DIAMOND_HORIZONTAL ( input_target_proteins , input_database )
}
//if ( params.horizontal ){
// DIAMOND_HORIZONTAL ( input_target_proteins , input_database )
//}

if ( params.xml ){
DIAMOND_XML ( input_target_proteins , input_database )
Expand Down
6 changes: 3 additions & 3 deletions modules/diamond_blast.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ process DIAMOND_BLAST {

script:
"""
diamond blastp --$params.sensitivity --max-target-seqs $params.numhits --query $proteins --db nr --out ${proteins}\_results.tsv --threads $task.cpus --outfmt 6 qseqid sseqid stitle pident evalue sphylums staxids
#rm nr.dmnd
#rm $proteins
diamond blastp --$params.sensitivity --top $params.tophits --query $proteins --db nr --out ${proteins}\_results.tsv --threads $task.cpus --outfmt 6 qseqid sseqid stitle pident evalue sphylums staxids
#rm nr.dmnd
#rm $proteins
"""
}
11 changes: 8 additions & 3 deletions modules/plot_taxonomy_pie.nf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
process PLOT_PIE {
label 'perl_pie'
publishDir "$params.outdir/Blast_results/"
//stageInMode 'copy'
publishDir "$params.outdir/Blast_results/", mode:'copy', pattern: '*top.tsv'
publishDir "$params.outdir/Taxo_figure/", mode:'copy', pattern: '*.pdf'
publishDir "$params.outdir/Taxo_summary/", mode:'copy', pattern: '*_summary.tsv'

input:
path nodes
Expand All @@ -15,6 +16,10 @@ process PLOT_PIE {

script:
"""
${workflow.projectDir}/bin/ncbi_txids_taxonomy.all.pl $nodes $names $blast_result
${workflow.projectDir}/bin/tophitsonly.pl $blast_result
mv tophitsonly.tsv ${blast_result}_top.tsv
${workflow.projectDir}/bin/ncbi_txids_taxonomy.all.pl $nodes $names ${blast_result}_top.tsv
blast2taxgenesummary.pl $blast_result
"""
}
1 change: 1 addition & 0 deletions modules/transdecoder.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
process T_DECODER {
label 'transdecoder'
publishDir "$params.outdir/Prot/", mode:'copy', pattern: '*.prot.fa'

input:
path fasta_file
Expand Down

0 comments on commit 762787c

Please sign in to comment.