Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: simple perl script to trim a FASTA file

by almut (Canon)
on Apr 08, 2010 at 22:10 UTC ( #833648=note: print w/ replies, xml ) Need Help??


in reply to simple perl script to trim a FASTA file

trim off x nucleotides from the beginning, and y nucleotides from the end
#!/usr/bin/perl while (<DATA>) { s/^(?!>)...(.*)..../$1/; # ^^^ ^^^^ # x=3 y=4 print; } __DATA__ >HWI-EAS158_40_3_1_46_535 GTGAATGCGTGATACAGGAATGTTCGTTGTGACCAT >HWI-EAS158_40_3_1_47_579 AAAGTGAATGCGTGATACAGGAATGTTCGTTGTGAC >HWI-EAS158_40_3_1_46_731 GTGTCATGCGTGATACAGGAATGTTCGTTGTGAAAA

For longer stretches you can also write .{N} (with N being the number of nucleotides to trim).


Comment on Re: simple perl script to trim a FASTA file
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://833648]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-12-20 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls