本篇内容主要讲解“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语言代码块如何高亮显示”有了更深的了解,不妨来实际操作一番吧!这里是天达云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!