Parse assemblage ITC EST-TOBEA EST: Difference between revisions
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 | ||
# -> | # -> Parses the TGCL results and assembles as singlets and contigs | ||
# -> | # -> single cored | ||
# Author : Rajkumar (itc@rajkumar.in) | # Author : Rajkumar (itc@rajkumar.in) | ||
# Release: | # 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 | my $path = "/home/raj/bio"; | ||
my $ | my $curdir = "$path/tobacco/data"; | ||
my $ | my $resdir = "$curdir/unigene_result"; | ||
my $resdir | my $singlets = "$resdir/singlets"; | ||
my $contigs = "$resdir/contigs"; | |||
my $ | my $singlets_temp = "$resdir/singlets_temp"; | ||
my $ | my $contigs_temp = "$resdir/contigs_temp"; | ||
my $unigenes = "$curdir/unigenes.fa"; | |||
my ($i) = $_; | my ($i) = $_; | ||
my (@ | my (@asm) = @_; | ||
# Clear the Files | # Clear the Files | ||
if (-e "$ | if (-e "$singlets") {`rm $singlets`;} | ||
if ( | 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 | ||
`$ | 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"; | 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