text: user3329: From the FASTA header I get the following information:
  gi|1543850138|ref|NC_040192.1| Desmodium mottle virus isolate UG5 segment DNA-B, complete sequence
  ['gi', '1543850138', 'ref', 'NC_040192.1', ' Desmodium mottle virus isolate UG5 segment DNA-B, complete sequence']
  
  Is there a better way to create a dictonary as I did with the below script?
  from Bio import SeqIO
  
  organismInfo = {}
  for seq_record in SeqIO.parse("data/landplantsviruses.fasta","fasta"):
      print(seq_record.description)
      temp = seq_record.description.split('|')
      print(temp)
      organismID = temp[3]
      organismName = temp[4].lstrip()
      print(organismID, organismName)
      organismInfo[organismID] = organismName
  print(organismInfo)
  ```
  
  
  user6322: You may notice that Uniprot and NCBI have different standard: so your solution is not universal, which is why BioPython does not split the description for you —it could know different 'dialects' of fasta files but that is a tedious minefield.
  About coding, one write something in a code golf format, but this is problematic as it is hard to interpret and adapt, i.e. it's a bad practice. Having said that if made a list of keys you could use zip with your list of elements as the list of keys may be more intelligible.
  header = 'gi|1543850138|ref|NC_040192.1| Desmodium mottle virus isolate UG5 segment DNA-B, complete sequence'
  keys = 'db|id|type|id2|wordy.'.split('|')
  organism_info = dict( zip(keys, map(str.strip, header.split('|')) ))
  
  Also, for variables in Python, camel case is for Classes, not instances. Even if you have to send data to JS, using a constistent style, i.e. the PIP guideline one, avoids errors.
  
original_text: 3329: <p>From the FASTA header I get the following information:</p>
  <pre><code>gi|1543850138|ref|NC_040192.1| Desmodium mottle virus isolate UG5 segment DNA-B, complete sequence
  ['gi', '1543850138', 'ref', 'NC_040192.1', ' Desmodium mottle virus isolate UG5 segment DNA-B, complete sequence']
  </code></pre>
  <p>Is there a better way to create a dictonary as I did with the below script?</p>
  <pre><code>from Bio import SeqIO
  
  organismInfo = {}
  for seq_record in SeqIO.parse(&quot;data/landplantsviruses.fasta&quot;,&quot;fasta&quot;):
      print(seq_record.description)
      temp = seq_record.description.split('|')
      print(temp)
      organismID = temp[3]
      organismName = temp[4].lstrip()
      print(organismID, organismName)
      organismInfo[organismID] = organismName
  print(organismInfo)
  <span class="math-container">```</span>
  </code></pre>
   6322: <p>You may notice that Uniprot and NCBI have different standard: so your solution is not universal, which is why BioPython does not split the description for you —it could know different 'dialects' of fasta files but that is a tedious minefield.</p>
  <p>About coding, one write something in a <a href="https://en.wikipedia.org/wiki/Code_golf" rel="nofollow noreferrer">code golf</a> format, but this is problematic as it is hard to interpret and adapt, i.e. it's a bad practice. Having said that if made a list of keys you could use <code>zip</code> with your list of elements as the list of keys may be more intelligible.</p>
  <pre><code>header = 'gi|1543850138|ref|NC_040192.1| Desmodium mottle virus isolate UG5 segment DNA-B, complete sequence'
  keys = 'db|id|type|id2|wordy.'.split('|')
  organism_info = dict( zip(keys, map(str.strip, header.split('|')) ))
  </code></pre>
  <p>Also, for variables in Python, camel case is for Classes, not instances. Even if you have to send data to JS, using a constistent style, i.e. the PIP guideline one, avoids errors.</p>
  