[med-svn] [Git][med-team/trnascan-se][upstream] New upstream version 2.0.9+ds

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Fri Jul 16 18:25:21 BST 2021



Nilesh Patra pushed to branch upstream at Debian Med / trnascan-se


Commits:
a3c63f64 by Nilesh Patra at 2021-07-16T17:19:14+00:00
New upstream version 2.0.9+ds
- - - - -


5 changed files:

- lib/tRNAscanSE/CM.pm
- lib/tRNAscanSE/Options.pm
- lib/tRNAscanSE/ScanResult.pm
- lib/tRNAscanSE/Tscan.pm
- tRNAscan-SE.src


Changes:

=====================================
lib/tRNAscanSE/CM.pm
=====================================
@@ -655,12 +655,38 @@ sub set_infernal_bin
     {
         die "FATAL: Unable to find ".$self->{cmsearch_bin}." executable\n\n";
     }
+    else
+    {
+        $self->check_infernal_version($self->{cmsearch_bin});
+    }
 
     $self->{cmscan_bin} = $bindir."/".$self->{cmscan_bin};
     if (!(-x $self->{cmscan_bin}))
     {
         die "FATAL: Unable to find ".$self->{cmscan_bin}." executable\n\n";
     }
+    else
+    {
+        $self->check_infernal_version($self->{cmscan_bin});
+    }
+}
+
+sub check_infernal_version
+{
+    my $self = shift;
+    my $exec_bin = shift;
+
+    my $cmd = $exec_bin." -h | grep INFERNAL";
+    my $line = `$cmd`;
+    my $version = 0;
+    if ($line =~ /INFERNAL 1.1.(\d+) /)
+    {
+        $version = $1;
+    }
+    if ($version < 2)
+    {
+        die "FATAL: ".$exec_bin." is incompatible with tRNAscan-SE. Please install Infernal version 1.1.2 or above.\n\n";
+    } 
 }
 
 sub set_search_params


=====================================
lib/tRNAscanSE/Options.pm
=====================================
@@ -100,6 +100,7 @@ sub initialize
     $self->{save_all_struct} = 0;        # save secondary structures if nonzero
     
     $self->{bed_file} = "";              # bed file
+    $self->{gff_file} = "";              # gff file
     $self->{output_fasta_file} = "";     # predicted tRNA fasta file
     $self->{all_struct_file} = "";       # sec struct file, set with -f option
     $self->{isotype_specific_file} = ""; # isotype specific result file
@@ -465,6 +466,13 @@ sub bed_file
     return $self->{bed_file};
 }
 
+sub gff_file
+{
+    my $self = shift;
+    if (@_) { $self->{gff_file} = shift; }
+    return $self->{gff_file};
+}
+
 sub output_fasta_file
 {
     my $self = shift;
@@ -907,6 +915,18 @@ sub display_run_options
             print $FHAND "$self->{bed_file}\n";
         }
     }
+    if ($self->{gff_file} ne "")
+    {
+        print $FHAND "tRNA predictions saved to:         ";
+        if ($self->{gff_file} eq "-")
+        {
+            print $FHAND "Standard output\n";
+        }
+        else
+        {
+            print $FHAND "$self->{gff_file}\n";
+        }
+    }
     if ($self->{output_fasta_file} ne "")
     {
         print $FHAND "Predicted tRNA sequences\n", "    saved to:                      ";


=====================================
lib/tRNAscanSE/ScanResult.pm
=====================================
@@ -20,7 +20,7 @@ use tRNAscanSE::Options;
 
 require Exporter;
 our @ISA = qw(Exporter);
-our @EXPORT = qw(save_Acedb_from_firstpass write_tRNA write_tRNAs output_tRNA write_bed output_split_fragments print_results_header);
+our @EXPORT = qw(save_Acedb_from_firstpass write_tRNA write_tRNAs output_tRNA write_bed write_gff output_split_fragments print_results_header);
 
 our $printed_header = 0;            # keeps track of whether or
                                     # or not results column header
@@ -1111,6 +1111,117 @@ sub convert_bed_score
 	return $bed_score;
 }
 
