#!/usr/bin/perl
# Description:
# Get the column of contig and repeattype in repeatMasker .out file and mapping toi the template coverage profile in the .depth file, and generate the mapping file of the coverage file.
#
# Author: Andy
#
# Input file:
# [0] repeatmasker .out file
# [1] .depth file (from alang)
#
# Output format:
# contig RepeatName Coverage file ...
#
# Output file
# ana.RepeatElementCoverageInContigs_v1.modifyRepeatMaskerOutFile is the fileter header and add the number
# ana.RepeatElementCoverageInContigs_v1.IntegerOutFile is the table integrate data
#
# Sample
# perl RepeatElementCoverageInContigs_v1.pl 454AllContigs_change.fna.out 454AllContigs_change.depth
#
# Time: 2010.09.21
use strict;
die "Error:$0 RepeatMasker.out(file) CoverageFile(.depth) " unless ($#ARGV == 1);
# Open the two file
open (my $maskerOutFile, $ARGV[0]);
open (my $depthFile, $ARGV[1]);
open (my $analysisMaskerOutFile, ">".$ARGV[0].".ana.RepeatElementCoverageInContigs_v1.modifyRepeatMaskerOutFile");
open (my $analysisIntegrateOutFile, ">".$ARGV[0].".ana.RepeatElementCoverageInContigs_v1.IntegerOutFile");
# Filter the maskerOutfile
my ($title, $title2, $space, @lines) = <$maskerOutFile>; # Dsicare the header information for the masker .out file
my $count = 1;
my @statistics = <$depthFile>;
foreach my $line (@lines) {
# Analysis the repeat masker outfile
$line =~ s/^\s+//;
my @token = split (/\s+/, $line);
print $analysisMaskerOutFile "$count\t\t$line";
# Assing need process columns
my ($contigName, $repeatName)=($token[4],$token[9]);# token4 is the contigname name and token9 is the repeat name
# Compare the contigs name to static file
foreach my $statisticLine (@statistics) {
# Print the all columns
if ($statisticLine =~ /^$contigName/ ) {
print $analysisIntegrateOutFile "$count\t$contigName\t$repeatName\t$statisticLine";
}
}# end compare the contigs to statistic file
$count++;
print "." if ($count % 1000 == 0);
} # End for eachc line in MakerOutput file
# End the program close file
close $maskerOutFile;
close $depthFile;
close $analysisIntegrateOutFile;
close $analysisMaskerOutFile;
2010年9月22日 星期三
DNASequenceComplement.pl
{{{
#!/usr/bin/perl
#
# Andy 20100920 reverse the string
#
# Sample:
# echo "ell" | test.pl
# DNASequence.pl DNAFile
#
# out:
# four different sequence
# Original, rever dna,
# Origianl complement, reversa complement
use strict;
# Reverse the contnet
my $DNA = <>;
chomp($DNA);
print ("Original sequence: $DNA\n");
my $reverseDNA = DNAReverse($DNA);
print ("Reverse sequence: $reverseDNA\n");
my $complementDNA = DNAComplement($DNA);
print ("postive complement sequence: $complementDNA\n");
my $reverseComplementDNA = DNAComplement($reverseDNA);
print ("Nagative complement sequence: $reverseComplementDNA");
#=======================================================================
# Need a DNA sequence
# Paramenter:
# DNA sequence as the parameter zero and to reverit
#=========================================================================
sub DNAReverse () {
chomp($_[0]);
my $reverse = reverse($_[0]);
#print "reverse: $reverse\n";
return $reverse;
}
# change the content for
#my $string = "hello Andy";
#print substr($string, 6, 1);
#=====================================================
# Action the DNA complement
# Parameter:
# [0] is the DNA and change to the complement
#
# MEthod:
# A->T,
# T->A,
# G->C,
# C->G
#
# Return
# complement array
#
#================================================================
sub DNAComplement () {
# Declare the hash of chage complemt content
my %complementHash = ("A"=> "T", "T" => "A", "G" => "C", "C" => "G");
#print "hash array $complementHash{'A'}"; # Test OK
# Declare the complement DNA sequence
my $complementDNA;
# Preprocess the parameter
chomp($_[0]);
my $DNA = $_[0];
#print "hash DNA: $DNA\n"; # for deub
# Run the change method
for (my $i = 0; $i < length($DNA); $i++)
{
my $unit = $complementHash{ substr($DNA, $i, 1) };
#print ($unit);
$complementDNA = $complementDNA.$unit;
#print ("complement $complementDNA");
} # end process the complement for string
return $complementDNA;
}
}}}
#!/usr/bin/perl
#
# Andy 20100920 reverse the string
#
# Sample:
# echo "ell" | test.pl
# DNASequence.pl DNAFile
#
# out:
# four different sequence
# Original, rever dna,
# Origianl complement, reversa complement
use strict;
# Reverse the contnet
my $DNA = <>;
chomp($DNA);
print ("Original sequence: $DNA\n");
my $reverseDNA = DNAReverse($DNA);
print ("Reverse sequence: $reverseDNA\n");
my $complementDNA = DNAComplement($DNA);
print ("postive complement sequence: $complementDNA\n");
my $reverseComplementDNA = DNAComplement($reverseDNA);
print ("Nagative complement sequence: $reverseComplementDNA");
#=======================================================================
# Need a DNA sequence
# Paramenter:
# DNA sequence as the parameter zero and to reverit
#=========================================================================
sub DNAReverse () {
chomp($_[0]);
my $reverse = reverse($_[0]);
#print "reverse: $reverse\n";
return $reverse;
}
# change the content for
#my $string = "hello Andy";
#print substr($string, 6, 1);
#=====================================================
# Action the DNA complement
# Parameter:
# [0] is the DNA and change to the complement
#
# MEthod:
# A->T,
# T->A,
# G->C,
# C->G
#
# Return
# complement array
#
#================================================================
sub DNAComplement () {
# Declare the hash of chage complemt content
my %complementHash = ("A"=> "T", "T" => "A", "G" => "C", "C" => "G");
#print "hash array $complementHash{'A'}"; # Test OK
# Declare the complement DNA sequence
my $complementDNA;
# Preprocess the parameter
chomp($_[0]);
my $DNA = $_[0];
#print "hash DNA: $DNA\n"; # for deub
# Run the change method
for (my $i = 0; $i < length($DNA); $i++)
{
my $unit = $complementHash{ substr($DNA, $i, 1) };
#print ($unit);
$complementDNA = $complementDNA.$unit;
#print ("complement $complementDNA");
} # end process the complement for string
return $complementDNA;
}
}}}
My Program
ID PrgramName Time Explain
1. DNASequenceComplement.pl 2010.09.20 can look the sequence order, complement
2. RepeatElementCoverageInContigs_v1.pl 10.09.23 can integreate the repeat masker output and depth file in one table
1. DNASequenceComplement.pl 2010.09.20 can look the sequence order, complement
2. RepeatElementCoverageInContigs_v1.pl 10.09.23 can integreate the repeat masker output and depth file in one table
訂閱:
文章 (Atom)