deepcelllineage / mitolin

Use mitochondrial sequence from single cells to determine cell lineage relationships
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

Extract chromosome M data #18

Open decareano opened 5 years ago

decareano commented 5 years ago

The script "mitolin_split.py" will generate two new fasta.eg files with only ChrM data.

  1. chrMchr1New-1.fasta.eg
  2. chrMchr1New-2.fasta.eg
Deena-B commented 5 years ago

Hi Marcello, Please see the note below "Rebasing the commits of this branch on top of the base branch cannot be performed automatically due to conflicts encountered while reapplying the individual commits from the head branch."

From reading the "command line instructions" it looks like you have to do the rebase "from your project repository". Please give it a try and message me to let me know how it went.

Cheers, Deena

decareano commented 5 years ago

Hi Deena,

  1. Does open("chrMchr1New-"+str(x)+".fasta.eg", 'w') also create a file or did you have to create them, then open them in your script?

    I am using the loop to iterate through the files you provided. it then writes the results of the parsing to a new file("chrMchr1New-"+str(x)+".fasta.eg", 'w')

  2. Are opened files automatically read one line at a time? In this case, I convert them to a list and append the lines (one by one to the list)

  3. I'm confused about the two uses of '/n'. First you seem to strip it: mylines.append(a_line.rstrip('\n')) You are right, don't needed here. Removed. rstrip with no args by default will remove the whitespace I think.

    Then, does this line add it?: writer.writelines("%s\n" % i for i in mylines) If so, why strip it and add it back? I use it here for neater formatting purposes. If not, you get the sequences all bunched up.

  4. Would you also please explain what the letters i stand for in the string formatting line below? writer.writelines("%s\n" % i for i in mylines) writelines() iterates over this sequence of strings (i) and writes every item. https://stackoverflow.com/questions/12377473/python-write-versus-writelines-and-concatenated-strings. For further info