#!/usr/bin/perl -w

use warnings;
use strict;

open IN, "contigs.fa" or die;       # the file is the output file in the pipeline "velvet";
open OUT, ">contigs_1.fa" or die; 

#my (%tables,@sequences);
my $sequences;
my @temp;
my $i=0;

while (<IN>) {
	chomp;
	push @temp, $_;
}
print $#temp,"\n";
foreach (@temp){
	$i++;
	next,if($_ =~ /^[ATGC]+/i);
		
	if($_ =~ /^>NODE/){
	my @info=split /\_/,$_;
	
	#next, if($info[3] gt 130);
	
	if($info[3] gt 100){
	        $sequences=$temp[$i].$temp[$i+1].$temp[$i+2];
		if ($sequences=~ /^TGCAG[ATCG]+CTGCA$/i){	
	                     print OUT $_."\n".$sequences."\n";
	                     }
	}else{
	$sequences=$temp[$i].$temp[$i+1];
	if ($sequences=~/^TGCAG[ATCG]+CTGCA$/i){	
	print OUT $_."\n$sequences\n";
	}
		}
	
	}
}
close IN;