本篇内容主要讲解“R语言代码块如何高亮显示”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“R语言代码块如何高亮显示”吧!
Tips:
1.代码中的注释行应该单独一行,前后各空一行,以免造成代码高亮显示错误;
2.在代码中已经添加代码高亮后,代码需要空行时可用 shift+enter键添加空行,而直接enter代码块会断裂;
如下是空行后,完美显示:
use Bio::SeqIO;
use Bio::Seq;
use Data::Dumper;
$in = Bio::SeqIO->new(-file => "D:/share/scripts/Arabidopsis_thaliana.TAIR10.cds.all.fa" ,
-alphabet=>"dna",
-format => 'Fasta');
$out = Bio::SeqIO->new(-file => ">D:/share/scripts/aa.fa" ,
-format => 'fasta');
while ( my $seqobj = $in->next_seq() ) {
# the human read-able id of the sequence
my $id=$seqobj->id();
# string of sequence
my $seq=$seqobj->seq();
# a description of the sequence
my $desc=$seqobj->desc();
# one of 'dna','rna','protein' https://www.bioinformatics.org/sms/iupac.html
my $alphabet=$seqobj->alphabet();
my $len=$seqobj->length();
print $id."\n";
print $seq."\n";
print $desc."\n";
print $alphabet."\n";
print $len."\n";
print $seqobj."\n";
print Dumper($seqobj);
$out->write_seq($seqobj);
last;
}
如果没有空行,代码显示会有错误:
use Bio::SeqIO;
use Bio::Seq;
use Data::Dumper;
$in = Bio::SeqIO->new(-file => "D:/share/scripts/Arabidopsis_thaliana.TAIR10.cds.all.fa" ,
-alphabet=>"dna",
-format => 'Fasta');
$out = Bio::SeqIO->new(-file => ">D:/share/scripts/aa.fa" ,
-format => 'fasta');
while ( my $seqobj = $in->next_seq() ) {
# the human read-able id of the sequence
my $id=$seqobj->id();
# string of sequence
my $seq=$seqobj->seq();
# a description of the sequence
my $desc=$seqobj->desc();
# one of 'dna','rna','protein' https://www.bioinformatics.org/sms/iupac.html
my $alphabet=$seqobj->alphabet();
my $len=$seqobj->length();
print $id."\n";
print $seq."\n";
print $desc."\n";
print $alphabet."\n";
print $len."\n";
print $seqobj."\n";
print Dumper($seqobj);
$out->write_seq($seqobj);
last;
}
到此,相信大家对“R语言代码块如何高亮显示”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。