#!usr/bin/perl
######################################################################
#
#Ian Odell
#Read Hep C fasta
#Compare sequences in an alignment to profiles
#
######################################################################
use strict;
use warnings;
use Bio::AlignIO;
use Bio::SeqIO;
use Bio::Seq;

my $inputfilename = "type4_probe.fasta";
my $outputfilename = ">type4_nonProfileProbe.fasta";
my $probe = "GCT--CA-A-T-G-CCT-GG--AG-A--TTT-GGG-C-GTG-CCCCCGC";
#my $probe2 = "";

#my $in  = Bio::AlignIO->new(-file => $inputfilename);
#my $aln = $in->next_aln();

my $in = Bio::SeqIO->new(-file => $inputfilename);

my @seq_array;
while (my $seq = $in->next_seq()) {
  push @seq_array, $seq;
}

my $tempseq;
my @seqarray;

foreach my $seq (@seq_array) {
  $tempseq = $seq->seq;
  if ($seq->seq ne $probe){# && $seq->seq ne $probe2) {
   push @seqarray, $seq;
  }
}

#foreach my $seq ($aln->each_seq) {
#  $tempseq = $seq->seq;
#  if ($seq->seq ne $probe){# && $seq->seq ne $probe2) {
#   push @seqarray, $seq;
#  }
#}

#write new alignments to their own files
my $out = Bio::SeqIO->new(-file => $outputfilename);
foreach my $seq (@seqarray) {
  $out->write_seq($seq);
}

