Make data file ssr.pl: Difference between revisions

From RAJ INFO
Jump to navigation Jump to search
m New page: <source lang=perl> #! /usr/bin/perl -w # ************************************************************* # This Programme does the following in sequence # -> Open a multi fasta file # -> C...
 
mNo edit summary
Line 23: Line 23:
my $datadir      = "$path/euca/data/camal";
my $datadir      = "$path/euca/data/camal";
my $infile      = "$datadir/camal_all.fa";
my $infile      = "$datadir/camal_all.fa";
my $outdir      = "$path/euca/ssr/data";
my $outdir      = "$path/euca/ssr/glo-gra-ssr";
my $grand_infile = "$path/euca/data/grandis/scaffold/ssr/scaf_ssr.fa";
my $grand_infile = "$path/euca/data/grandis/scaffold/ssr/scaf_ssr.fa";
my $temp        = "$path/euca/ssr/temp";
my $temp        = "$path/euca/ssr/temp";

Revision as of 10:09, 30 December 2009

#! /usr/bin/perl -w


# *************************************************************
# This Programme does the following in sequence
# -> Open a multi fasta file
# -> Count the number of bases in each fasta
# -> Filter off the seq that have less than 600bp
# -> combine camal and grandis sequeces
# -> Output as fasta
# Author: Rajkumar (itc@rajkumar.in)

# *************************************************************

# Libraries
	use strict;
	use Bio::SeqIO;
	use Bio::Perl;

# Variables
	my $path         = "/home/raj/bio";
	my $datadir      = "$path/euca/data/camal";
	my $infile       = "$datadir/camal_all.fa";
	my $outdir       = "$path/euca/ssr/glo-gra-ssr";
	my $grand_infile = "$path/euca/data/grandis/scaffold/ssr/scaf_ssr.fa";
	my $temp         = "$path/euca/ssr/temp";
	my $outfile      = "camal_grand.fa";
	

# Making the res dir clear
	
	if (-e "$outdir/$outfile") {`rm $outdir/$outfile`; }
	if (-e "$temp") {`rm $temp`; }
	
		
	my $in  = Bio::SeqIO->new(-file => "$infile", -format => 'Fasta');
	my $identifier;
	my $sequence;
	
	while ( my $seq = $in->next_seq() ) {
		$identifier = $seq->id;
  		$sequence = $seq->seq;
	  		
  		my $length = ($sequence =~ tr/[A-Z]|[a-z]//);
		
		
		
		if ( $length < 600 ) { next; }
		$identifier =~ s/\|/_/g;
		$identifier =~ s/(.+)/CAMAL_$1/g;
		$identifier =~ s/(.+)_$/$1/g;

		my $fasta  = ">$identifier\n$sequence\n";
		open (FH, ">>".$temp);
		print FH $fasta;
		close FH ;
	}
	
# Making a common inputfile for SSR mining
	
	chdir $outdir;
	`cat $temp $grand_infile >$outdir/$outfile`;
	
	`rm $temp`; 

# END