2462 days ago
Collision free write with Perl
#Write into outfile -- collision free because of multicore usesage sub collision_free_write { my($outFile, $msg) = @_;...!"; print $ofh "$msg\n" or die "$0 [$$]: write: $!"; close $ofh...2458 days ago
Genetic Algorithms demonstration with word DNA in Perl
...ngth = 512; # 4 "letters" in the DNA my $dna_byte_length = $dna_length / 8; #...viduals (so they won't procreate) $individual->{survived} =...2 = $parent2->{dna}; # note we do operations on BYTES, no...sample from an array of weighted elements # originally writt...2368 days ago
Convert newline formated sequence into fasta format with perl
use strict; use warnings; my $filename = $ARGV[0]; open(my $fh, '2366 days ago
Extract fasta sequence with Ids with Bash script
#!/bin/bash while IFS='' read -r line || [[ -n "$line" ]]; do echo "Text read from file: $line" samtools faidx ONT.fasta $line > $line.faa done < "$1"2351 days ago
Perl script for calculate Levenshtein distance
sub levenshtein_dist { my ($str1, $str2) = @_; my ($len1, $len2) = (length $str1, length $str2); if ($len1 == 0) { return $len2; } if ($len2 == 0) { return $len1; } my %mat; for (my $i = 0; $i2337 days ago
Calculate Dinucleotide Frequency with Perl
#!/usr/bin/perl -w use strict; my ($genome, $head, $tail); my (%mono_nt, %di_nt); $/ = ">"; open my $fasta, '2335 days ago
Clump Finding Problem Solved with Perl
#Find patterns forming clumps in a string. #Given: A string Genome, and integers k, L, and t. #Return: All di...2330 days ago
Loop over with all files in a directory in bash
...ocessing $f file..." ff=$(basename "${f%.*}") echo $ff # take action on each file. $f store current file name mkdir $ff $path/SatsumaSynteny -q $ref -t $f -o $ff #ca...2328 days ago
Convert fastq to fasta in Perl
...astq'); my $out=Bio::SeqIO->new(-file=>'>seq.fasta', -format=>'fasta'); while (my $seq=$in->next_seq) { $out->write_seq($seq) }2327 days ago