Java Exercises with Strings on the Corona Virus Genome
Given the data of the corona virus genome from the site https://www.ncbi.nlm.nih.gov/nuccore/MN908947.3?report=fasta
Given the data of the corona virus genome from the site https://www.ncbi.nlm.nih.gov/nuccore/MN908947.3?report=fasta 1) Insert the elements of the genome data into the string and count the elements 2) Arrange the elements like the example file: ATTAAAGGTTTATACCTTCCCAGGTAACAAACCAACCAACTTTCGATCTCTTGTAGATCTGTTCTCTAAA CGAACTTTAAAATCTGTGTGGCTGTCACTCGGCTGCATGCTTAGTGCACTCACGCAGTATAATTAATAAC TAATTACTGTCGTTGACAGGACACGAGTAACTCGTCTATCTTCTGCAGGCTGCTTACGGTTTCGTCCGTG TTGCAGCCGATCATCAGCACATCTAGGTTTCGTCCGGGTGTGACCGAAAGGTAAGATGGAGAGCCTTGTC CCTGGTTTCAACGAGAAAACACACGTCCAACTCAGTTTGCCTGTTTTACAGGTTCGCGACGTGCTCGTAC GTGGCTTTGGAGACTCCGTGGAGGAGGTCTTATCAGAGGCACGTCAACATCTTAAAGATGGCACTTGTGG CTTAGTAGAAGTTGAAAAAGGCGTTTTGCCTCAACTTGAACAGCCCTATGTGTTCATCAAACGTTCGGAT GCTCGAACTGCACCTCATGGTCATGTTATGGTTGAGCTGGTAGCAGAACTCGAAGGCATTCAGTACGGTC GTAGTGGTGAGACACTTGGTGTCCTTGTCCCTCATGTGGGCGAAATACCAGTGGCTTACCGCAAGGTTCT TCTTCGTAAGAACGGTAATAAAGGAGCTGGTGGCCATAGTTACGGCGCCGATCTAAAGTCATTTGACTTA GGCGACGAGCTTGGCACTGATCCTTATGAAGATTTTCAAGAAAACTGGAACACTAAACATAGCAGTGGTG TTACCCGTGAACTCATGCGTGAGCTTAACGGAGGGGCATACACTCGCTATGTCGATAACAACTTCTGTGG From this string to the following: 1 attaaaggtt tataccttcc caggtaacaa accaaccaac tttcgatctc ttgtagatct 61 gttctctaaa cgaactttaa aatctgtgtg gctgtcactc ggctgcatgc ttagtgcact 121 cacgcagtat aattaataac taattactgt cgttgacagg acacgagtaa ctcgtctatc 181 ttctgcaggc tgcttacggt ttcgtccgtg ttgcagccga tcatcagcac atctaggttt 241 cgtccgggtg tgaccgaaag gtaagatgga gagccttgtc cctggtttca acgagaaaac 301 acacgtccaa ctcagtttgc ctgttttaca ggttcgcgac gtgctcgtac gtggctttgg To perform the analysis of the genome, proceed by importing the data mainly into a String object in Java. You should know the tools or methods for working with string sequences with Java. The following video should give you the basic tools for handling strings. Let's start analyzing the simple and common methods for working with String objects in Java using iteratively coded loops, but above all using Java's native String class. SOME METHODS OF THE String CLASS • s1.length(): returns the length of the string s1 • S1.charAt(index): returns a character at the prefixed position • s1.equals(s2): says if s1 and s2 have the same content • Note s1.equals(s2) is different from s1 == s2! • s1.compareTo(s2): 0 if s1 is equal to s2, <0 if s1 < s2, > 0 if s1 > s2. The index of the first different character is returned • s1.indexOf ('c') returns the index of the first occurrence of c in s1 (-1 if it doesn't exist) • s1.substring(10,18): returns the substring that goes from 10 to 17 (18-1) • s1.replace('E','X'): returns a string with all 'E' replaced with 'X' • Note: substring() and replace() do not modify the string but create a new one! Watch the following video to encode their use and see code examples: https://www.youtube-nocookie.com/embed/pYlY9AgytC0?origin=http://localhost