+sub write_gff
+{
+	my ($global_vars) = @_;
+	my $opts = $global_vars->{options};
+    my $sp_int_results = $global_vars->{sp_int_results};
+    my $iso_int_results = $global_vars->{iso_int_results};
+	
+	$sp_int_results->sort_records("bed_output");
+	if (!$opts->no_isotype())
+	{
+		$iso_int_results->sort_records("tRNAscan_id");
+	}
+	
+	my $tRNA = tRNAscanSE::tRNA->new;
+    &open_for_append(\*FILE_OUT, $opts->gff_file());
+	print FILE_OUT "##gff-version 3\n";
+    my @sp_indexes = $sp_int_results->get_indexes();
+    my @ iso_indexes = $iso_int_results->get_indexes();
+    if ($sp_int_results->open_file("read"))
+    {		
+		if (!$opts->no_isotype())
+		{
+			$iso_int_results->open_file("read");
+		}
+		
+		for (my $i = 0; $i < scalar(@sp_indexes); $i++)
+		{
+			$sp_int_results->get_tRNA($sp_indexes[$i]->[0], $tRNA);
+			
+			if (!$opts->no_isotype())
+			{
+				my $id = $tRNA->seqname().".t".&pad_num($tRNA->id(), 6);
+				my $index = $iso_int_results->bsearch_tRNAscan_id($id);
+				if ($index > -1)
+				{
+					$iso_int_results->get_tRNA($iso_indexes[$index]->[0], $tRNA);
+					my ($type, $model, $score, $ss) = $tRNA->get_highest_score_model();
+					if ($tRNA->isotype() eq "Met" and $type eq "cyto" and ($model eq "iMet" or $model eq "fMet" or $model eq "Ile2"))
+					{
+						$tRNA->isotype($model);
+						$tRNA->tRNAscan_id($tRNA->seqname().".tRNA".$tRNA->id()."-".$tRNA->isotype().$tRNA->anticodon());
+					}
+					elsif ($tRNA->isotype() eq "Met" and $type eq "cyto" and $model ne "Met" and $model ne "iMet" and $model ne "fMet")
+					{
+						$tRNA->sort_multi_models("model");
+						my ($met_iso_model, $met_iso_score, $met_iso_ss) = $tRNA->get_model_hit("cyto", $tRNA->isotype());
+						my ($ile2_iso_model, $ile2_iso_score, $ile2_iso_ss) = $tRNA->get_model_hit("cyto", "Ile2");
+						if ($ile2_iso_score > 0 and $met_iso_score > 0)
+						{
+							if (($score - $ile2_iso_score) <= 5 and ($ile2_iso_score - $met_iso_score) >= 5 and $tRNA->score() > 50)
+							{
+								$tRNA->isotype("Ile2");
+								$tRNA->tRNAscan_id($tRNA->seqname().".tRNA".$tRNA->id()."-".$tRNA->isotype().$tRNA->anticodon());
+							}
+						}
+					}
+				}				
+			}
+			my $biotype = "tRNA";			
+			if ($tRNA->is_pseudo())
+			{
+				$biotype = "pseudogene";
+			}
+			print FILE_OUT $tRNA->seqname()."\ttRNAscan-SE\t".$biotype."\t".$tRNA->start()."\t".$tRNA->end()."\t".$tRNA->score()."\t".$tRNA->strand()."\t.\t".
+				"ID=".$tRNA->seqname().".trna".$tRNA->id().";Name=".$tRNA->tRNAscan_id().";isotype=".$tRNA->isotype().";anticodon=".$tRNA->anticodon().
+				";gene_biotype=".$biotype.";\n";
+
+			if ($tRNA->get_intron_count() == 0)
+			{
+				print FILE_OUT $tRNA->seqname()."\ttRNAscan-SE\texon\t".$tRNA->start()."\t".$tRNA->end()."\t.\t".$tRNA->strand()."\t.\t".
+					"ID=".$tRNA->seqname().".trna".$tRNA->id().".exon1;Parent=".$tRNA->seqname().".trna".$tRNA->id().";\n";
+			}
+			else
+			{
+				my @ar_introns = $tRNA->ar_introns();
+				if ($tRNA->strand() eq "+")
+				{
+					print FILE_OUT $tRNA->seqname()."\ttRNAscan-SE\texon\t".$tRNA->start()."\t";
+					for (my $i = 0; $i < scalar(@ar_introns); $i++)
+					{
+						print FILE_OUT ($ar_introns[$i]->{start}-1)."\t.\t".$tRNA->strand()."\t.\t".
+							"ID=".$tRNA->seqname().".trna".$tRNA->id().".exon".($i+1).";Parent=".$tRNA->seqname().".trna".$tRNA->id().";\n";
+						print FILE_OUT $tRNA->seqname()."\ttRNAscan-SE\texon\t".($ar_introns[$i]->{end}+1)."\t";
+					}
+					print FILE_OUT $tRNA->end()."\t.\t".$tRNA->strand()."\t.\t".
+						"ID=".$tRNA->seqname().".trna".$tRNA->id().".exon".(scalar(@ar_introns)+1).";Parent=".$tRNA->seqname().".trna".$tRNA->id().";\n";
+				}
+				else
+				{
+					my $end = $tRNA->end();
+					for (my $i = 0; $i < scalar(@ar_introns); $i++)
+					{
+						print FILE_OUT $tRNA->seqname()."\ttRNAscan-SE\texon\t".($ar_introns[$i]->{end}+1)."\t".$end."\t.\t".$tRNA->strand()."\t.\t".
+							"ID=".$tRNA->seqname().".trna".$tRNA->id().".exon".($i+1).";Parent=".$tRNA->seqname().".trna".$tRNA->id().";\n";
+						$end = $ar_introns[$i]->{start} - 1;
+					}
+					print FILE_OUT $tRNA->seqname()."\ttRNAscan-SE\texon\t".$tRNA->start()."\t".$end."\t.\t".$tRNA->strand()."\t.\t".
+						"ID=".$tRNA->seqname().".trna".$tRNA->id().".exon".(scalar(@ar_introns)+1).";Parent=".$tRNA->seqname().".trna".$tRNA->id().";\n";
+				}
+			}			
+		}
+		
+		if (!$opts->no_isotype())
+		{
+			$iso_int_results->close_file();
+		}
+		$sp_int_results->close_file();
+	}
+	close(FILE_OUT);
+}
+
 sub output_split_fragments
 {
     my ($opts, $r_pairs, $r_5half_hits, $r_3half_hits) = @_;                     


=====================================
lib/tRNAscanSE/Tscan.pm
=====================================
@@ -230,11 +230,11 @@ sub process_tRNAscan_hits
             {
                 if ($trna->strand() eq "+")
                 {
-                    $trna->end() = $trna->start() + length($trna->seq()) - 1;
+                    $trna->end($trna->start() + length($trna->seq()) - 1);
                 }
                 else
                 {
-                    $trna->end() = $trna->start() - length($trna->seq()) + 1;
+                    $trna->end($trna->start() - length($trna->seq()) + 1);
                 }
             }
             


=====================================
tRNAscan-SE.src
=====================================
@@ -4,7 +4,7 @@
 # tRNAscan-SE: a program for improved detection of transfer RNA
 #              genes in genomic sequence
 #
-# Version 2.0.8
+# Version 2.0.9
 #
 # Copyright (C) 2021 Patricia Chan and Todd Lowe 
 #
@@ -39,8 +39,8 @@ use tRNAscanSE::IntResultFile;
 use tRNAscanSE::MultiResultFile;
 use tRNAscanSE::SS;
 
-our $version = "2.0.8"; 
-our $release_date = "May 2021";
+our $version = "2.0.9"; 
+our $release_date = "July 2021";
 our $program_id = "tRNAscan-SE-".$version;
 
 # modified by 'make'
@@ -481,6 +481,14 @@ sub run_cm_scan
                 &write_bed(\%global_vars);
             }
         }
