Question: Perl script for discarding sequences less than 200 nucleotides before running CPC in rnaseq analysis
0
gravatar for yaminivadapally
4 months ago by
yaminivadapally0 wrote:

Ii want the perl script to discard sequences less than 200 nts from fasta file to run CPC

rna-seq perl • 208 views
ADD COMMENTlink modified 4 months ago by zx87546.6k • written 4 months ago by yaminivadapally0

what have you tried so far ?

ADD REPLYlink written 4 months ago by Pierre Lindenbaum117k
5
gravatar for karthic
4 months ago by
karthic100
karthic100 wrote:

I hope this below script works...just save and run with script name followed by fasta file and trim_length (integer)

#!/usr/bin/perl
use strict;
use warnings;

my $minlen = shift or die "Error: `minlen` parameter not provided\n";
{
    local $/=">";
    while(<>) {
        chomp;
        next unless /\w/;
        s/>$//gs;
        my @chunk = split /\n/;
        my $header = shift @chunk;
        my $seqlen = length join "", @chunk;
        print ">$_" if($seqlen >= $minlen);
    }
    local $/="\n";
}
ADD COMMENTlink modified 4 months ago • written 4 months ago by karthic100
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 750 users visited in the last hour