Parse assemblage ITC EST-TOBEA EST: Difference between revisions

From RAJ INFO
Jump to navigation Jump to search
Created page with '<source lang=perl> #! /usr/bin/perl -w # ************************************************************* # This Programme does the following in sequence # -> Assembles ITC and TO…'
 
No edit summary
 
Line 4: Line 4:
# *************************************************************
# *************************************************************
# This Programme does the following in sequence
# This Programme does the following in sequence
# -> Assembles ITC and TOEA ESTs
# -> Parses the TGCL results and assembles as singlets and contigs
# -> Multicored
# -> single cored
# Author : Rajkumar (itc@rajkumar.in)
# Author : Rajkumar (itc@rajkumar.in)
# Release: APR 2010
# Release: MAY 2010
# *************************************************************
# *************************************************************
   
   
Line 15: Line 15:
use Bio::SearchIO;
use Bio::SearchIO;
use Parallel::ForkManager;
use Parallel::ForkManager;
 
   
   
# At the top: Time Start
# At the top: Time Start
Line 21: Line 21:
   
   
# Variables
# Variables
my $path     = "/home/raj/bio";
my $path         = "/home/raj/bio";
my $datadir  = "$path/tobacco/data";
my $curdir        = "$path/tobacco/data";
my $est     = "$datadir/est.fa";
my $resdir        = "$curdir/unigene_result";
my $resdir = "$datadir/unigene_result";
my $singlets     = "$resdir/singlets";
my $contigs      = "$resdir/contigs";
my $tgicl  = "$path/tgicl/tgicl";
my $singlets_temp = "$resdir/singlets_temp";
my $cpu    = "16";
my $contigs_temp  = "$resdir/contigs_temp";
my $unigenes      = "$curdir/unigenes.fa";
 
 
my ($i)    = $_;
my ($i)    = $_;
my (@files)= @_;
my (@asm) = @_;
   
   
# Clear the Files
# Clear the Files
if (-e "$resdir") {`rm -fr $resdir`;}
if (-e "$singlets") {`rm $singlets`;}
if (! -e "$resdir") {`mkdir $resdir`;}
if (-e "$contigs") {`rm  $contigs`;}
if (-e "$singlets_temp") {`rm  $singlets_temp`;}
if (-e "$contigs_temp") {`rm  $contigs_temp`;}
if (-e "$unigenes") {`rm  $unigenes`;}




# Parsing the Contigs
# Parsing the Contigs
chdir "$resdir";
 
`$tgicl $est -c $cpu -l 40 -p 94 -M`;
opendir (DIR, "$resdir") or die $!;
# -l miminum overlap length (default 40)
@asm = readdir(DIR);
# -M ignore lower-case masking in <fasta_db> sequences
close(DIR);
# -p minimum percent identity for overlaps <PID> (default 94)
 
foreach my $asm (@asm) {
if ($asm !~ m/^asm_/) {next;}
 
`cat $resdir/$asm/contigs >>$contigs_temp`;
`cat $resdir/$asm/singlets >>$singlets_temp`;
}
 
 
# Renaming and Writing the final Unigenes (contigs)
my $in  = Bio::SeqIO->new(-file => "$contigs_temp", -format => 'Fasta');
my $identifier;
my $sequence;
 
while ( my $seq = $in->next_seq() ) {
$identifier = $seq->id;
  $sequence = $seq->seq;
 
$identifier = "UNI_CON_".$identifier;
 
my ($fasta) = $_;
$fasta = ">$identifier\n$sequence\n";
open (F, ">>".$unigenes);
print F $fasta;
close F;
 
}
 
 
# Renaming and Writing the final Unigenes (singlets)
$in  = Bio::SeqIO->new(-file => "$singlets_temp", -format => 'Fasta');
 
while ( my $seq = $in->next_seq() ) {
$identifier = $seq->id;
  $sequence = $seq->seq;
 
$identifier = "UNI_SIN_".$identifier;
 
my ($fasta) = $_;
$fasta = ">$identifier\n$sequence\n";
open (F, ">>".$unigenes);
print F $fasta;
close F;
 
}
 
print "\n\tAll Done!\n\n";
print "\n\tAll Done!\n\n";
# At the End: Time Calculation
# At the End: Time Calculation
my ($sec_,$min_,$hour_,$mday_,$mon_,$year_,$wday_,$yday_,$isdst_) = localtime(time);
my ($sec_,$min_,$hour_,$mday_,$mon_,$year_,$wday_,$yday_,$isdst_) = localtime(time);
Line 60: Line 114:
   
   
# END
# END
</source>
</source>


[[Category: Bioinformatics]]
[[Category: Bioinformatics]]

Latest revision as of 02:47, 8 May 2010

#! /usr/bin/perl -w
 
# *************************************************************
# This Programme does the following in sequence
# -> Parses the TGCL results and assembles as singlets and contigs
# -> single cored
# Author : Rajkumar (itc@rajkumar.in)
# Release: MAY 2010
# *************************************************************
 
# Libraries
	use strict;
	use Bio::Perl;
	use Bio::SearchIO;
	use Parallel::ForkManager;
 
 
# At the top: Time Start
	my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
 
# Variables
	my $path          = "/home/raj/bio";
	my $curdir        = "$path/tobacco/data";
	my $resdir        = "$curdir/unigene_result";
	my $singlets      = "$resdir/singlets";
	my $contigs       = "$resdir/contigs";
	my $singlets_temp = "$resdir/singlets_temp";
	my $contigs_temp  = "$resdir/contigs_temp";
	my $unigenes      = "$curdir/unigenes.fa";

  
	my ($i)    = $_;
	my (@asm)  = @_;
 
# Clear the Files
	
	if (-e "$singlets") {`rm  $singlets`;}
	if (-e "$contigs") {`rm  $contigs`;}
	if (-e "$singlets_temp") {`rm  $singlets_temp`;}
	if (-e "$contigs_temp") {`rm  $contigs_temp`;}
	if (-e "$unigenes") {`rm  $unigenes`;}


# Parsing the Contigs

	opendir (DIR, "$resdir") or die $!;
	@asm = readdir(DIR);
	close(DIR);

 	foreach my $asm (@asm) {
		if ($asm !~ m/^asm_/) {next;}

		`cat $resdir/$asm/contigs >>$contigs_temp`;	
		`cat $resdir/$asm/singlets >>$singlets_temp`;
	}


# Renaming and Writing the final Unigenes (contigs)
	
	my $in  = Bio::SeqIO->new(-file => "$contigs_temp", -format => 'Fasta');
	my $identifier;
	my $sequence;

	while ( my $seq = $in->next_seq() ) {
		$identifier = $seq->id;
  		$sequence = $seq->seq;

		$identifier = "UNI_CON_".$identifier;

		my ($fasta) = $_;
		$fasta = ">$identifier\n$sequence\n";
 
		open (F, ">>".$unigenes);
		print F $fasta;
		close F;

	}


# Renaming and Writing the final Unigenes (singlets)
	
	$in  = Bio::SeqIO->new(-file => "$singlets_temp", -format => 'Fasta');

	while ( my $seq = $in->next_seq() ) {
		$identifier = $seq->id;
  		$sequence = $seq->seq;

		$identifier = "UNI_SIN_".$identifier;

		my ($fasta) = $_;
		$fasta = ">$identifier\n$sequence\n";
 
		open (F, ">>".$unigenes);
		print F $fasta;
		close F;

	}

	print "\n\tAll Done!\n\n";
 
# At the End: Time Calculation
	my ($sec_,$min_,$hour_,$mday_,$mon_,$year_,$wday_,$yday_,$isdst_) = localtime(time);
	my $days  = $mday_-$mday;
	my $hours = $hour_-$hour;
	my $mins  = $min_-$min;
	my $secs  = $sec_-$sec;
	print "\n------------------------\nDuration: ";
	if ($days>0) { print "$days days";}
	if ($hours>0) { print ": $hours hours";}
	if ($mins>0) { print ": $mins mins";}
	if ($secs>0) { print ": $secs secs";}
	print "\n------------------------\n";
 
# END