I am looking for a solution in both Bash/Linux and Python.

Also,

If more than 40%[Aa]’s or [Tt]’s present, remove the sequence and the description.

e.g. file.fasta

    >seq1
    GGCAGAGGCCCCCTAGCCCCGCCCGCGCCATGGTCAGGCACGCCCCTCCTCATCGCGGGGCACAGCCCGGCGGGTAGCCCCAGCGCTGGAGGCGGGCGGGGCCGGCCGGCGGAGGCCTGAGCAGCAGCCCAGCGCGGGCCGCCGAGACACCATGAGAGCCCCCACACTCCTCGCCCCACCGGCCCTGGCCGCACTGGGCACCGCTGGCCGGGCGGGTGGGTGCCCC

    >seq2
    CCACTGCACTCACCGCACCCGGCCAATTTTTTTTGTGTTTTTAGTAGAGACTAAATACCATATAGTGAACACCTAAGACGGGGGGCCTTGGATCCAGGGCGATTCAGAGGGCCCCGGTCGGAGCTGTCGGAGATTGAGCGCGCGCGGTCCCGGGATCTCCGACGAGGCCCTGGACCCCCGGGCGGCGAAGCTGCGGCGCGGCGCCCCCTGGAGGCCGCGGGACCCCTG

After processing, output should be:

    >seq1
    GGCAGAGGCCCCCTAGCCCCGCCCGCGCCATGGTCAGGCACGCCCCTCCTCATCGCGGGGCACAGCCCGGCGGGTAGCCCCAGCGCTGGAGGCGGGCGGGGCCGGCCGGCGGAGGCCTGAGCAGCAGCCCAGCGCGGGCCGCCGAGACACCATGAGAGCCCCCACACTCCTCGCCCCACCGGCCCTGGCCGCACTGGGCACCGCTGGCCGGGCGGGTGGGTGCCCC

seq1 is fine but seq2 and its description have to be removed from a file.

e.g.

AGAGCTAGAAGGGG - ok

AGAAAAAAAAGAGG - remove -- more than 6 A sequentially

ATTTTTTTTATGATG - remove -- more than 6 T sequentially

AGTAGTTAGGGGGG - ok

ACAGAAACAGAATG - remove -- more than 40% of A

TCTGATTTATTATTG - remove -- more than 40% of T

Are there any tools available on the market for these purposes? I would like to get a solution via tool as well use python/Linux.

**A pythonic way to achieve the same:**

    from Bio import SeqIO
    import getopt, sys, re
    
    def usage():
        print "Usage: remove_seqs.py -i <input_fasta> -o <output_fasta>"
    
    try:
        options, remainder=getopt.getopt(sys.argv[1:], 'i:o:h')
    
    except getopt.GetoptError as err:
        print str(err)
        usage()
        sys.exit()
    
    for opt, arg in options:
        if opt in ('-i'):
            input_file=arg
        if opt in ('-h'):
            usage()
    	sys.exit()
        elif opt in ('-o'):
            output_file=arg
    
    out=open(output_file, 'w')
    
    for record in SeqIO.parse(input_file, "fasta"):
        # check for 6 or more A's or T's
        search_hexamers=re.search('A{6,}|T{6,}',str(record.seq))
        # remove those sequences
        if not search_hexamers:
            # Calculate percentage of A's or T's 
            a = (sum(record.seq.count(x) for x in ['A'])/float(len(str(record.seq)))) * 100
            t = (sum(record.seq.count(x) for x in ['T'])/float(len(str(record.seq)))) * 100
            # Check of percentage of A's or T's is more than 40 % and remove
            if not a > 40 or t > 40:
                out.write(">"+record.id+"\n"+str(record.seq))
    out.close()

**USAGE**

    remove_seqs.py -i <input_fasta> -o <output_fasta>

**Dependency**: Biopython

**Input:**

    >ok
    AGAGCTAGAAGG
    >remove
    AGAAAAAAAAGG 
    >remove
    ATTTTTTTTAGGA
    >ok
    AGTAGTTAGGGG

**Output**

    >ok
    AGTAGTTAGGGG

**Note**: 

    >ok
    AGAGCTAGAAGG

above sequence was removed as the percent of A's crossed 40%