[Bioperl-l] Question: How to manipulate files
Brian Osborne
osborne1 at optonline.net
Thu Mar 30 02:16:45 UTC 2006
Michael,
Operations like these are easy using SeqIO - see the Beginners HOWTO or the
SeqIO HOWTO:
http://www.bioperl.org/wiki/HOWTOs
The script could look something like:
use Bio::SeqIO;
my $count = 0;
my $in = Bio::SeqIO->new(-file => "file.fa",-format => "fasta");
my $out = Bio::SeqIO->new(-file => ">newfile.fa",-format => "fasta");
while (my $seq = $in->next_seq) {
$count++;
next if $count < 8;
$out->write_seq($seq);
}
Then you can delete the old and rename the new...
Brian O.
On 3/29/06 5:41 PM, "Michael Craige" <mcraige at genetics.emory.edu> wrote:
> I am attempting to develop a script to open a DNA file contain 15 FASTA
> sequences and then delete the first 7 sequences and close the file leaving
> the remainder 8 sequences intact.
>
> Can someone help me with a Perl script or point me to some doc that can
> help? Here is a sample, the first sequence in the file header is show below.
> All the header is the same except for the number "001 to 015"
>
>
>> 10kb_NN_Analysis.txt.nmrc_001
> NTNTTNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNTNNNNNNNN
> AANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
> NNNNNNNNNNNNNNNNNNNNNNNN
>
> I trying to get the script to find the first sequences ".nmrc_001" and then
> delete files content to the end of file ".nmrc_007" without affect the
> header with ".nmrc_008"
>
> Is there something already exist to do this?
>
>
> Michael Craige
> Emory University
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
More information about the Bioperl-l
mailing list