Rename ESTs: 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 # -> Reads the 2 files…'
 
No edit summary
Line 84: Line 84:
$sequence = $seq->seq;
$sequence = $seq->seq;
   
   
  $identifier = "TGI_SIG_".$identifier;
  $identifier = "TOBEA_EST_CON_".$identifier;
   
   
my ($fasta) = $_;
my ($fasta) = $_;

Revision as of 16:44, 7 May 2010

#! /usr/bin/perl -w
 
# *************************************************************
# This Programme does the following in sequence
# -> Reads the 2 files (TGI)
# -> Reads the fasta, name appropriately and writes a concatenated outfile
# Author : Rajkumar (itc@rajkumar.in)
# Release: APR 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 $datadir  = "$path/tobacco/data";
	my $itc_est  = "$datadir/est_contig.fa";
	my $tobea_est= "$datadir/tobea_unigene.fa";
	my $outfile  = "$datadir/est.fa";
 
	my $pm = new Parallel::ForkManager(4);
 
	my ($i)    = $_;
	my (@files)= @_;
 
 
 
# Clear the Files
 
	if (-e "$outfile") {`rm $outfile`;}
 
 
# Parsing the Contigs
	print "\n\tParsing ITC Unigenes..";
 
	my $in  = Bio::SeqIO->new(-file => "$itc_est", -format => 'Fasta');
	my $identifier;
	my $sequence;
 
	while ( my $seq = $in->next_seq() ) {
 
		$pm->start and next;
 
		$identifier = $seq->id;
		$sequence = $seq->seq;
 
	  	$identifier = "ITC_EST_CON_".$identifier;
 
		my ($fasta) = $_;
		$fasta = ">$identifier\n$sequence\n";
 
		open (F, ">>".$outfile);
		print F $fasta;
		close F;
 
		$pm->finish;
	}
 
	$pm->wait_all_children;
	print " Done!\n";
 
 
 
# Parsing the Singlet
 
	print "\n\tParsing tobea unigenes..";
 
	$in  = Bio::SeqIO->new(-file => "$tobea_est", -format => 'Fasta');
 
	while ( my $seq = $in->next_seq() ) {
 
		$pm->start and next;
 
		$identifier = $seq->id;
		$sequence = $seq->seq;
 
	  	$identifier = "TOBEA_EST_CON_".$identifier;
 
		my ($fasta) = $_;
		$fasta = ">$identifier\n$sequence\n";
 
		open (F, ">>".$outfile);
		print F $fasta;
		close F;
 
		$pm->finish;
	}
 
	$pm->wait_all_children;
	print " Done!\n";
 
 
	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