shabird has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks! Hope you are all fine, Monks, to my knowledge i am applying the following regex in my code to extract only id's i.e: (first part of each line NM_030643.4,NR_029834.1,NM_001198855.1, AC067940.1)of the file. but it is returning this "APOL4) CYP2C8)" instead.
The file:
>NM_030643.4 Homo sapiens apolipoprotein L4 (APOL4) GAGGTGCTGGGGAGCAGCGTGTTTGCTGTGCTTGATTGTGAGCTGCTGGGAAGTTGTGACTTTCATTTTA CCTTTCGAATTCCTGGGTATATCTTGGGGGCTGGAGGACGTGTCTGGTTATTATATAGGTGCACAGCTGG >NM_001198855.1 Homo sapiens cytochrome P450 family 2 subfamily C memb +er 8 (CYP2C8) ACATGTCAAAGAGACACACAC >NR_029834.1 Homo sapiens microRNA 200a (MIR200A), microRNA CCGGGCCCCTGTGAGCATC >AC067940.1 Homo sapiens clone RP11-818E9, LOW-PASS SEQUENCE SAMPLING AAATACAACTTTAAATCAAAACGGTAAAAATTCCACTCTTTCATACTAACTTCAAAAGTATTTGCTTTAA AAAAAAAGNNNNNNNNN
open(GENBANK, "/Users/Desktop/Genes.fasta") or die; my $content = join("", <GENBANK>); close(GENBANK); sub mysub{ return shift =~ /(\w+\W+)\n/g; } my @matches = mysub($content); print "@matches\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting string and numbers from a file
by choroba (Cardinal) on Apr 29, 2020 at 13:50 UTC | |
by shabird (Sexton) on Apr 29, 2020 at 17:26 UTC | |
by perlfan (Parson) on May 12, 2020 at 03:23 UTC | |
|
Re: Extracting string and numbers from a file
by Athanasius (Archbishop) on Apr 29, 2020 at 13:48 UTC | |
by shabird (Sexton) on Apr 29, 2020 at 17:27 UTC |