+
+        if ($opts->gff_file() ne "")
+        {
+            if ($curseq_trnact > 0)
+            {
+                &write_gff(\%global_vars);
+            }
+        }
         
         $sp_int_results->clear_index();
         $curseq_trnact = 0;
@@ -695,6 +703,7 @@ sub print_all_options
     "  -m  --stats <file>          : save statistics summary for run in <file>\n",
     "                                  (speed, # tRNAs found in each part of search, etc)\n",        
     "  -b  --bed <file>            : save results in BED file format of <file>\n",
+    "  -j  --gff <file>            : save results in GFF3 file format of <file>\n",
     "  -a  --fasta <file>          : save predicted tRNA sequences in FASTA file format of <file>\n",
     "  -l  --log <file>            : save log of program progress in <file>\n",
     "  --detail                    : display prediction outputs in detailed view\n",
@@ -762,7 +771,7 @@ sub set_options
     our $opt_cove=0; our $opt_mid=0; our $opt_max=0; our $opt_eufind=0; our $opt_tscan=0;
     our $opt_ncintron=0; our $opt_frag='';
     our $opt_breakdown=0; our $opt_nopseudo=0; our $opt_nomerge=0; our $opt_hitsrc=0;
-    our $opt_output=''; our $opt_struct=''; our $opt_stats=''; our $opt_isospecific=''; our $opt_bed=''; our $opt_fasta=''; our $opt_brief=0;
+    our $opt_output=''; our $opt_struct=''; our $opt_stats=''; our $opt_isospecific=''; our $opt_bed=''; our $opt_gff=''; our $opt_fasta=''; our $opt_brief=0;
     our $opt_detail=0;
     our $opt_prefix=''; our $opt_match=''; our $opt_search='';
     our $opt_gencode=''; our $opt_codons=0;
