I'm running Strawberry perl 5.20.2 on windowsx64. First day, just trying to take over some bioinformatics from a person leaving (I have no perl experience). Could you tell me what switches/options there are for the below script? I can get it to work (using >perl split_FASTA-no_overlap.pl "filename". But the output is just to the "terminal"? and I would like it to write the files to the directory for import into a sequencing program. Sorry if question is not in the correct form. Thanks.
#! /opt/local/compbio/bin/perl5.8.0 -w $size = 5000; $overlap = 1; $overlap_size = 0.00*$size; $f = $ARGV[0]; local $/ = "\n>"; open(IN, "$f") || die "$f no\n"; while(<IN>){ s/>//g; $id = ''; $annt = ''; @ln = split /\n/; $defLine = shift @ln; $id = $1 if $defLine =~ /^(\S+)\s?/; $annt = $1 if $defLine =~ /^\S+\s+(.+)$/; $seq = join("",@ln); for(my $i=0; ($i*$size)<(length$seq); $i++){ $subSeq = substr($seq,$i*$size, $size); $subSeq =~ s/(\w{60)/\$1\n/g; chomp $subSeq; $start = $i*$size +1; $end = $start + (length$subSeq) - 1; print ">$id:[",$start,'-',$end,"] $annt\n$subSeq\n"; if($overlap == 1 && ($i*$size+$overlap_size) < (length$seq)){ $subSeq = substr($seq,$i*$size+$overlap_size, $size); $subSeq =~ s/(\w{60)/\$1\n/g; chomp $subSeq; $start = $i*$size +1+$overlap_size; $end = $start + (length$subSeq) - 1; print ">$id:[",$start,'-',$end,"] $annt\n$subSeq\n"; } } }
In reply to begginer help running perl script by tstrobaugh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |