0

我正在尝试提取以下文件中的 11 列中的每一列:

http://bioinfo.mc.vanderbilt.edu/TSGene/Human_716_TSGs.txt

...进入初级大学生物信息学项目的标量列表。请参见下文,我的努力是有效的,但并不完美,因为各列之间的空白量不同(请参阅文件顶部了解详细信息)。

use strict;
use warnings;

open FH, '<', 'tsg.txt' or die $!;
my $data = do {local $/; <FH>};
close FH or die $!;

my($id, $sym, $alias, $xref, $chromo, $band, $name, $gene_t, $desc, $nuc_seq,
   $pro_seq) = $data =~ /(\S+)\s+
                         (\S+)\s+
                         (\S+)\s+
                         (\S+)\s+
                         (\S+)\s+
                         (\S+)\s+

                         (\S+)\s+
                         /xms;

print "GeneID: $id", "\n";
print "Gene_symbol: $sym", "\n";
print "Alias: $alias", "\n";
print "XRef: $xref", "\n";
print "Chromosome: $chromo", "\n";
print "Cytoband: $band", "\n";

print "Full_name: $name", "\n";
#print "Gene_type: $gene_t", "\n";
#print "Description: $desc", "\n";
#print "Nucleotide_sequence: $nuc_seq", "\n";
#print "Protein_sequence: $pro_seq", "\n";

谢谢您的帮助。

4

1 回答 1

3

这个文件看起来像是tab分开的,你应该能够使用spliton将每一行存储到一个数组中\t

my @columns = split( "\t", $data );

然后你可以通过索引来访问你的列:

my $id = $columns[0];

等等

于 2013-07-03T02:41:33.003 回答