【问题标题】:Extracting information from a .gtf to a new text file using PERL使用 PERL 将信息从 .gtf 提取到新的文本文件
【发布时间】:2014-09-14 19:46:47
【问题描述】:

我有以下 .gtf 文件,我只需要提取 4 个变量(染色体、起始/终止密码子和转录本 i.d.

1       Cufflinks       transcript      11869   14412   1000    +       .      gene_id "CUFF.1"; transcript_id "CUFF.1.2"; FPKM "0.3750000000"; frac "0.000000"; conf_lo "0.375000"; conf_hi "0.375000"; cov "1.470346"; full_read_support "yes";
1       Cufflinks       transcript      11869   14412   444     +       .      gene_id "CUFF.1"; transcript_id "CUFF.1.3"; FPKM "0.1666666667"; frac "0.000000"; conf_lo "0.166667"; conf_hi "0.166667"; cov "0.653487"; full_read_support "yes";
2       Cufflinks       transcript      11869   14412   333     +       .      gene_id "CUFF.1"; transcript_id "CUFF.1.4"; FPKM "0.1250000000"; frac "0.000000"; conf_lo "0.125000"; conf_hi "0.125000"; cov "0.490115"; full_read_support "yes";**

我的问题是脚本如何知道在选定的文件上工作?

你用过吗:

(1)my $file = 'transcripts_selected.gtf'

(2) 也可以用这个脚本来提取切片数据:

say $data->{"chromosome_number"}->{"start_codon"}->{"stop_codon"}->{"transcript_id"};

或者应该:

BioSeq->new(-chromosome_number, -start_codon...)方法可以用吗?

(3) 最后,这个脚本取自 BioperlHOWTO:

my $seq_in = Bio::SeqIO->new( -file   => "<$infile", -format => $infileformat,);
my $seq_out = Bio::SeqIO->new( -file   => ">$outfile", -format => $outfileformat,);
while (my $inseq = $seq_in->next_seq) {$seq_out->write_seq($inseq);
  • 在哪里说变量 $infile/$outfile 应该把 .gtf 文件的名称放在这里,用所选数据的新文件的名称替换 $outfile?

【问题讨论】:

  • 为什么不看看一些初学者的 perl 教程,以便在开始尝试了解 BioPerl 之前掌握编程的基本原理?
  • @ialarmedalien 也许她用 Perl 写东西的唯一原因是因为 BioPerl。

标签: perl file-io extract bioinformatics bioperl


【解决方案1】:

指定文件名的最简单方法是编写如下内容:

my $infile = shift;
my $outfile = shift;

在 HOWTO 的代码块上方,然后输入:

perl ScriptName transcripts_selected.gtf OutFileName

在命令行

【讨论】:

    猜你喜欢
    • 2021-09-23
    • 2015-06-07
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    • 1970-01-01
    • 2011-09-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多