衝突我有兩個循環的腳本:循環在Perl
#!/usr/bin/perl
use Bio::Graphics;
use Bio::SeqFeature::Generic;
$seq = "";
$seqlength = length($seq);
$count = 0;
while ($line = <>) {
if (/^>/) {
$count = 1;
next; }
if ($count == 1) {
chomp;
$seq .= $line; }
}
while (<>) {
chomp;
next if /^\#/;
my @gff_data = split /\t+/;
next if ($gff_data[2] ne "gene");
my $feature = Bio::SeqFeature::Generic->new(
-display_name => $gff_data[8],
-score => $gff_data[5],
-start => $gff_data[3],
-end => $gff_data[4]
);
$track->add_feature($feature);
}
沒有第一環,第二環工程。但是,在第一個循環中,第二個循環不起作用。爲什麼?
我該如何避免這種情況?使用兩個循環而不是加入循環。 – user2886545
@ user2886545 - 你剛剛在處理fasta文件嗎? – Kenosis
這是一個GFF文件....但是在某些行後面## FASTA,下面這是一個頭(> jkdssd),然後是序列,就像一個fasta文件。 – user2886545