post_phylosift.pl
This is an old revision of the document!
post_phylosift.pl
#!/usr/bin/perl
#
# argument 1: phylosift output directory (PS_temp)
# argument 2: marker ID (DNGNG...)
if (scalar @ARGV < 2) {
print STDERR "You didn's speficied enough arguments!\n";
exit;
}
$outdir = $ARGV[0] or 'PS_temp';
opendir OUTDIR, $outdir;
@org_dir = grep { not /^\./ } readdir OUTDIR;
print STDERR "Organisms detected: @org_dir"\n;
closedir OUTDIR;
$final = "$ARGV[1].fsa";
unlink $final if -f $final;
open ALIGN, ">>$final";
foreach my $org (sort @org_dir) {
my @t = split /\./, $org;
pop @t;
$seq_id = join '.', @t;
# print "Seq ID: $seq_id\n";
$fasta = "$ARGV[0]/$org/alignDir/$ARGV[1].codon.updated.1.fasta";
$fasta = "$ARGV[0]/$org/alignDir/$ARGV[1].long.1.fasta" if $ARGV[1] =~ /16s_reps_bac/;
open RESULT, $fasta or print STDERR "Can't open file $fasta for reading!\n";
while (<RESULT>) {
chomp;
if (/^>(\S+)/) {
print ALIGN ">$seq_id $1\n";
} else {
print ALIGN $_, "\n";
}
}
close RESULT;
}
post_phylosift.pl.1517383590.txt.gz · Last modified: (external edit)