@@ -789,7 +798,7 @@ sub set_options
                             # file name input specifiers
                             "gencode|g=s",
                             # file name output specifiers 
-                            "output|o=s", "stats|m=s", "struct|f=s", "bed|b=s", "fasta|a=s", "isospecific|s=s", "acedb", "brief",
+                            "output|o=s", "stats|m=s", "struct|f=s", "bed|b=s", "gff|j=s", "fasta|a=s", "isospecific|s=s", "acedb", "brief",
                             "fsres|r=s","verbose|v=s","w=s","falsepos|F=s","missed=s", "detail",
                             #string parameters
                             "prefix|p=s","match=s","search=s","emode=s","tmode=s",
@@ -1614,6 +1623,30 @@ sub set_options
         }
         &check_output_file($opts->bed_file(), $opts->prompt_for_overwrite());            
     }
+
+    if ($opt_gff ne "")
+    {
+        if ($opt_gff eq "#")
+        {
+            $opts->gff_file("$fafile.gff");        
+        }
+        elsif (($opt_gff eq "\$") || ($opt_gff eq "-"))
+        {                                               
+            $opts->gff_file("-");
+            
+            # sends output to stdout instead of tabular output
+            if ($opts->results_to_stdout())
+            {
+                $opts->results_to_stdout(0);
+                $opts->out_file("/dev/null");      
+            }  
+        }
+        else
+        {
+            $opts->gff_file($opt_gff);
+        }
+        &check_output_file($opts->gff_file(), $opts->prompt_for_overwrite());            
+    }
     
     if ($opt_fasta ne "")
     {



View it on GitLab: https://salsa.debian.org/med-team/trnascan-se/-/commit/a3c63f643dcc82edcab382d1fd1451bb08485593

-- 
View it on GitLab: https://salsa.debian.org/med-team/trnascan-se/-/commit/a3c63f643dcc82edcab382d1fd1451bb08485593
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210716/32a6ac0d/attachment-0001.htm>


More information about the debian-med-commit mailing list