24小时热门版块排行榜    

查看: 903  |  回复: 3

xmy0523

新虫 (小有名气)

[交流] 【求助】请教一个Perl语言的编程,谢谢! 已有2人参与

请教各位大侠,下面的第2题怎么做啊?是Bioinformatics, biocomputing and Perl那本书上的,第4章的题目。 谢谢!
1. Define a hash called %genomespeak, which associates the following abbreviations
with the phrase in parentheses: AA (amino acid), BAC (bacterial artificial
chromosome), BLAST (basic local alignment search tool), cDNA (complementary
DNA), DNA (deoxyribonucleic acid), EST (expressed sequence tag),
Exercises 69
FISH (fluorescence in situ hybridization), mRNA (messenger RNA), rDNA
(recombinant DNA), RNA (ribonucleic acid), STS (sequence tagged site), SNP
(single nucleotide polymorphism) and YAC (yeast artificial chromosome)7.
2. Create a small file, called abbrevs, with the following contents:
DNA
SNP
rDNA
AA
BLAST
RNA
YAC
mRNA
Write a program to process abbrevs and display the correct phrase from
the %genomespeak hash for each abbreviation.
回复此楼
奋斗并快乐着!
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

holmescn

金虫 (正式写手)

★ ★ ★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
余泽成(金币+3):谢谢参与应助! 2011-01-05 20:36:14
这个很easy的题目阿,你到底有没有认真看书阿。
CODE:
#!/usr/bin/perl -w

use strict;

my %genomespeak = ("AA" => "amino acid", "BAC" => "bacterial artificial chromosome",
    "BLAST" => "basic local alignment search tool", "cDNA" => "complementary DNA",
    "DNA" => "deoxyribonucleic acid", "EST" => "expressed sequence tag",
    "FISH" => "fluorescence in situ hybridization", "mRNA" => "messenger RNA",-
    "rDNA" => "recombinant DNA", "RNA" => "ribonucleic acid",-
    "STS" => "sequence tagged site", "SNP" => "single nucleotide polymorphism",
    "YAC" => "yeast artificial chromosome");

open(IN, "< abbrevs") or die("$!");

while(){
    chop;
    print($genomespeak{$_}, "\n");
}
close(IN);

2楼2011-01-05 09:41:07
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xmy0523

新虫 (小有名气)

引用回帖:
Originally posted by holmescn at 2011-01-04 18:41:07:
这个很easy的题目阿,你到底有没有认真看书阿。
[code]
#!/usr/bin/perl -w

use strict;

my %genomespeak = ("AA" => "amino acid", "BAC" => "bacterial arti ...

怎么运行了说: No such fiel or directory at xxx.plx line 13?  就是open 那行。
我是初学者,刚看完第4章,你用到的几个命令都还没学过啊。努力看书去。非常谢谢啊!
奋斗并快乐着!
3楼2011-01-05 10:56:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

holmescn

金虫 (正式写手)

★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
余泽成(金币+1):辛苦了! 2011-01-07 11:10:48
把最后给的那个缩写列表保存到abbrevs这个文件里,然后再试

煤电过的应该就只有chop这个吧。这个是去掉末尾的回车的。
4楼2011-01-05 22:44:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 xmy0523 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 一志愿985,本科211,0817化学工程与技术319求调剂 +3 Liwangman 2026-03-15 3/150 2026-03-15 18:16 by JourneyLucky
[考研] 0703化学调剂 290分有科研经历,论文在投 +3 腻腻gk 2026-03-14 3/150 2026-03-15 17:28 by 小物理化学
[考研] 26考研一志愿中国石油大学(华东)305分求调剂 +3 嘉年新程 2026-03-15 3/150 2026-03-15 13:58 by 哈哈哈哈嘿嘿嘿
[考研] 085600材料与化工 求调剂 +11 enenenhui 2026-03-13 12/600 2026-03-14 21:48 by laoshidan
[基金申请] 现在如何回避去年的某一个专家,不知道名字 +3 zk200107 2026-03-12 6/300 2026-03-14 17:13 by zk200107
[考研] 297求调剂 +4 学海漂泊 2026-03-13 4/200 2026-03-14 11:51 by 热情沙漠
[考研] 材料080500调剂求收留 +3 一颗meteor 2026-03-13 3/150 2026-03-14 10:54 by peike
[考研] 求调剂,药学 +3 归零lbm 2026-03-09 5/250 2026-03-14 02:21 by JourneyLucky
[考研] 301求调剂 +3 归零lbm 2026-03-09 3/150 2026-03-14 02:20 by JourneyLucky
[考研] 2026考研调剂+本科延边大学+山东大学+生物化学与分子生物学+有项目经验 +3 ccdsscjy 2026-03-09 6/300 2026-03-14 02:14 by JourneyLucky
[考研] 调剂 +3 13853210211 2026-03-10 3/150 2026-03-14 00:47 by JourneyLucky
[考研] 复试调剂 +9 Copy267 2026-03-10 9/450 2026-03-13 23:45 by userper
[考研] 0703化学调剂 +4 快乐的香蕉 2026-03-11 4/200 2026-03-13 22:41 by JourneyLucky
[考研] 308求调剂 +5 是Lupa啊 2026-03-11 5/250 2026-03-13 22:13 by JourneyLucky
[考研] 材料工程调剂 +4 咪咪空空 2026-03-11 4/200 2026-03-13 19:57 by JourneyLucky
[考研] 求调剂 +5 一定有学上- 2026-03-12 5/250 2026-03-13 18:31 by ms629
[考研] 085600材料与化工 309分请求调剂 +7 dtdxzxx 2026-03-12 8/400 2026-03-13 14:43 by jxchenghu
[考研] 296求调剂 +3 大口吃饭 身体健 2026-03-13 3/150 2026-03-13 10:31 by 学员8dgXkO
[考研] 270求调剂 085600材料与化工专硕 +3 YXCT 2026-03-11 3/150 2026-03-13 10:13 by houyaoxu
[考研] 341求调剂 +4 捣蛋猪猪 2026-03-11 4/200 2026-03-12 14:47 by ruiyingmiao
信息提示
请填处理意见