User Tools

Site Tools


Sidebar

This is the sidebar. Without it, the main text is too wide!

post_phylosift.pl

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.txt · Last modified: 2018/01/31 16:26 by hyjeong