#!/usr/bin/perl
use strict;
use warnings;
# (1) program reads file
# (2) uses the split fxn to split the columns
# (3) loads the IDs that begin with FBgn from the 1st column as keys to a hash
# (4) loads the gene symbol from the second column as the value in each hash entry
my $infile = "fb_synonym_fb_2013_05.tsv";
open( FILE, "<", $infile )
or die "Cannot open file $!";
my @data = <FILE>;
foreach my $line (@data) {
my @column = split( /\s+/, $line );
#print $column[0],"\n";
my $columnID = $column[0];
foreach ( my $columnID ) {
while ( $columnID =~ /(^FBgn\d+)/ ) {
my $ID = $1;
print $ID, "\n";
}
}
}
我尝试运行代码,但它说 $columnID 是一个未初始化的值。我被困在这一点上。我需要选择以“FBgn”开头的列
输入:数据文件非常大,所以这里是一个选择
##primary_FBid current_symbol current_fullname fullname_synonym(s) symbol_synonym(s)
FBtr0000004 Ecol\lacZ[svp-3]RA lacZ[svp-3]RA
FBtr0000005 Ecol\lacZ[hkb-5953]RA lacZ[5953]RA,lacZ[hkb-5953]RA,hkb- lacZ,5953
FBtr0000007 Mab4A11[+]R2.1
FBtr0000009 Ecol\lacZ[betaTub56D.AS1]RA lacZ[betaTub56D.AS1]RA
FBtr0000010 Ecol\lacZ[betaTub56D.AS2]RA lacZ[betaTub56D.AS2]RA
FBtr0000011 Ecol\lacZ[betaTub56D.AS3]RA lacZ[betaTub56D.AS3]RA
FBtr0000012 Ecol\lacZ[betaTub56D.NN]RA lacZ[betaTub56D.NN]RA
FBtr0000013 Ecol\lacZ[betaTub56D.NC]RA lacZ[betaTub56D.NC]RA
FBtr0000014 Ecol\lacZ[betaTub56D.CP]RA lacZ[betaTub56D.CP]RA
FBtr0000015 Ecol\lacZ[betaTub56D.ACO]RA lacZ[betaTub56D.ACO]RA
FBtr0000016 Ecol\lacZ[betaTub56D.AC3]RA lacZ[betaTub56D.AC3]RA